Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unresolved Variable in JSON

Not applicable
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="AddCustomerRSS">
    <DisplayName>AddCustomerRSS</DisplayName>
    <Properties/>
    <Request clearPayload="true" variable="addCustomerRSS">
        <Set>
            <Headers>
                <Header name="Content-Type">application/json</Header>
            </Headers>
            <Verb>POST</Verb>
            <Payload contentType="application/json">
                 {"PortId":"SEARSCA", "Folder":"Receive","Filename":"test.xml","Content":"base64blob"}
            </Payload>
        </Set>
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    </Request>
    <Response>calloutResponse</Response>
    <HTTPTargetConnection>
        <Properties/>
        <URL>HIDDEN_FOR_SECURITY</URL>
    </HTTPTargetConnection>
</ServiceCallout>

I have a really strange error occurring in a service callout policy. The code is above.

When the flow reaches this policy it returns an error:
{
  "fault": {
    "faultstring": "Unresolved variable : \"PortId\"",
    "detail": {
      "errorcode": "messaging.runtime.UnresolvedVariable"
    }
  }
}
I have verified using a json verifier that it is a valid json. Strangely though, if I copy this exact policy into another api proxy in a different account it works. If I copy it into another api proxy but on the same account I get the same error. It only seems to work on that account (or maybe only that specific api proxy on that specific account).
Any suggestions on how we might fix this?
Thank you,
Aleks
Solved Solved
0 7 4,461
1 ACCEPTED SOLUTION

adas
New Member

@aleks1 This is a bug in Apigee Edge. For now you can do this:

<Payload contentType="application/json">
                 \{"PortId":"SEARSCA", "Folder":"Receive","Filename":"test.xml","Content":"base64blob"}
</Payload>

This is escape the curly brace and not try and resolve the PortId as a variable. There is a fix that we are going to deploy in few days. For now just go with this workaround, you might have to change this later to remove the "\" escapte character.

View solution in original post

7 REPLIES 7