简体   繁体   English

使用cxf:jaxws-client时将soap:encodingStyle属性添加到soap:body

[英]Adding soap:encodingStyle attribute to soap:body while using cxf:jaxws-client

I am accessing a rpc/literal style webservice from my flow in mule. 我正在从m子流中访问rpc /文字样式的Web服务。

The binding part of the wsdl looks like below : 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>

Then I am passing expectedobject to the http:outbound with cxf:jaxws-client 然后我通过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>

But when I look into the logs to see the message being sent to the outbound I don't see the soap:encodingStyle attribute in that. 但是,当我查看日志以查看将消息发送到出站时,却没有看到soap:encodingStyle属性。 This is causing the problem as the service cannot process the message without this. 这引起了问题,因为如果没有此服务,服务将无法处理消息。

Given below is the outbound message I could see in the log. 下面给出的是我可以在日志中看到的出站消息。

    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>  ............

It can be seen that the namespace is picked from the wsdl but not the encodingStyle. 可以看出,名称空间是从wsdl中选取的,而不是从encodingStyle中选取的。

Expected output is 预期输出为

<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>  ............

How can I set the soap:encodingStyle attribute in this? 如何在其中设置soap:encodingStyle属性?

I could see that it is not working. 我可以看到它不起作用。 May be you could try the XSLT transformer to add the encoding style to the input and then get it processed. 可能是您可以尝试使用XSLT转换器将编码样式添加到输入中,然后对其进行处理。 This is just a work around. 这只是解决方法。

我认为您的问题是encodingStyle属性信息不能出现在body元素中,而只能出现在子元素中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM