Uploaded image for project: 'apiman (API Management)'
  1. apiman (API Management)
  2. APIMAN-457

Some HTTP error responses result in runtime exceptions in the Gateway

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.1.6.Final, 1.1.x
    • None
    • None
    • None

    Description

      Whatever comes back from the server, as long as it's a valid HTTP response, should get proxied back to the calling client. We should never re-throw as something else. This was reported in the community:

      2015-06-05 15:51:07.626 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:192 - Sending a POST request to [http://grizzly:28080/apiman-gateway/Flexsure/YelIncomeProxyService/1.0/getIncomeInfo]
      2015-06-05 15:51:07.628 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:193 - Request body:[{
        "personalIdCode": "foobar",
        "firstName": "Aimo",
        "lastName": "Kupponen",
        "calculationDate": "2015-05-19",
        "requester": "theUserId"
      }
      ]
      2015-06-05 15:51:07.636 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:374 - Request header:[SF_USER=theUserId]
      2015-06-05 15:51:07.637 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:374 - Request header:[SF_REFUSER=Gruppe]
      2015-06-05 15:51:07.638 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:374 - Request header:[Accept=application/json;charset=utf-8]
      2015-06-05 15:51:07.639 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:374 - Request header:[SF_KANAVA=0063]
      2015-06-05 15:51:08.356 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[X-Powered-By=Undertow/1]
      2015-06-05 15:51:08.356 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[X-Exception=java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/YelIncomeProxyService/getIncomeInfo]
      2015-06-05 15:51:08.358 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[org.switchyard.exchangeInitiatedNS=5853995762433695]
      2015-06-05 15:51:08.358 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[CamelToEndpoint=direct://%7Burn:fi.folksam.esb:YelIncomeProxyService:1.0%7DYelIncomeProxyServiceRest]
      2015-06-05 15:51:08.361 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[Server=Apache-Coyote/1.1]
      2015-06-05 15:51:08.362 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[org.switchyard.messageId=ID-grizzly-skade-fi-59180-1432641470961-92-93]
      2015-06-05 15:51:08.364 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[Date=Fri, 05 Jun 2015 12:51:08 GMT]
      2015-06-05 15:51:08.365 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[Connection=close]
      2015-06-05 15:51:08.369 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[Transfer-Encoding=chunked]
      2015-06-05 15:51:08.370 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[org.switchyard.relatesTo=ID-grizzly-skade-fi-59180-1432641470961-92-91]
      2015-06-05 15:51:08.371 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[Content-Type=application/json;charset=utf-8]
      2015-06-05 15:51:08.372 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:387 - Received response header:[org.switchyard.exchangeGatewayName=rest1]
      2015-06-05 15:51:08.374 INFO  [main] org.switchyard.component.test.mixins.http.HTTPMixIn:389 - Received response body:[HTTP/1.1 500 Internal Server Error [X-Powered-By: Undertow/1, X-Exception: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/YelIncomeProxyService/getIncomeInfo, org.switchyard.exchangeInitiatedNS: 5853995762433695, CamelToEndpoint: direct://%7Burn:fi.folksam.esb:YelIncomeProxyService:1.0%7DYelIncomeProxyServiceRest, Server: Apache-Coyote/1.1, org.switchyard.messageId: ID-grizzly-skade-fi-59180-1432641470961-92-93, Date: Fri, 05 Jun 2015 12:51:08 GMT, Connection: close, Transfer-Encoding: chunked, org.switchyard.relatesTo: ID-grizzly-skade-fi-59180-1432641470961-92-91, Content-Type: application/json;charset=utf-8, org.switchyard.exchangeGatewayName: rest1]]
      2015-06-05 15:51:08.384 DEBUG [main] fi.folksam.esb.income.TestSupport:59 - 
      http://grizzly:28080/apiman-gateway/Flexsure/YelIncomeProxyService/1.0/getIncomeInfo:
      	req: {
        "personalIdCode": "foobar",
        "firstName": "Aimo",
        "lastName": "Kupponen",
        "calculationDate": "2015-05-19",
        "requester": "theUserId"
      }
      
      	res: java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/YelIncomeProxyService/getIncomeInfo
      	at io.apiman.gateway.platforms.servlet.connectors.HttpServiceConnection.transmit(HttpServiceConnection.java:258)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$3$1.handle(ServiceRequestExecutorImpl.java:285)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$3$1.handle(ServiceRequestExecutorImpl.java:256)
      	at io.apiman.gateway.engine.policy.Chain.handleHead(Chain.java:200)
      	at io.apiman.gateway.engine.policy.Chain.doApply(Chain.java:151)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$3.handle(ServiceRequestExecutorImpl.java:307)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$3.handle(ServiceRequestExecutorImpl.java:245)
      	at io.apiman.gateway.platforms.servlet.connectors.HttpServiceConnection.end(HttpServiceConnection.java:227)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$1$1$2.handle(ServiceRequestExecutorImpl.java:162)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$1$1$2.handle(ServiceRequestExecutorImpl.java:158)
      	at io.apiman.gateway.engine.io.AbstractStream.handleEnd(AbstractStream.java:116)
      	at io.apiman.gateway.engine.policy.Chain.end(Chain.java:182)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$4.end(ServiceRequestExecutorImpl.java:332)
      	at io.apiman.gateway.platforms.servlet.GatewayServlet$2.handle(GatewayServlet.java:211)
      	at io.apiman.gateway.platforms.servlet.GatewayServlet$2.handle(GatewayServlet.java:200)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl.handleStream(ServiceRequestExecutorImpl.java:319)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$1$1.handle(ServiceRequestExecutorImpl.java:169)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$1$1.handle(ServiceRequestExecutorImpl.java:131)
      	at io.apiman.gateway.engine.policy.Chain.handleHead(Chain.java:200)
      	at io.apiman.gateway.engine.policy.Chain.doApply(Chain.java:151)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$1.handle(ServiceRequestExecutorImpl.java:173)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$1.handle(ServiceRequestExecutorImpl.java:126)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl.loadPolicies(ServiceRequestExecutorImpl.java:194)
      	at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl.execute(ServiceRequestExecutorImpl.java:126)
      	at io.apiman.gateway.platforms.servlet.GatewayServlet.doAction(GatewayServlet.java:218)
      	at io.apiman.gateway.platforms.servlet.GatewayServlet.doPost(GatewayServlet.java:88)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
      	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
      	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
      	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
      	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
      	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
      	at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)
      	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/YelIncomeProxyService/getIncomeInfo
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1676)
      	at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1674)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1672)
      	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245)
      	at io.apiman.gateway.platforms.servlet.connectors.HttpServiceConnection.transmit(HttpServiceConnection.java:240)
      	... 53 more
      Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://localhost:8080/YelIncomeProxyService/getIncomeInfo
      	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1627)
      	at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:2714)
      	at io.apiman.gateway.platforms.servlet.connectors.HttpServiceConnection.end(HttpServiceConnection.java:219)
      	... 46 more
      

      Attachments

        Activity

          People

            ewittman@redhat.com Eric Wittmann
            ewittman@redhat.com Eric Wittmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: