Joe Joe - 1 year ago 155
Java Question

Camel CXF Soap Client calling web service with multiple input parameters

I'm using Camel and have generated code from a WSDL using CXF. I generated a client stub and the implementation appears like this:

SetDeviceDetailsv4 port = ss.getSetDeviceDetailsv4Port(); _setDeviceDetailsv4_parameters = null; _setDeviceDetailsv4_gdspHeader = null; _setDeviceDetailsv4__return = port.setDeviceDetailsv4(_setDeviceDetailsv4_parameters, _setDeviceDetailsv4_gdspHeader);

System.out.println("setDeviceDetailsv4.result=" + _setDeviceDetailsv4__return);

As you one can see, the port takes two parameters and returns the response, which I want to delegate back to my Camel Route. What's the best way to implement this in Camel? I already have my CXF Enpoint defined, I'm just struggling with the DSL Routing part of it. Should I add a processor like what is found in this link? Apache Camel and web services


Joe Joe

I'm not sure if this is the correct way to do it but I added both of my "input" objects as a Camel Header, then I wrote a processor that grabbed what I needed and put the two objects that the service call needed as parameters.

public void process(Exchange exchange) throws Exception {
        Message inMessage = exchange.getIn();
        gdspHeader = inMessage.getHeader(GDSP_HEADER,;
        commModule = inMessage.getHeader(COMM_MODULE_HEADER, resmed.hi.ngcs.datastore.model.CommModule.class);
        SetDeviceDetailsv4_Type deviceDetails = createSetDeviceDetailsv4(commModule);

        List<Object> params = new ArrayList<>();