1
votes

I'm trying to configure a flow in mule studio using the Web Services Connector. The SOAP body the endpoint is expecting looks like:

<soapenv:Body>
  <v4:readFields>
     <filter>
        <type>?</type>
        <id>?</id>
        <name>
           <operator>?</operator>
           <value>?</value>
        </name>
     </filter>
     <pageNumber>?</pageNumber>
  </v4:readFields>
</soapenv:Body>

The <filter> node itself is required, but the contents are optional, so I'd like to get my flow to send a body like:

<soapenv:Body>
  <v4:readFields>
     <filter />
     <pageNumber>1</pageNumber>
  </v4:readFields>
</soapenv:Body>

Is there a way to set up the message payload to send this request?

Running Anypoint Studio 5.1.0, Mule ESB 3.6.
My current flow config:

<flow name="GetFieldInfo">
    <http:listener config-ref="localhost" path="/fields" doc:name="HTTP"/>
    <enricher source="#[payload]" target="#[flowVars.sessionId]" doc:name="GetSessionId">
        <flow-ref name="GetSessionId" doc:name="Login"/>
    </enricher>
    <data-mapper:transform config-ref="Xml_loginResponse__To_Xml_sessionHeader_" input-ref="#[flowVars[&quot;sessionId&quot;]]" target="#[message.outboundProperties[&quot;soap.sessionHeader&quot;]]" doc:name="Set Session Header"/>
    <ws:consumer config-ref="BrontoAPI" operation="readFields" doc:name="Web Service Consumer"/>
    <echo-component doc:name="Echo"/>
</flow>
1
Mule version ? Flow config ?David Dossot
Added version and current config to question.Johrn
Thanks! It's really hard to know what's going on here, especially without seeing what's the message payload right when execution hits ws:consumer. What does Mule send currently? A filter element with empty child elements?David Dossot
With that config it breaks because the payload is null. (the enricher and datamapper in the flow are only touching the soap header, not the message payload). If I use a variable->datamapper to set pageNumber in the soap body, it will break with "unable to verify parameter filter". The debugger just displays my payloads as byte arrays, so I have no idea what is actually going on.Johrn
What does nullify the payload? If you add a logger before the ws:consumer does it log the payload as null?David Dossot

1 Answers

0
votes

you can make use of mule parse template to send static xml with variable data

sample :

<soapenv:Body>
 <v4:readFields>
 <filter />
 <pageNumber>#[payload]</pageNumber>
 </v4:readFields>
</soapenv:Body>

you can find the documentation here https://developer.mulesoft.com/docs/display/current/Parse+Template+Reference