cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Unable to access content of REST MockService mockRequest

Highlighted
Occasional Contributor

Re: Unable to access content of REST MockService mockRequest

Hi, 

 

Currently I am using SoapUI Pro 5.1.2, full licensed. 

 

def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody

 

I still get null response when I do PUT operation on the server.

 

Please let me know what is the problem.. 

10 REPLIES 10
Highlighted
Community Hero

Re: Unable to access content of REST MockService mockRequest

Have you started the mock service?
Have you send the request?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Unable to access content of REST MockService mockRequest

Yes, Mock is started and Request is sent from Postman

Highlighted
Community Hero

Re: Unable to access content of REST MockService mockRequest

Ok, strange.

May be you take a look the sample rest project with mock service below, have a look at it to see if that helps.

https://github.com/nmrao/sample-soapui-projects/tree/master/rest_sample


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Unable to access content of REST MockService mockRequest

Hi,

 

I think question is misunderstood. The example which is attached in Github is very basic GET request, which works for me. But the problem is I need to read the PUT request content in my mock. PUT request from my SUT can send either pass or fail status in metadata parameter to my mock. So, in mock I am try to read the PUT request content on PUT action using 

 

def requestBody = mockRequest.getRequestContent() 
log.info "Request body: " + requestBody

 

On sending PUT request from Postman, I am getting "null" output. So, I want to understand whether is there any wrong in my procedure.

 

Thanks in advance.

Highlighted
Community Hero

Re: Unable to access content of REST MockService mockRequest

@kjdivya,

 

Sorry did not get you.

 

Where are you getting null? 

Is response in Postman null? or In the Mock service Script Dispatcher?



Regards,
Rao.
Highlighted
Occasional Contributor

Re: Unable to access content of REST MockService mockRequest

 In the Mock service Script Dispatcher I am getting null.

 

def requestBody = mockRequest.getRequestContent() 
log.info "Request body: " + requestBody

 

The output of above line is null, i.e. "Request body: null"

Highlighted
Occasional Contributor

Re: Unable to access content of REST MockService mockRequest

As per the blog it is bug. So we can stop discussing on this topic

https://community.smartbear.com/t5/SoapUI-Pro/Mock-Service-mockRequest-requestContent-is-NULL-HTTP-P...

 

Highlighted
Contributor

Re: Unable to access content of REST MockService mockRequest

This is some help? really? 

 

Highlighted
Contributor

Re: Unable to access content of REST MockService mockRequest

Ahhh.. so is a bug.. = means, nobody will fix it.. as usual..

 

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors