Basic Tutorial - XML to JSON in Post Flow

Not applicable

Hi - I am just starting out with Apigee and am trying to run the basic proxy tutorial - when applying XML to JSON as a post flow attribute I end up getting the following -

{"fault":{"faultstring":"XMLToJSON[XML-to-JSON-2]: Source response is not available","detail":{"errorcode":"steps.xml2json.SourceUnavailable"}}}

http://docs.apigee.com/api-services/tutorials/add-policies-your-api

2 7 1,070
7 REPLIES 7

Dear @Ghulam Farooq Shaikh ,

Please find steps below that demonstrates XML to JSON in postflow.

Step 1 : Create proxy

2199-fotorcreated.png

Step 2:

Click on Develop Tab,

2200-response.png

Step 3: Click on Proxy PostFlow / Target Post Flow & then +Step condition on response pipe line as shown in above step.

Step 4 : Choose XML to Json Policy & add same.

2201-screen-shot-2016-03-21-at-51152-pm.png

Step 5: Save proxy

Step 6 : Hit API to see json response converted from XML,

For example, http://asagarnodeapp-test.apigee.net/samplexmltojson?w=2502265

Thanks sagar . its helpful.

Hi @Anil Sagar I'm below getting error when browsing api or curl.

Not able to attach or insert screenshot.

Is Yahoo weather api url not working ?

Please help to understand where problem.

Error:

yahoo:description tag

Please provide valid credentials. OAuth oauth_problem="OST_OAUTH_PARAMETER_ABSENT_ERROR", realm="yahooapis.com"

yahoo:detail tag

OAuth oauth_problem="OST_OAUTH_PARAMETER_ABSENT_ERROR", realm="yahooapis.com"

Thanks

@Dhanunjaya Gajula , Yahoo API is no longer public API, See this article here .

Instead of yahoo backend url , Use, http://mocktarget.apigee.net/xml

Thanks anil

Glad it's helpful @Dhanunjaya Gajula , Keep us posted moving forward if any.

Hi Sagar,

I am using postman tool and sending xml payload and using xml to json policy in preflow -->Request as my target server only accepts json format.

Am I doing in the right flow?