Policy composition - Unresolved variable : geocoderesponse.longitude

Not applicable

It goes like this:

I am new to APIGee and have been learning using the samples given in the cookbook. Trying the Policy composition example (for Geocoding & Elevation API), I am getting the below error when running my proxy

{"fault":{"faultstring":"Unresolved variable : geocoderesponse.longitude","detail":{"errorcode":"messaging.runtime.UnresolvedVariable"}}}

Have verified that the spellings are same in the ParseGeocodingResponse and AssignElevationParameters policies, however, I still get the same error.

Have also tried with removing the prefix, but no luck.

Please let me know where am I going wrong, I have attached the policy files and the flow file

The proxy is available at

http://karankap-test.apigee.net/policy-mashup?country=us&postalcode=08008

Thanks.

Solved Solved
0 7 953
1 ACCEPTED SOLUTION

sarthak
Participant V

Hi @Karan Kapoor Sorry for the late reply.

The error you were seeing earlier was because the call to google was returning no results. I removed the AssigneMessage Policy and modified the service callout policy to look like this :

<ServiceCallout name="ExecuteGeocodingRequest">
    <Request>
        <Set>
            <QueryParams>
                <QueryParam name="address">{request.queryparam.postalcode}</QueryParam>
                <QueryParam name="region">{request.queryparam.country}</QueryParam>
                <QueryParam name="sensor">false</QueryParam>
            </QueryParams>
            <Verb>GET</Verb>
        </Set>
    </Request>
    <Response>GeocodingResponse</Response>
    <HTTPTargetConnection>
        <URL>http://maps.googleapis.com/maps/api/geocode/json</URL>
    </HTTPTargetConnection>
</ServiceCallout>

So it is returning a response and the request is progressing . Looks to me everything else is good.

The issue was with the configuration in the AssignMessage policy.

Let me know if this works. I have also attached my proxy.

View solution in original post

7 REPLIES 7

sarthak
Participant V

Can you please upload the complete proxy ? Just export and upload it. That will make it a lot easier for us to debug.

Attached is the complete proxy (Policy-Mashup_rev1_2015_07_26.zip)

@Karan Kapoor looks like attachment didn't come through. It you run again into the same problem when uploading as a comment, try posting it as an answer.

Were you able to look at the policy files & identify the gap? I need to resolve this quickly

Not applicable

@Birute Awasthi - attaching the policy again, hope it goes through this time.

sarthak
Participant V

Hi @Karan Kapoor Sorry for the late reply.

The error you were seeing earlier was because the call to google was returning no results. I removed the AssigneMessage Policy and modified the service callout policy to look like this :

<ServiceCallout name="ExecuteGeocodingRequest">
    <Request>
        <Set>
            <QueryParams>
                <QueryParam name="address">{request.queryparam.postalcode}</QueryParam>
                <QueryParam name="region">{request.queryparam.country}</QueryParam>
                <QueryParam name="sensor">false</QueryParam>
            </QueryParams>
            <Verb>GET</Verb>
        </Set>
    </Request>
    <Response>GeocodingResponse</Response>
    <HTTPTargetConnection>
        <URL>http://maps.googleapis.com/maps/api/geocode/json</URL>
    </HTTPTargetConnection>
</ServiceCallout>

So it is returning a response and the request is progressing . Looks to me everything else is good.

The issue was with the configuration in the AssignMessage policy.

Let me know if this works. I have also attached my proxy.

Yes, it started working. Am able to get the response now. Thanks. I will accept this answer.

Just a small query, what is the logical difference by removing the AssignMessage policy and setting the request params directly in the service callout policy? Does that impact the subsequent call?