Error while access BaaS API from API Management console

Not applicable

API BaaS has been created and was then consumed by simple API Proxy from API Management by selecting the option " Backend Service ".

The API proxy got built without any issues and is even calling the BaaS API and producing the expected output. - Only for the first time.

BUT , whenever I make any change or in fact cut and paste something to the PostFlow under Target Endpoints, its throwing the below error:

Error creating object Failed to import the bundle : com.apigee.repository.RepositoryException: javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 121; The reference to entity "client_secret" must end with the ';' delimiter.].

Below is the content of the PostFlow under Target Endpoints

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <TargetEndpoint name="default"> <Description/> <PreFlow name="PreFlow"> <Request/> <Response/> </PreFlow> <Flows/> <PostFlow name="PostFlow"/> <HTTPTargetConnection> <URL>https://api.usergrid.com/Srinath_Adusumalli/CCBAPI/nrcs/?client_id=b3U6whuc-uTEEeSgexNAM1_VyQ&client_secret=b3U6nnYbePbj2qP_Aia15ir36uYFXGk</URL> </HTTPTargetConnection> </TargetEndpoint>

Is this is a bug in the product or am I doing something wrong?

Regards,

Srinath

1 2 676
2 REPLIES 2

Not applicable

I am also experiencing this error. I think the error is because the XML parser wrongly interprets the '&' in the URL as a XML character. I have not found any solutions to this and I urge Apigee to take a look at this as soon as possible.

Found a workaround: Change & to amp; in the URL tag

In your example, you need to change: <URL> https://api.usergrid.com/Srinath_Adusumalli/CCBAPI/nrcs/?client_id=b3U6whuc-uTEEeSgexNAM1_VyQ&client... </URL>

Change to:

https://api.usergrid.com/Srinath_Adusumalli/CCBAPI/nrcs/?client_id=b3U6whuc-uTEEeSgexNAM1_VyQ&client...

This forces the parser to interpret & as a normal character.

Since you are editing the XML directly, you will need to XML encode the values. Like you already know, & is a special character in XML used to escape XML entity.

So if you need to use &, you will have to use it as

& = & amp; [don't use space]

, it applies to other characters as well like

" = & quot;  < = & lt; > = & gt; 

etc..

Back to the original problem,

Even though its easier to include query params in the URL of the target endpoint directly, typically it better to decouple it from Target Endpoint. You use a AssignMessage policy to add Query params to the Target before the request is made,

http://apigee.com/docs/api-services/reference/assign-message-policy

Thanks,