How to use a variables in target request payload

I am using a service-callout to POST a request to a url(snippet below). The variable "queryinfo.code" in the Payload node is not getting replace by its value. How do it fix it?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="CallGoogleTokenurl">
    <DisplayName>CallGoogleTokenurl</DisplayName>
    <Properties/>
    <Request clearPayload="true" variable="myRequest">
        <Set>
            <Headers>
                <Header name="Content-Type">application/x-www-form-urlencoded</Header>
            </Headers>
            <Verb>POST</Verb>
            <Payload>code={queryinfo.code}</Payload>
        </Set>
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    </Request>
    <Response>calloutResponse</Response>
    <HTTPTargetConnection>
        <Properties/>
        <URL>https://accounts.google.com/o/oauth2/token</URL>
    </HTTPTargetConnection>
</ServiceCallout>
Solved Solved
0 3 526
1 ACCEPTED SOLUTION

The above snippet does populate the payload, replacing it's value.

Look for the following variable -

ServiceCallout.request 

It's a better practise to use <FormParams> tag to provide x-www-form-urlencoded values.

 <FormParams>
            <FormParam name="code">{queryinfo.code}</FormParam>
 </FormParams>

View solution in original post

3 REPLIES 3

What is the resulting payload?

The above snippet does populate the payload, replacing it's value.

Look for the following variable -

ServiceCallout.request 

It's a better practise to use <FormParams> tag to provide x-www-form-urlencoded values.

 <FormParams>
            <FormParam name="code">{queryinfo.code}</FormParam>
 </FormParams>