Daniel
Daniel

Reputation: 53

CXF web service with multiple parameters

I'm developing a web service using Camel and CXF and use "code first" approach. Everything works fine for methods having a single parameter. Methods with multiple parameters however receive only the first param, others resolve to nulls. No exception is thrown.

Here is my route:

<route>
  <from uri="cxf:bean:serverEndPoint" />
  <log message=">>> data is : ${body}"/>
  <choice>
    <when>
      <simple>${in.header.operationName} == 'doSomething'</simple>
      <to uri="bean:TestWSBean?method=doSomething"/>
    </when>
    ...
</route>

Server endpoint is defined as follows:

<cxf:cxfEndpoint id="serverEndPoint"
               address="http://localhost:9000/casServer/"
               serviceClass="com.test.iface.TestWebService">
  <cxf:inInterceptors>
      <ref bean="loggingInInterceptor"/>
  </cxf:inInterceptors>                   
  <cxf:outInterceptors>
      <ref bean="loggingOutInterceptor"/>
  </cxf:outInterceptors>                   
</cxf:cxfEndpoint>

And the implementation bean itself:

@WebService
public interface TestWebService {
  public String doSomething(String one, String two);
}

My question is pretty basic, what should be done to be able to send multiple parameters?

Upvotes: 3

Views: 2599

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19626

I think you will need to use the requestwrappper annotation. Take a look at code generated by the wsdl_first example in cxf. It generates the annotations and a suitable wrapper class.

@RequestWrapper(localName = "updateCustomer", targetNamespace = "http://customerservice.example.com/", className = "com.example.customerservice.UpdateCustomer")

Upvotes: 2

Related Questions