0
votes

I want to consume a web service via SOAP and I have read all documents about "consuming webservice" found at Mule website. I'm using this webservice for a test: http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx

Here is my question.

If I use WebServiceConsumer with DataMapper, it sends

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <ns0:getMobileCodeInfo xmlns:ns0="http://WebXml.com.cn/">
        <ns0:mobileCode>13683646566</ns0:mobileCode>
        <ns0:userID/>
    </ns0:getMobileCodeInfo>
</soap:Body></soap:Envelope>

and works perfectly. But the point is that the DataMapper is not supported by Community Editon; so I use JAX-client instead. My flow is

<sub-flow name="SOAP_test_Flow">
    <set-payload value="#[{'13683646566',''}]" doc:name="Set Payload"/>
    <cxf:jaxws-client operation="getMobileCodeInfo" clientClass="mobile.MobileCodeWS" port="MobileCodeWSSoap" wsdlLocation="classpath:/wsdl/MobileCodeWS.asmx.wsdl" doc:name="CXF"/>
    <outbound-endpoint address="http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo" encoding="UTF-8" mimeType="text/xml" doc:name="Generic"/>
</sub-flow>

where package mobile is generated by /wsdl/MobileCodeWS.asmx.wsdl. I'm pretty sure my flow is OK, and I have tested that this sub-flow sends

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <getMobileCodeInfo xmlns="http://WebXml.com.cn/">
        <mobileCode>13683646566</mobileCode>
        <userID></userID>
    </getMobileCodeInfo>
</soap:Body>
</soap:Envelope>

to aim address. But it returns

请求格式无效: text/xml; charset=UTF-8。

which means "Request format invalid: text/xml; charset=UTF-8."

The wsdl file is here:http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl

1

1 Answers

0
votes

BE CAREFUL WITH THE URL THAT YOU SEND !!!

<sub-flow name="SOAP_test_Flow">
<set-payload value="#[{'13683646566',''}]" doc:name="Set Payload"/>
<cxf:jaxws-client operation="getMobileCodeInfo" clientClass="mobile.MobileCodeWS" port="MobileCodeWSSoap" wsdlLocation="classpath:/wsdl/MobileCodeWS.asmx.wsdl" doc:name="CXF"/>
<outbound-endpoint address="http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo" encoding="UTF-8" mimeType="text/xml" doc:name="Generic"/>

THE ADDRESS SHOULD BE

http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx

HAVE FUN !!!