I have one proxy End point added Flow in request and In flow using JavaScript to construct Json Request Payload. No target serve/end point define.
like belw
var req = JSON.parse(request.content); var finalRequest = { Payer: req.payerID, UserName:UserNameVal}; request.content = ''; //To clear the request payload request.content = JSON.stringify(finalRequest);
now i want send that constructed request content to the new target server with Verb Post.
Plz help. thanks in advance
Solved! Go to Solution.
@Madhav , Looks like you are using the variable "myRequest" in SC policy which is not defined. Make the below changes in JS and SC policies and try again.
var req = JSON.parse(context.getVariable("request.content")); var finalRequest = { "Payer": req.payerID, "UserName":"UserNameVal"}; //To clear the request payload context.setVariable("request.content", JSON.stringify(finalRequest));
2. Change the request variable name "request" instead of "myRequest" in SC policy.
Hi,What I am able to understand from your requirement is that you want to send the entire request content to the target server with verb post.
As you mentioned that you haven't configured any target endpoint.So please use "Service Callout Policy" where u define your own back endpoint which you want to hit with the payload.
I have added that getting error like below
{"fault":{"faultstring":"ServiceCallout[Service-Callout-1]: request variable myRequest value is not of type Message","detail":{"errorcode":"steps.servicecallout.RequestVariableNotMessageType"}}}
It seems you are not passing the correct request content.
Kindly go through the below url to set the request message
Also could you please provide the policy context if possible.
@Madhav , Looks like you are using the variable "myRequest" in SC policy which is not defined. Make the below changes in JS and SC policies and try again.
var req = JSON.parse(context.getVariable("request.content")); var finalRequest = { "Payer": req.payerID, "UserName":"UserNameVal"}; //To clear the request payload context.setVariable("request.content", JSON.stringify(finalRequest));
2. Change the request variable name "request" instead of "myRequest" in SC policy.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |