Cannot save revision, using ServiceCallout policy

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?

Solved Solved
0 6 2,053
1 ACCEPTED SOLUTION

Not applicable

Sonali, it is very difficult to see visually, but I believe your target URL has a space in it. A well formed URL is required and the exception you are seeing is raised when the validation fails.

I think it is right before the s after the host.

View solution in original post

6 REPLIES 6

Not applicable

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>

Thanks for reply..This is my code. Its same I guess...but still there is error.

89-code.jpg

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.

Not applicable

Sonali, it is very difficult to see visually, but I believe your target URL has a space in it. A well formed URL is required and the exception you are seeing is raised when the validation fails.

I think it is right before the s after the host.

Hey thanx for reply. Actually I validate my all XML code on proxy but cant trace out the error. So I guess its time to REWORK n I have started it..:)

sgopalam
Participant I

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..