Camel cxfws producer, POJO format, throws "Get the wrong parameter size to invoke the out service" error

1.3k Views Asked by At

I have a similar situation as Camel CXF POJO mode using Java DSL where

  • I have a wsdl https://api.stage.eventcore.com/ReportService.asmx?WSDL
  • Created a wsdl2java library
  • Using camel cxf producer component, with POJO format to make a SOAP request.
  • Setting the operationname, operationnamespace as headers. cxfEndpoint is also configured accurately.

Below is the error I am getting for "GetReport" operation.

java.lang.IllegalArgumentException: Get the wrong parameter size to invoke the out service, Expect size 7, Parameter size 4.
Please check if the message body matches the CXFEndpoint POJO Dataformat request.

Here is the binding info for the operation I am dealing with.

<wsdl:operation name="GetReport">
<soap:operation soapAction="https://api.eventcore.com/GetReport" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
<soap:header message="tns:GetReportAuthTokenHeader" part="AuthTokenHeader" use="literal"/>
<soap:header message="tns:GetReportCredentialsHeader" part="CredentialsHeader" use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
<soap:header message="tns:GetReportAuthTokenHeader" part="AuthTokenHeader" use="literal"/>
</wsdl:output>
</wsdl:operation>

As part of the exchange body I am sending a list of objects with CredentialHeader, GetReport Object with necessary data. I also added holder parameters for Response message.

GetReport getReport = new GetReport();
getReport.setReportID(123);
getReport.setSortColumn("LastModified");
getReport.setStartRow(1);
getReport.setEndRow(2);
getReport.setSortAscending(true);
ReportFilter filter = new ReportFilter();
filter.setField("LastModified");
filter.setComparison(ComparisonType.GREATER_THAN);
filter.setMatchValue("2018-05-09T23:23:51.8769404Z");
filter.setMode(FilterMode.SELF);
getReport.setFilter(filter);

CredentialsHeader credentials = new CredentialsHeader();
credentials.setUserName("foo");
credentials.setPassword("bar");
credentials.setEventID(11111);

List<Object> params = new ArrayList<Object>();
params.add(getReport);
params.add(credentials);
params.add(null); //params.add(new AuthTokenHeader());
params.add(new javax.xml.ws.Holder<AuthTokenHeader>());
//params.add(new javax.xml.ws.Holder<GetReportResponse>());

exchange.getIn().setBody(params);

here is the cxfEndpoint configuration.

org.apache.camel.component.cxf.CxfEndpoint endpoint_cSOAP_1 = getCxfEndpoint(
                "cxf://"
                        + "https://api.stage.eventcore.com/ReportService.asmx"
                        + "?dataFormat=POJO"
                        + "&serviceClass="
                        + "tableau.ea.eventcore.api.reportservice.ReportServiceSoap"
                        + "&serviceName="
                        + "{https://api.eventcore.com/}ReportService"
                        + "&endpointName="
                        + "{https://api.eventcore.com/}ReportServiceSoap"
                        + "&defaultOperationNamespace="
                        + javax.xml.namespace.QName.valueOf(
                                "{https://api.eventcore.com/}GetReport")
                                .getNamespaceURI()
                        + "&defaultOperationName="
                        + javax.xml.namespace.QName.valueOf(
                                "{https://api.eventcore.com/}GetReport")
                                .getLocalPart() + "&" + "loggingFeatureEnabled"
                        + "=" + "true" + "&" + "continuationTimeout" + "="
                        + 600000
                        + "&headerFilterStrategy=#CXF_PAYLOAD_HEADER_FILTER"
                        + "&properties.id=" + "cSOAP_1", false, false, false,
                (String[]) null);

What I don't understand is , why cxf expecting 7 parameters? What are those 7 params? I tried making it 7 by adding some nulls, but it fails with "argument type mismatch" error. Please help me understand Input message parts in this particular operation.

1

There are 1 best solutions below

0
On

I did workaround this issue by NOT using "-exsh true" option while generating wsdl, and setting the SOAP headers using Holders.LIST header. While doing that I had to set mustUnderstand = true for CredentialsHeader.

finally I got the headers added to the SOAP request. But, I really want to know why the path of passing all headers plus body as list of parameters ( with "-exsh true" option) didn't work. I had exact same approach working for a different webservice, but not for this one. I am curious what is making the difference.

Pls share if anyone has insight.