Rasilio
13 years agoNew Contributor
Issue with mockResponse
I'm trying to parrot back a value from the incoming request in the response
The inbound XML looks like this...
On the mock service I have the following code in the On Request Script section...
My mock response looks like this...
And that produces this actual response back...
Why is it that the mockService Properties are getting set to what appears to be a pointer to the variables and not their values? I've ever tried adding String.valueOf in the line where the property value is assigned but that does not help.
The inbound XML looks like this...
<sch:RequestHeader>
<sch:ipaddress>6.6.6.6</sch:ipaddress>
<sch:serverId>zip</sch:serverId>
<sch:sessionId>zap</sch:sessionId>
</sch:RequestHeader>
On the mock service I have the following code in the On Request Script section...
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent );
String sSession = String.valueOf(holder["sessionId"]);
String sServerId = String.valueOf(holder["serverId"]);
String sLoginName = String.valueOf(holder["loginName"]);
mockRunner.mockService.setPropertyValue('SessionId', sSession);
mockRunner.mockService.setPropertyValue('ServerId', sServerId);
mockRunner.mockService.setPropertyValue('IPAddress', sServerIP);
My mock response looks like this...
<ci:AuthenticationResponse>
<ci:sessionId>${#MockService#SessionId}</ci:sessionId>
<ci:serverId>${#MockService#ServerId}</ci:serverId>
<ci:ipaddress>${#MockService#IPAddress}</ci:ipaddress>
</ci:AuthenticationResponse>
And that produces this actual response back...
<ci:AuthenticationResponse>
<ci:sessionId>[Ljava.lang.String;@6942bf69</ci:sessionId>
<ci:serverId>[Ljava.lang.String;@56d27fd6</ci:serverId>
<ci:ipaddress>[Ljava.lang.String;@1d24bc7c</ci:ipaddress>
</ci:AuthenticationResponse>
Why is it that the mockService Properties are getting set to what appears to be a pointer to the variables and not their values? I've ever tried adding String.valueOf in the line where the property value is assigned but that does not help.