[英]Adding soap:encodingStyle attribute to soap:body while using cxf:jaxws-client
我正在从m子流中访问rpc /文字样式的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>
然后我通过cxf:jaxws-client将ExpectedObject传递到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属性?
我可以看到它不起作用。 可能是您可以尝试使用XSLT转换器将编码样式添加到输入中,然后对其进行处理。 这只是解决方法。
我认为您的问题是encodingStyle属性信息不能出现在body元素中,而只能出现在子元素中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.