Forum Discussion

bartporz's avatar
13 years ago

mockRequest is NULL

Hi,

I have a problem with mockRequest object. It suddenly stopped working, throwing NullPointerException.
I'm using a script to switch between responses:

def request = new XmlSlurper().parseText(mockRequest.requestContent)
def username = request.Body.LoginCustomer2.username


It was working fine and suddenly it stopped. The only answer on Google I found was suggesting the above code.

Error message:
com.eviware.soapui.impl.wsdl.mock.DispatchException: Failed to dispatch using script; java.lang.NullPointerException: Cannot get property 'requestContent' on null object


Any ideas what could happen and how can I fix this?

Thanks,
Bart

[EDIT] it happens on soapUI 4.0.0, soapUI 4.0.1 and soapUI 4.5.
  • hi,

     

    were you able to get the answer for this ? Can you share the output ?

    • rupert_anderson's avatar
      rupert_anderson
      Valued Contributor

      Hi,

       

      I believe a null mockRequest could have been an actual bug in those versions (4.x) of SoapUI, I think it was fixed beyond version 5.

       

      certainly in the latest versions of SoapUI mockRequest is fine - please see example post

       

      Regards,

      Rupert

      • bkbn16's avatar
        bkbn16
        Contributor

        I am using 5.1.2 and I still get the error