Forum Discussion

latitude360's avatar
latitude360
New Contributor
15 years ago

Calling WebService from MockResponses Tab

Hi,

I have a Mock service that has a getKey Method. I want to check a tag value in the incoming request and based on the value I want to call another webservice(the real backend) or give a static response. I have not used Groovy much and I might be going about it in a totally wrong way. Need some help to point me in the right direction. Here is the code I wrote in Mock Method Script that did not work and gave an exception "Script1.groovy: 1: unable to resolve class groovy.net.soap.SoapClient @ line 1, column 1. import groovy.net.soap.SoapClient" when I called the method

import groovy.net.soap.SoapClient
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
def proxy = new SoapClient(mockService.getPropertyValue( "cogUrl" ))

def arg1 = holder["//RepLoginCode"]

if(!com.eviware.soapui.support.StringUtils.hasContent( arg1 ))
return (proxy.getKey(mockRequest.requestContent))

return "NewResponse"

Thanks
No RepliesBe the first to reply