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! Go to Solution.
It seems the service callout is doing the same as your target invocation. Ie: invoking
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!