Ask a Question

Re: Unable to access content of REST MockService mockRequest

kjdivya
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
nmrao
Champion Level 3

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


Regards,
Rao.
kjdivya
Occasional Contributor

Yes, Mock is started and Request is sent from Postman

nmrao
Champion Level 3

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.
kjdivya
Occasional Contributor

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.

nmrao
Champion Level 3

@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.
kjdivya
Occasional Contributor

 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"

kjdivya
Occasional Contributor

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...

 

This is some help? really? 

 

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

 

cancel
Showing results for 
Search instead for 
Did you mean: