Need to trap "com.ctc.wstx.exc.WstxUnexpectedCharException" in 
ReadHeadersInterceptor and give HTML response message
--------------------------------------------------------------------------------------------------------------------

                 Key: CXF-1490
                 URL: https://issues.apache.org/jira/browse/CXF-1490
             Project: CXF
          Issue Type: Improvement
          Components: Core
            Reporter: Glen Mazza
            Priority: Minor


If an HTML response in returned from the service to the client, due to a basic 
authentication or other error, the following error stack is returned (if 
chunked transfer encoding is set to FALSE for the HTTPConduit/client*):

    [java] Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected 
character '"' (code 34) in DOCTYPE declaration; expected a space between public 
and system identifiers
     [java]  at [row,col {unknown-source}]: [1,55]
     [java]     at 
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
     [java]     at 
com.ctc.wstx.sr.BasicStreamReader.startDTD(BasicStreamReader.java:2482)
     [java]     at 
com.ctc.wstx.sr.BasicStreamReader.nextFromPrologBang(BasicStreamReader.java:2398)
     [java]     at 
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2058)
     [java]     at 
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
     [java]     at 
com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095)
     [java]     at 
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:85)
     [java]     ... 15 more

This requires the user to go to Wireshark[1] to determine what the HTML error 
message is.  I think it would be helpful for the user if this error was 
trapped, and the HTML error message output to the client console as part of the 
exception, to save that step.

Steps to duplicate:  Make an HTTPS client connection to a server with (a) wrong 
username and/or password and (b) chunked transfer encoding set to false as 
shown here:

<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:sec="http://cxf.apache.org/configuration/security"; 
xmlns:http="http://cxf.apache.org/transports/http/configuration"; 
xsi:schemaLocation="http://cxf.apache.org/configuration/security 
http://cxf.apache.org/schemas/configuration/security.xsd 
http://cxf.apache.org/transports/http/configuration 
http://cxf.apache.org/schemas/configuration/http-conf.xsd 
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd";>
   <http:conduit 
name="{https://myhost.com/this/is/namespace}MyPortName.http-conduit";>
   <http:authorization>
     <sec:UserName>???</sec:UserName>
     <sec:Password>???</sec:Password>
   </http:authorization>
   <http:tlsClientParameters secureSocketProtocol="SSL"/>
   <http-conf:client AllowChunking="false"/>
   </http:conduit>
</beans>

Running the client should produce the above error stack.

[1] http://www.jroller.com/gmazza/entry/wireshark_usage_for_cxf

* if chunked transfer encoding is true, we get a HttpRetryException error 
message as shown here:
http://techpolesen.blogspot.com/2007/08/javanethttpretryexception-cannot-retry.html;
 this is not currently a concern for me.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to