Forum Discussion

mBlox__Inc__Sup's avatar
mBlox__Inc__Sup
New Contributor
14 years ago

[Resolved] Problems with MockService AfterRequest script

Hi,

I do have a basic MockService, generated directly on import of the WSDL.

When i run it, and send a request to it, it works fine.
As soon as i add the below code to the AfterRequest Script, A java exception is thrown and the return response to the requestor is a HTTP 500 error.

the code is:

log.info mockRequest.requestContent
//def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent)

//def transactionid = (String)( holder["//transactionId"])
//def transactionStatus = (String) (holder["//statusCode"])
//def transactiondescription = (String) (holder["//statusDesc"])
//def date = (String) new Date()
//file = new File("receivedLog.txt")
//file.write(date + "," + transactionid + "," + mockRequest.getSoapAction() + "," + transactionStatus + "," + transactiondescription + "\n")
//log.info (date + "," + transactionid + "," + mockRequest.getSoapAction() + "," + transactionStatus + "," + transactiondescription + "\n")


Even with all of it commented out (other than the log.info) it throws the error which looks like this:

HTTP/1.1 500 Internal Server Error
Server: Jetty(6.1.x)



note that the content shows up as some binary string, rather than the xml that i was expecting.

Am i doing something stupid wrong? or is this a bug of some sort.
To be complete, soapUI 4.0.0 and 3.6.1 both show this behavior.

Any help would be appreciated.

cheers,

m
  • Sorry, this was me having had a long day........

    I was using the MockRequest variable that only exists for the "OnRequest" script rather than the "afterRequest" script.

    Sorry if i confused anyone.