Reputation: 31
I want to know how to get a request parameter from a soap endpoint. More specifically I have an endpoint based on http-listener and I call this endpoint through a soap client and I want to get a value sent in the body of this soap request. Here are the technically specifications..
I'm using mule 3.8 and Anypoint Studio 6.1.2
This is a part of my scenery Here is a part of my mule xml:
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081"
doc:name="HTTP Listener Configuration"/>
<cxf:configuration name="CXF_Configuration" enableMuleSoapHeaders="true" initializeStaticBusInstance="true"
doc:name="CXF Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" service="KarmaService" port="KarmaPort"
serviceAddress="http://localhost:8080/TestingWS/Karma" wsdlLocation="http://localhost:8080/TestingWS/Karma?wsdl" doc:name="Web Service Consumer"/>
<flow name="pichondemonoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<cxf:proxy-service configuration-ref="CXF_Configuration" payload="body" doc:name="CXF"/>
<set-variable variableName="pichonVar" value="#[message.inboundProperties.'http.query.params'.arg0]"
doc:name="Variable"/>
<choice doc:name="Choice">
.
.
.
.
And here is the request from a SoapUI Client:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sup="http://support.cxf.module.mule.org/">
<soapenv:Header/>
<soapenv:Body>
<sup:invoke>
<!--Optional:-->
<sup:arg0>Some value</sup:arg0>
</sup:invoke>
</soapenv:Body>
</soapenv:Envelope>
Also I read something about xpath3 but I don't know if this is the best way to parse my xml request. What is the best way?
Hope this can be understanded.
I appreciate if someone can help me. Thanks in advance!
Upvotes: 1
Views: 974
Reputation: 175
I am dealing with the same scenario. Use Xpath to parse the Soap Xml and Set in a variable using SetVariable or if you want to parse multiple params use message properties to set so that you flow will not be filled up with sequence of Variables. Cheers!
Upvotes: 0
Reputation: 1
I am not exactly sure what you mean by "I want to get a value sent in the body of this soap request". Based on the statement, I assume you want to insert a value into the SOAP request. You can try dataweave as stated above.
Also, xpath is something that is used for navigating and retrieving values from the XML. But not inserting value.
Upvotes: 0
Reputation: 43
One way is to use the transform message component:
<dw:transform-message metadata:id="234ee930-89d2-45ef-b888-96e940446fbe" doc:name="Transform Message">
<dw:input-payload doc:sample="C:\Users\willekr\Desktop\sample.xml"/>
<dw:set-payload><![CDATA[
%dw 1.0%output application/java
%namespace sup http://support.cxf.module.mule.org/
%namespace soapenv http://schemas.xmlsoap.org/soap/envelope/
---
payload.soapenv#Envelope.soapenv#Body.sup#invoke.sup#arg0
]]>
</dw:set-payload>
</dw:transform-message>
Upvotes: 0