[ 
https://issues.apache.org/jira/browse/AXIS2-5753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15231028#comment-15231028
 ] 

George Stanchev commented on AXIS2-5753:
----------------------------------------

500 is returned for all kind of reasons. The server could be returning a SOAP 
fault (as you have stated above) in which case parsing of body as SOAP Fault is 
warranted or could be having other issues where it returns (or not) all kind of 
text in the response body. HTML, plain text or nothing could be expected. The 
requester is asking for the client to be able to determine if a regular SOAP 
fault is returned and process it as needed or if other type of response is 
returned with the 500 to log the 500 along with the response instead of dumping 
exception that it failed to parse the response. This has been an issue with 
Axis2 since it's Axis1 days.

> HTTP errors 500 and 400 are not reported appropriately on WS call
> -----------------------------------------------------------------
>
>                 Key: AXIS2-5753
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5753
>             Project: Axis2
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.6.4, 1.7.1
>         Environment: Win32x64, Tomcat7, ODE 1.3.6
>            Reporter: Vitaliy Tkachenko
>            Priority: Minor
>
> On any WS call made in ODE (for example, I think the same is expected anyway 
> using the Axis2) all HTTP errors are reported appropriately e.g. 404 (Page 
> Not Found):
> [2016-04-05 14:58:50,788] [ODEServer-18] [ERROR] 
> [org.apache.ode.axis2.SoapExternalService$1$1:306] Couldn't call external web 
> service 'http://ua007478/error404'.
> Error sending message (mex={PartnerRoleMex#4611686018427387916 [PID 
> {http://http}_00000_http_cafb23ab-1f16-4997-a4de-fa2e2913e275---14] calling 
> [email protected](...) Status ASYNC}): 
> Transport error: 404 Error: Not Found
> org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
>         at 
> org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
>         at 
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194)
>         at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
>         at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:396)
>         at 
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:223)
>         at 
> com.serena.ode.throttling.SerenaThrottledHTTPTransportSender.invoke(SerenaThrottledHTTPTransportSender.java:43)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
>         at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
>         at 
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
>         at 
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
>         at 
> org.apache.ode.axis2.SoapExternalService$1$1.call(SoapExternalService.java:266)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at java.lang.Thread.run(Thread.java:745)
> But only in case of 2 errors 500 (Internal Server Error) and 400 (Bad 
> Request) the message is still parsed further which causes 
> [WstxUnexpectedCharException: Unexpected character '"'] of course as the 
> message contains no message but HTTP error description:
> [2016-04-05 14:57:23,361] [ODEServer-16] [ERROR] 
> [org.apache.ode.axis2.SoapExternalService$1$1:306] Couldn't call external web 
> service 'http://ua007478/error500'.
> Error sending message (mex={PartnerRoleMex#4611686018427387914 [PID 
> {http://http}_00000_http_cafb23ab-1f16-4997-a4de-fa2e2913e275---14] calling 
> [email protected](...) Status ASYNC}): 
> com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 
> 34) in DOCTYPE declaration; expected a space between public and system 
> identifiers
>  at [row,col {unknown-source}]: [1,50]
> org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: 
> Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space 
> between public and system identifiers
>  at [row,col {unknown-source}]: [1,50]
>       at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>       at 
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
>       at 
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
>       at 
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
>       at 
> org.apache.ode.axis2.SoapExternalService$1$1.call(SoapExternalService.java:266)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.axiom.om.DeferredParsingException: 
> com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 
> 34) in DOCTYPE declaration; expected a space between public and system 
> identifiers
>  at [row,col {unknown-source}]: [1,50]
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:706)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:199)
>       at 
> org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethod$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$buildNext(CoreParentNodeSupport.aj:58)
>       at 
> org.apache.axiom.om.impl.llom.OMDocumentImpl.buildNext(OMDocumentImpl.java:1)
>       at 
> org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethodDispatch1$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$buildNext(CoreParentNodeSupport.aj)
>       at 
> org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethod$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$coreGetFirstChild(CoreParentNodeSupport.aj:75)
>       at 
> org.apache.axiom.om.impl.llom.OMDocumentImpl.coreGetFirstChild(OMDocumentImpl.java:1)
>       at 
> org.apache.axiom.core.CoreParentNodeSupport.ajc$interMethodDispatch1$org_apache_axiom_core_CoreParentNodeSupport$org_apache_axiom_core_CoreParentNode$coreGetFirstChild(CoreParentNodeSupport.aj)
>       at 
> org.apache.axiom.core.CoreDocumentSupport.ajc$interMethod$org_apache_axiom_core_CoreDocumentSupport$org_apache_axiom_core_CoreDocument$coreGetDocumentElement(CoreDocumentSupport.aj:33)
>       at 
> org.apache.axiom.om.impl.llom.OMDocumentImpl.coreGetDocumentElement(OMDocumentImpl.java:1)
>       at 
> org.apache.axiom.om.impl.common.AxiomDocumentSupport.ajc$interMethod$org_apache_axiom_om_impl_common_AxiomDocumentSupport$org_apache_axiom_om_impl_common_AxiomDocument$getOMDocumentElement(AxiomDocumentSupport.aj:25)
>       at 
> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:1)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:582)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:578)
>       at 
> org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:198)
>       at 
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
>       at 
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
>       ... 10 more
> Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 
> '"' (code 34) in DOCTYPE declaration; expected a space between public and 
> system identifiers
>  at [row,col {unknown-source}]: [1,50]
>       at 
> com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
>       at 
> com.ctc.wstx.sr.BasicStreamReader.startDTD(BasicStreamReader.java:2482)
>       at 
> com.ctc.wstx.sr.BasicStreamReader.nextFromPrologBang(BasicStreamReader.java:2398)
>       at 
> com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2058)
>       at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
>       at 
> org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
>       at 
> org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:691)
>       ... 26 more
> This behavior prevents user to proper analyze the cause of the problem with 
> the WS - it requires time and efforts to understand that the original problem 
> is in e.g. commonly used error 500 means the WS server has some teporarily 
> problems.
> I've found that the cause why Axis2 is doing this is the code in the 
> org.apache.axis2.transport.http.HTTPSender.handleResponse function (in the 
> 1.6.4 or corresponding HTTPSender implementations in the 1.7.1) which derives 
> the logic if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR || statusCode 
> == HttpStatus.SC_BAD_REQUEST) allowing the message to be parsed (unless non 
> blocking API / transport flag is set) instead of throwing exception anyway. 
> Is there some real reason why exception isn't just thrown anyway including 
> errors 500 and 400?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to