I have a Mock Service running in SOAPUI and I want to get the message inside the SOAP Body for the Request and write it out to a file.
I have tried many methods but just can't seem to get the SOAP Body. I can get the Request which is the SOAP Envelope but get stuck here.
I am writing some groovy script in the OnRequest Script for the Mock Service, not sure if this is the right place.
Any help would be most appreciated.
Rich
Yes, I want the XML Payload (ApplicationOutcomeUpdate) in the SOAP Body...
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
<s:Body>
<ns0:ApplicationOutcomeUpdate xmlns:ns0="http://CompanyA/v1">....
...and I have a MockService which accepts this Request from an Application and I want to save the XML Payload inside the SOAP Body to a file.
I have got the Request using...
def request = new XmlParser().parseText(mockRequest.requestContent)
I then try and use XmlHolder, XmlSlurper or XmlParser to extract the Xml I need inside the SOAP Body but all I seem to get is Null.
Regards
Stewart
Richie
Apologies for the delay.
What I want to get is the Request which contains the Soap Envelope inside is the Soap Body and inside this is the payload message Its the payload message inside the Soap Body I want to save off to a file.
I have tried the following...
def req = new XmlHolder(messageExchange.requestContent)
def req = new XmlHolder(mockRequest.requestContent)
def req = new XmlHolder(context.request)
def req = new XmlSlurper(messageExchange.requestContent)
def req = new XmlSlurper(mockRequest.requestContent)
def req = new XmlSlurper(context.request)
...but I get either an error or null returned.
Richie
OK, an update.
I have been able to get hold of the Request i.e. the SOAP Envelope using the following...
def request = mockRequest.getRequestContent()
Now I need to extract the payload inside the SOAP Body. That's what I need help on now.
I can confirm I want the Payload inside the SOAP Body for the Request. I have a application that sends the Request to the Mock Service and as part of my Unit Testing I want to compare the Payload with my expected results.
Rich
Yes I am still wanting to extract the Payload from the SOAP Body.
Appreciate if you could provide the groovy code.
Regards
Subject | Author | Latest Post |
---|---|---|