Finan
14 years agoFrequent Contributor
Using the XMLHolder class for service out to service in
Hi,
I'm trying to use the XMLHolder class to modify a response received from a service and use that response as an input for a follow-up service call. Basically my setup is:
- Request soap message from server
- Modify soap message with groovy
- Send modified soap message to server
Now our setup has the following structure in service definitions:
Received message:
<soapenv:Envelope>
<soapenv:Header />
<soapenv:Body>
<responseMethodName>
<responseData />
</responseMethodName>
</soapenv:Body>
</soapenv:Envelope>
Sent message:
<soapenv:Envelope>
<soapenv:Header />
<soapenv:Body>
<sendMethodName>
<adjustedResponseData />
</sendMethodName>
</soapenv:Body>
</soapenv:Envelope>
How can I make it so that using the XMLHolder I change the name of the element <responseMethodName> to <sendMethodName> and reuse all the other data in the response message?
For now all I can think of is to use a regular expression string replace on the adjusted responseData. But what I'd rather do is to only cut out the <adjustedResponseData> element and it's contents and inject that data into the <sendMethodName> element using the XMLHolder class.
Can someone provide me a suggestion on how this can be resolved best?
I'm trying to use the XMLHolder class to modify a response received from a service and use that response as an input for a follow-up service call. Basically my setup is:
- Request soap message from server
- Modify soap message with groovy
- Send modified soap message to server
Now our setup has the following structure in service definitions:
Received message:
<soapenv:Envelope>
<soapenv:Header />
<soapenv:Body>
<responseMethodName>
<responseData />
</responseMethodName>
</soapenv:Body>
</soapenv:Envelope>
Sent message:
<soapenv:Envelope>
<soapenv:Header />
<soapenv:Body>
<sendMethodName>
<adjustedResponseData />
</sendMethodName>
</soapenv:Body>
</soapenv:Envelope>
How can I make it so that using the XMLHolder I change the name of the element <responseMethodName> to <sendMethodName> and reuse all the other data in the response message?
For now all I can think of is to use a regular expression string replace on the adjusted responseData. But what I'd rather do is to only cut out the <adjustedResponseData> element and it's contents and inject that data into the <sendMethodName> element using the XMLHolder class.
Can someone provide me a suggestion on how this can be resolved best?