M_McDonald
16 years agoSuper Contributor
Rewriting request in Mock Service OnRequest script
Hi -
I have the following code in the OnRequest script of a Mock Service to change the request to SOAP:
Logging indicates that the requestContent has been changed, but I still get a SOAP missing Envelope error like this:
What am I doing wrong?
I have the following code in the OnRequest script of a Mock Service to change the request to SOAP:
def req = mockRequest
def content = req.getRequestContent()
log.info "onRequest request content = " + content
def xml = '''<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:soap1="http://soapui.sterling.com">
<soap:Header/>
<soap:Body>
<soap1:dummyRequest>''' + content + '''</soap1:dummyRequest>
</soap:Body>
</soap:Envelope>'''
req.setRequestContent(xml)
log.info req.requestContent
Logging indicates that the requestContent has been changed, but I still get a SOAP missing Envelope error like this:
Server
org.apache.xmlbeans.XmlException: Missing/Invalid SOAP Envelope, expecting [{http://schemas.xmlsoap.org/soap/envelope/}Envelope]
What am I doing wrong?