骆驼 CXF 组件:使用 Json 字符串主体调用 ws



我无法与Camel CXF组件相处。问题是,我要调用的 WS 操作只有一个字符串参数,它是一个 JSON 表达式。

但是,对于每个数据格式(MESSAGE,POJO,PAYLOAD),它都会给出例外。

有一些类是由cxf本身从wsdl2java生成的,我正在使用它们来调用ws。

<cxf:cxfEndpoint id="wsEndpoint" address="http://www.wssss.com" serviceClass="aa.bb.cc.WebService" serviceName="sendMessage">
    <cxf:properties>
         <entry key="dataFormat" value="CXF_MESSAGE"/>
        <entry key="defaultOperationName" value="sendMessage"/>
        <entry key="relayHeaders" value="false"/>
        <entry key="wrapped" value="true"/>
        <entry key="loggingFeatureEnabled" value="true"/>
        <entry key="synchronous" value="true"/>
        <entry key="defaultOperationNamespace" value="http://com.asdad.ns"/>
    </cxf:properties>
</cxf:cxfEndpoint>

我正在将其用于:

camel:to uri="cxf:bean:wsEndpoint"/>

生成的服务类为:

@WebResult(name = "response", targetNamespace = "")
@RequestWrapper(localName = "sendMessage", targetNamespace = "http://com.xxx.comet.ws.notification", className = "aaa.bbb.ccc.SendMessage")
@WebMethod
@ResponseWrapper(localName = "sendMessageResponse", targetNamespace = "http://com.xxx.comet.ws.notification", className = "aaa.bbb.ccc.SendMessageResponse")
public java.lang.String sendMessage(
    @WebParam(name = "request", targetNamespace = "")
    java.lang.String request
);

任何帮助将不胜感激

谢谢

编辑:问题是,exchange.in 正文无法与服务方法的参数绑定,因此请求为空。这里有问题

INFO: Outbound Message
---------------------------
ID: 1
Address: http://www.wssss.com
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], breadcrumbId=[ID-TT08328507-61662-1416561287466-0-1], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/><soap:Body/></soap:Envelope>
--------------------------------------
Nov 21, 2014 4:45:04 AM org.apache.cxf.services.sendMessage.MessagePort.Message
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 500
Encoding: UTF-8
Content-Type: text/xml;charset=UTF-8
Headers: {connection=[close], Content-Length=[271], content-type=[text/xml;charset=UTF-8], Date=[Fri, 21 Nov 2014 09:15:04 GMT], Server=[Apache-Coyote/1.1]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>No binding operation info while invoking unknown method with params unknown.</faultstring></soap:Fault></soap:Body></soap:Envelope>
--------------------------------------
org.apache.cxf.binding.soap.SoapFault: No binding operation info while invoking unknown method with params unknown.
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40)

outbind 消息是一个空的 SOAP 信封。

Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/><soap:Body/></soap:Envelope> 

是否正确设置了调用参数?

相关内容

最新更新