Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

service call out gave no response to extract variable policy

Hi all ,

I made a service call out as below .

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ServiceCallout name="ExecuteDistanceRequest"> <Request variable="GeocodingRequest"/> <Response>GeocodingResponse</Response> <HTTPTargetConnection> <URL>https://mxyz</URL> </HTTPTargetConnection> </ServiceCallout>

Now when i use extract variable policy to get the data nothing gets assigned.

used extract policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables name="ParseGeocodingResponse"> <Source>GeocodingResponse</Source> <VariablePrefix>geocoderesponse</VariablePrefix> <JSONPayload> <Variable name="origin_addresses" type="array"> <JSONPath>$.origin_addresses</JSONPath> </Variable> <Variable name="destination_addresses" type="array"> <JSONPath>$.destination_addresses</JSONPath> </Variable> <Variable name="distance"> <JSONPath>$.rows[0].elements[0].distance.text</JSONPath> </Variable> <Variable name="duration"> <JSONPath>$.rows[0].elements[0].duration.text</JSONPath> </Variable> <Variable name="status"> <JSONPath>$.rows[0].elements[0].status</JSONPath> </Variable> </JSONPayload> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> </ExtractVariables>

Please suggest if i am missing anything.

Solved Solved
0 14 329
1 ACCEPTED SOLUTION

deboraelkin
Former Googler

It seems the service callout is doing the same as your target invocation. Ie: invoking

https://maps.googleapis.com/maps/api/distancematrix/json?destinations=New%2BYork%2BCity%2CNY&origins... key}

In the first case, it's not correctly configured, but the target invocation does succeed (because you're passing the proxy request parameters which contain everything needed (destinations, origins, units, key)

If all you want to do is invoke this API once, just remove the service callout and move the ParseGeocodingResponse to the response (Make sure to use response as the source element and not the variable you were using before)

If however you want to do this as a service call out , you'll need to fix the way you're assigning the service callout request. Pay attention to the error returned in the service callout:

ServiceCallout.response { "destination_addresses" : [], "error_message" : "You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account", "origin_addresses" : [], "rows" : [], "status" : "REQUEST_DENIED" }

You're missing the key parameter in the callout request!

View solution in original post

14 REPLIES 14