7 Replies Latest reply on Feb 2, 2010 3:37 PM by Lyfe Musique

    calling external web service from web service deployed in esb

    Lyfe Musique Novice

      I'm trying to call an external web service from a web service inside the esb.


      I took the cxf-wsdl-first project and modified it.  I was able to successfully create my own wsdl to associate with this web service, create the necessary classes, and write code to pass back a value to an external client.


      Now, I want to call an external web service from this web service.  In the method, I added the following code from camel-example-cxf proj (but I modified it for the web service I'm calling):


      // Service Qname as defined in the WSDL.

              QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPService");


              // Port QName as defined in the WSDL.

              QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapOverHttpRouter");


              // Create a dynamic Service instance

              Service service = Service.create(serviceName);


              // Add a port to the Service

              service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);


              // Create a dispatch instance

              Dispatch dispatch = service.createDispatch(portName, SOAPMessage.class,



              // Use Dispatch as BindingProvider

              BindingProvider bp = (BindingProvider)dispatch;


              MessageFactory factory = ((SOAPBinding)bp.getBinding()).getMessageFactory();


              // Create SOAPMessage Request

              SOAPMessage request = factory.createMessage();


              // Request Body

              SOAPBody body = request.getSOAPBody();


              // Compose the soap:Body payload

              QName payloadName = new QName("http://apache.org/hello_world_soap_http/types", "greetMe", "ns1");


              SOAPBodyElement payload = body.addBodyElement(payloadName);


              SOAPElement message = payload.addChildElement("requestType");


              message.addTextNode("Hello Camel!!");


              // Invoke the endpoint synchronously

              SOAPMessage reply = null;


              try {

                  // Invoke endpoint operation and read response

                  reply = dispatch.invoke(request);

              } catch (WebServiceException wse) {





      I also added the following imports:


      import javax.xml.namespace.QName;

      import javax.xml.soap.MessageFactory;

      import javax.xml.soap.SOAPBody;

      import javax.xml.soap.SOAPBodyElement;

      import javax.xml.soap.SOAPElement;

      import javax.xml.soap.SOAPMessage;

      import javax.xml.ws.BindingProvider;

      import javax.xml.ws.Dispatch;

      import javax.xml.ws.Service;

      import javax.xml.ws.WebServiceException;

      import javax.xml.ws.soap.SOAPBinding;

      import javax.xml.soap.SOAPFaultException;


      When I try to access my web service, I get the following error: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/wsdl/soap/http


      Doing some research, I added cxf-rt-transports-http and cxf-rt-transport-http-jetty but still got the same error.  I've seen posts in the forum of the same error but mine is from javax.xml.SOAPFaultException whereas the others are from org.apache.cxf.interceptor.Fault.


      My question is:

      Any ideas on where I can start to debug this problem?