Siemens__s_r_o_
11 years agoOccasional Contributor
[Resolved] Retrieveing request content from MockService
Hello SmartBear,
We are trying to log all requests incoming to our MockService.
I took this code:
From your website (http://www.soapui.org/Service-Mocking/c ... vices.html) and modified it to:
This is used as OnRequest Script on the Mockservice.
Our incoming request looks something like this:
I would expect that "someString" appears in the log, unfortunately, I get this:
I suspect this is an issue with namespaces in the request, but I was unable to to resolve it
Any suggestions?
Thanks a lot,
Jakub
We are trying to log all requests incoming to our MockService.
I took this code:
// create XmlHolder for request content
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
// get target testcase
def project = mockResponse.mockOperation.mockService.project
def testCase = project.testSuites["TestSuite 1"].testCases["TestCase 1"]
// set arguments as properties
testCase.setPropertyValue( "arg1", holder["//arg1"] )
testCase.setPropertyValue( "arg2", holder["//arg2"] )
From your website (http://www.soapui.org/Service-Mocking/c ... vices.html) and modified it to:
import com.eviware.soapui.support.XmlHolder;
XmlHolder requestContent = new XmlHolder(mockRequest.requestContent);
log.info(requestContent[//"arg1"]);
This is used as OnRequest Script on the Mockservice.
Our incoming request looks something like this:
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Header/>
<env:Body>
<Message xmlns="http://www.iec.ch/TC57/2008/schema/message">
<Header>
<Verb>CREATE</Verb>
<Noun>EndDeviceAssets</Noun>
<MessageID>507-MeterAdd-1372758778123</MessageID>
</Header>
<Payload>
<EndDeviceAssets:EndDeviceAssets xmlns:EndDeviceAssets="http://iec.ch/TC57/2009/EndDeviceAssets#" xmlns="http://iec.ch/TC57/2009/EndDeviceAssets#">
<EndDeviceAsset>
<arg>someString</arg>
</EndDeviceAsset>
</EndDeviceAssets:EndDeviceAssets>
</Payload>
</Message>
</env:Body>
</env:Envelope>
I would expect that "someString" appears in the log, unfortunately, I get this:
Wed Dec 11 17:44:28 CET 2013:INFO:[Ljava.lang.String;@8b2e94
I suspect this is an issue with namespaces in the request, but I was unable to to resolve it
Any suggestions?
Thanks a lot,
Jakub