[英]CXF web service with multiple parameters
I'm developing a web service using Camel and CXF and use "code first" approach. 我正在使用Camel和CXF开发Web服务并使用“代码优先”方法。 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: 而实现bean本身:
@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? 我的问题非常基本,能够发送多个参数应该怎么做?
I think you will need to use the requestwrappper annotation. 我想你需要使用requestwrappper注释。 Take a look at code generated by the wsdl_first example in cxf.
看一下cxf中wsdl_first示例生成的代码。 It generates the annotations and a suitable wrapper class.
它生成注释和合适的包装类。
@RequestWrapper(localName = "updateCustomer", targetNamespace = "http://customerservice.example.com/", className = "com.example.customerservice.UpdateCustomer") @RequestWrapper(localName =“updateCustomer”,targetNamespace =“http://customerservice.example.com/”,className =“com.example.customerservice.UpdateCustomer”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.