Access Service Call out XML Response

Hi ,

I have created service callout policy to call rest service which will give xml reponse back.

I want to pass response received from the service callout for source of XSLT. Unfortunately its not working when i pass the service callout response to the source of xsl policy.But i can see the service callout response in the flow trace.Can you guys help me to resolve the issue.

Solved Solved
0 2 334
1 ACCEPTED SOLUTION

Hi @Jegath Kumar, when you post a question, also add the Policy XML code, trace flow images and proxy bundle if possible.

Let's say this is your SC Policy, by default the response is stored in calloutResponse, but we can change it as required, for example, GeocodingResponse

<ServiceCallout name="ServiceCallout-GeocodingRequest1">
    <DisplayName>Inline request message</DisplayName>
    <Request variable="authenticationRequest">
      <Set>
        <QueryParams>
          <QueryParam name="sensor">false</QueryParam>
        </QueryParams>
      </Set>
    </Request>
    <Response>GeocodingResponse</Response>
    <Timeout>30000</Timeout>
    <HTTPTargetConnection>
      <URL>http://maps.googleapis.com/maps/api/geocode/json</URL>
    </HTTPTargetConnection>
</ServiceCallout>

Next we can use this <Response>GeocodingResponse</Response>, in Source of XSLT policy as,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="XSLT-Remove-Namespaces">
    <DisplayName>XSLT-Remove-Namespaces</DisplayName>
    <Properties/>
    <Source>GeocodingResponse</Source>
    <ResourceURL>xsl://XSLT-Remove-Namespaces.xsl</ResourceURL>
    <Parameters ignoreUnresolvedVariables="true"/>
    <OutputVariable>XSLT-Request</OutputVariable>
</XSL>

This is the normal flow, if you are using multiple SC policies in same flow then we may also need to change the <Request variable="authenticationRequest"> variable name.

View solution in original post

2 REPLIES 2

Hi @Jegath Kumar, when you post a question, also add the Policy XML code, trace flow images and proxy bundle if possible.

Let's say this is your SC Policy, by default the response is stored in calloutResponse, but we can change it as required, for example, GeocodingResponse

<ServiceCallout name="ServiceCallout-GeocodingRequest1">
    <DisplayName>Inline request message</DisplayName>
    <Request variable="authenticationRequest">
      <Set>
        <QueryParams>
          <QueryParam name="sensor">false</QueryParam>
        </QueryParams>
      </Set>
    </Request>
    <Response>GeocodingResponse</Response>
    <Timeout>30000</Timeout>
    <HTTPTargetConnection>
      <URL>http://maps.googleapis.com/maps/api/geocode/json</URL>
    </HTTPTargetConnection>
</ServiceCallout>

Next we can use this <Response>GeocodingResponse</Response>, in Source of XSLT policy as,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="XSLT-Remove-Namespaces">
    <DisplayName>XSLT-Remove-Namespaces</DisplayName>
    <Properties/>
    <Source>GeocodingResponse</Source>
    <ResourceURL>xsl://XSLT-Remove-Namespaces.xsl</ResourceURL>
    <Parameters ignoreUnresolvedVariables="true"/>
    <OutputVariable>XSLT-Request</OutputVariable>
</XSL>

This is the normal flow, if you are using multiple SC policies in same flow then we may also need to change the <Request variable="authenticationRequest"> variable name.

@Siddharth Barahalikar Thanks for helping me ,it worked.