I am Studying how to create and manage apis with Apigee. While implementing service callout policy, it gives me error "Server Error. org.apache.xerces.dom.ElementNSImpl cannot be cast to com.apigee.messaging.config.beans.TargetConnection". So can't save revision...what to do?
Answer by Michael Malloy
·
Feb 03, 2015 at 04:42 PM
There is likely some problem with the configuration of your Service Callout policy that is causing it to not save. Here is an example of a Service Callout from the course that worked. Possibly you can find some difference and resolve it in your proxy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ServiceCallout async="false" continueOnError="false" enabled="true" name="Service-Callout-1"> <DisplayName>Service Callout 1</DisplayName> <FaultRules/> <Properties/> <Request clearPayload="true" variable="myRequest"> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <Set> <Verb>GET</Verb> <QueryParams> <QueryParam name="ql">select * where jokeid = {request.queryparam.jokeid}</QueryParam> </QueryParams> </Set> </Request> <Response>commentResponse</Response> <HTTPTargetConnection> <Properties/> <URL>https://api.usergrid.com/mike.malloy/sandbox/jokecomments</URL> </HTTPTargetConnection> </ServiceCallout>
That's the code for a ServiceCallout, for sure . I suspect that you also have some ServiceCallout things in the TargetEndpoint. In other words, maybe the code is correct, but it's in the wrong place.
Answer by sgopalam@apigee.com · Dec 09, 2015 at 06:41 PM
I have faced similar issues in the past. The culprit always has been some hidden special character in the policy, this generally happens when you copy past code from the browser and past it in directly in the UI editor. To work around this I had to delete the policy and create the same policy fresh and put the code in it again. Hope this helps..