我正在从我的 mule 流中访问 rpc/literal 样式的 web 服务。
wsdl 的绑定部分如下所示:
<binding name="AppWebServiceBinding" type="interface:AppWebService">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="submitApplication">
<soap:operation soapAction="" style="rpc" />
<input name="submitApplicationRequest" >
<soap:body
encodingStyle="http://xml.apache.org/xml-soap/literalxml"
namespace="http://tempuri.org/fsg.ejb.webservice.AppWebService"
parts="ele" use="literal" type="soap:tBody" />
</input>
<output name="submitApplicationResponse">
<soap:body
encodingStyle="http://xml.apache.org/xml-soap/literalxml"
namespace="http://tempuri.org/fsg.ejb.webservice.AppWebService" use="literal"/>
</output>
</operation>
</binding>
然后我将 expectedobject 传递给带有 cxf:jaxws-client 的 http:outbound
<http:outbound-endpoint exchange-pattern="request-response"
address="http://serviceapp:9080/service_war/servlet/rpcrouter"
doc:name="Generic">
<cxf:jaxws-client clientClass="com.fsg.generated.AppWebServiceService"
wsdlLocation="com/fsg/generated/AppWebServiceService.wsdl"
operation="submitApplication" port="AppWebServicePort"
doc:name="SOAP">
<cxf:inInterceptors >
<spring:bean id="inLogger"
class="org.apache.cxf.interceptor.LoggingInInterceptor" />
</cxf:inInterceptors>
<cxf:outInterceptors>
<spring:bean id="outLogger"
class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
</cxf:outInterceptors>
</cxf:jaxws-client>
</http:outbound-endpoint>
但是,当我查看日志以查看发送到出站的消息时,我看不到其中的 soap:encodingStyle 属性。这导致了问题,因为没有此服务无法处理消息。
下面给出的是我可以在日志中看到的出站消息。
Outbound Message
---------------------------
ID: 1
Address: http://serviceapp:9080/service_war/servlet/rpcrouter
Encoding: UTF-8
Content-Type: text/xml
Headers: {SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header>
<mule:header xmlns:mule="http://www.muleumo.org/providers/soap/1.0">
<mule:MULE_CORRELATION_ID>dfd31e6c-6575-11e2-9b8a-b1b06bd39882</mule:MULE_CORRELATION_ID> <mule:MULE_CORRELATION_GROUP_SIZE>-1</mule:MULE_CORRELATION_GROUP_SIZE>
<mule:MULE_CORRELATION_SEQUENCE>-1</mule:MULE_CORRELATION_SEQUENCE>
</mule:header>
</soap:Header>
<soap:Body>
<ns1:submitApplication xmlns:ns1="http://tempuri.org/fsg.ejb.webservice.AppWebService">
<ele>
<MyApp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mysample.org">
<UserAuth> ............
可以看出,命名空间是从 wsdl 中选择的,而不是从 encodingStyle 中选择的。
预期输出为
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header>
<mule:header xmlns:mule="http://www.muleumo.org/providers/soap/1.0">
.......
</mule:header>
</soap:Header>
<soap:Body>
<ns1:submitApplication xmlns:ns1="http://tempuri.org/fsg.ejb.webservice.AppWebService" soap:encodingStyle="http://xml.apache.org/xml-soap/literalxml" >
<ele>
<MyApp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mysample.org">
<UserAuth> ............
如何在其中设置soap:encodingStyle 属性?