service call out- getting response 200 but not able to see in final response

Not applicable

I have created a proxy with no endpoint . At proxy endpoint postflow ,I have added a service callout policy name 'ServiceCallout-GetBaasToken' with response 'GeocodingResponse'.I have given a http target endpoint in the servicecallout policy.When I am testing I am getting response code 200 and I can see response in trace logs under 'servicecallout.response' ,but I am not able to see the final response in browser or api console testing tool.Here are the details.

Proxy endpoint-Post flow

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
    <Description />
    <FaultRules />
    <PreFlow name="PreFlow">
        <Request />
        <Response />
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request>
            <Step>
                <Name>ServiceCallout-GetBaasToken</Name>
            </Step>
        </Request>
        <Response></Response>
    </PostFlow>
    <Flows />
    <HTTPProxyConnection>
        <BasePath>/servicecalloutcountries</BasePath>
        <Properties />
        <VirtualHost>default</VirtualHost>
    </HTTPProxyConnection>
    <RouteRule name="noroute" />
</ProxyEndpoint>
 

service call out policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout name="ServiceCallout-GetBaasToken">
    <DisplayName>Inline request message</DisplayName>
    <Request variable="authenticationRequest" />
    <Response>GeocodingResponse</Response>
    <Timeout>30000</Timeout>
    <HTTPTargetConnection>
        <URL>http://www.thomas-bayer.com/sqlrest/CUSTOMER/3/</URL>
    </HTTPTargetConnection>
</ServiceCallout>

0 5 580
5 REPLIES 5

@veeraraghavendra , Welcome to Apigee Community,

It's because Your target server is No-Target & you haven't overridden the target response. You need to use Assign Message Policy to override default target response. Any reason why you are using service callout instead of above url in service callout as target endpoint ?

@veeraraghavendra , Just wondering, Why are you using service callout at first ? Why don't you specify target endpoint while creating proxy instead of No-Target ?

Not applicable

Hi Anil,Many thanks for your suggestion.I am trying to call service 'sqlrest/CUSTOMER/3' using service callout policy to ensure that service can be called or not.My doubt is if service callout policy can handle response object .I should get the final response right .Let me try by override the target endpoint using 'Assign message policy' .I will come back to you ,if I have any further questions.

Not applicable

Hi Anil,As you suggested I have added 'ExtractVariable'policy to extract data from servicecall out response and 'Assignmessage' policy to display final response.During 'ExtractVariable' policy execution I have used correct XPATH ,but not able to get the value.

Here are the details.(Note:I did everything at the proxyendpoint postflow)

Service Callout:Inline request message

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ServiceCallout name="ServiceCallout-GetBaasToken"> <DisplayName>Inline request message</DisplayName> <Request variable="authenticationRequest"/> <Response>GeocodingResponse</Response> <Timeout>30000</Timeout> <HTTPTargetConnection> <URL>http://www.thomas-bayer.com/sqlrest/CUSTOMER/13</URL> </HTTPTargetConnection> </ServiceCallout>

Extract Variables-res

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables name="Extract-Variables-res"> <DisplayName>Extract Variables-res</DisplayName> <Source>GeocodingResponse</Source> <XMLPayload> <Namespaces> <Namespace prefix="xlink">http://www.w3.org/1999/xlink</Namespace> </Namespaces> <Variable name="firstname" type="string"> <XPath>/xlink:CUSTOMER/xlink:FIRSTNAME</XPath> </Variable> </XMLPayload> </ExtractVariables>

Assign-Message-Res

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="Assign-Message-Res"> <DisplayName>Assign Message-Res</DisplayName> <Properties/> <Copy source="response"> <Payload/> </Copy> <AssignVariable> <Name>name</Name> <Value>firstname</Value> </AssignVariable> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="response"/> <Set> <Payload> <Tamatar>{firstname}</Tamatar> <Aloo>{firstname}</Aloo> </Payload> </Set> </AssignMessage>

Please correct me ,if there is any code discrepency.Also send me the correct code ,if possible.

Not applicable

hi veeraraghavendra

I think you need to use the assign message policy to setup the final response payload body using the GeocodingResponse which you got from the callout policy.

Make sure after that do not clear the payload by using other policies.