how to change target server?

Not applicable

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 Solved
0 4 605
1 ACCEPTED 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.

  1. JS snippet which you have added above is not correct. Use the below updated.
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.

View solution in original post

4 REPLIES 4

Not applicable

@Madhav

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"}}}

@Madhav

It seems you are not passing the correct request content.

Kindly go through the below url to set the request message

Servicecallout.

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.

  1. JS snippet which you have added above is not correct. Use the below updated.
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.