Ashok.N
Ashok.N

Reputation: 1391

int-http:outbound-gateway is giving 404 error even when everything is perfect

I am facing a weird problem. I have configured int-http:outbound-gateway as below:

<int:channel id="PQGetMemberMainScreen-Amisys-Channel" />
    <int:chain input-channel="PQGetMemberMainScreen-Amisys-Channel" output-channel="PQGetMemberMainScreen-ExternalSystem-Response" >


        <int-xml:xslt-transformer xsl-resource="${stylesheet.amisys.soaXml.PQGetMemberMainScreen}"  /> 

        <int:service-activator  ref="httpOutboundGatewayHandler" method="buildHttpOutboundGatewayRequest" />

        <int-http:outbound-gateway  url-expression="headers.restResourceUrl"
                                    http-method-expression="headers.httpMethod"
                                    expected-response-type="java.lang.String" >
        </int-http:outbound-gateway>

    </int:chain>    

I could not able to hit a rest service using the above outbound gateway as it is giving 404 error.

HTTP request execution failed for URI [http://dstXX:30114/amisys-soa/rest/clientd/groups/KISHG2/history?v=1&eao=02112016]

......



Caused by: org.springframework.web.client.HttpClientErrorException: 404 Not Found
    at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88)
    at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:532)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:488)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:460)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:409)
    at org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler.handleRequestMessage(HttpRequestExecutingMessageHandler.java:372)
    ... 138 more

Strangely the same URL is working fine and getting me the response when hit the service using REST client. I have verified the headers and method type and found that everything is same as they should be.

Any suggestion on how to proceed further?

Upvotes: 1

Views: 414

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121272

Strangely the same URL is working fine and getting me the response when hit the service using REST client. I have verified the headers and method type and found that everything is same as they should be.

You really should compare full requests from this <int-http:outbound-gateway> and that REST Client.

Since we have 404 Not Found looks like you have missed some header or request parameter in SI case. Or there is some extra header which makes your REST service to reject the request with that reason.

For this purpose you can use nay network tracing tool. E.g. I use TCP Trace on Windows.

Upvotes: 1

Related Questions