unable to get JSON data in body of the the output.

I want to to send data in the body of the mock target: "http://mocktarget.apigee.net/echo"

Output Expectations:

{ "headers":

{ "host": "mocktarget.apigee.net", "content-length": "0", "x-cloud-trace-context": "2104d7c11d8ef007e59b1eebef8558ef/9313860983379595168", "via": "1.1 google", "x-forwarded-for": "18.221.93.76, 35.227.194.212", "x-forwarded-proto": "http", "connection": "Keep-Alive" },

"method": "POST",

"url": "/",

"body": { "firstName": "John", "lastName": "Doe", "city": "San Jose", "state": "CA" } }

I have added service callout policy having the url ("http://mocktarget.apigee.net/echo") and the assign message which shows the content of the Mock target {calloutResponse.content}. I am sending data (which has to be shown in Body) in the "body" of "Postman".

Content-Type is "application/json".

Data of body is still not showing in the output. See attachment for more details.

Solved Solved
0 4 370
1 ACCEPTED SOLUTION

sidd-harth
Participant V

I am not sure why you are using Service Callout & Assign Message policies. We can directly invoke this Mock Target as an HTTPTargetConnection on TargetEndpoint.

PFA Proxy. Import in your org, deploy and make a call to /echo endpoint with a body in postman.

mock-rev1-2018-10-29.zip

View solution in original post

4 REPLIES 4

sidd-harth
Participant V

I am not sure why you are using Service Callout & Assign Message policies. We can directly invoke this Mock Target as an HTTPTargetConnection on TargetEndpoint.

PFA Proxy. Import in your org, deploy and make a call to /echo endpoint with a body in postman.

mock-rev1-2018-10-29.zip

I am doing it via POST, not GET. Siddharth, It will be good if you tell me whether I am going wrong!!

The attached proxy is using POST method.

Provide your proxy zip.

I got it. Thank you Siddharth for the help