Examples of CXFConnection


Examples of org.apache.cxf.jca.outbound.CXFConnection

    String getResponseFromWebService() {

        String responseFromWebService = "No message sent";

        CXFConnection connection = null;
        try {
            connection = getServiceConnection();
            Greeter greeter = connection.getService(Greeter.class);
           
            if (operationName != null) {
                if ("sayHi".equals(operationName)) {
                    responseFromWebService = greeter.sayHi();
                } else if ("greetMe".equals(operationName)) {
                    responseFromWebService = greeter.greetMe(userName);
                }
            }

            Map<String, Object> requestContext = ((BindingProvider)greeter).getRequestContext();
            System.out.println("requestContext = " + requestContext);
           
        } catch (Exception e) {
            e.printStackTrace();
            if (e.getCause() != null) {
                e.getCause().printStackTrace();
            }
            responseFromWebService = e.toString();
        } finally {
            try {
                if (connection != null) {
                    connection.close();
                }
            } catch (Exception e) {
                // report error from close
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.