> I think this is what is causing the SOAP Fault not being processed as it
> closes the inputstream because the getPartialResponse only looks for OK
> codes. The WS is a one-way service that does not define a SOAP Fault, but a
> SOAP Fault is being returned.

Well, that's interesting.   That's a bug in the webservice then.  According to 
spec, one way operations can NOT return a fault.   The response must not have 
any content.   

Dan



On Tuesday 28 October 2008 7:14:20 pm juan.velez wrote:
> Hi Dan:
>
> I did some debugging and I found that in the HTTPConduit class's
> handleResponseInternal method, there is this condition
>
>             if (isOneway(exchange) || isDecoupled()) {
>                 in = getPartialResponse(connection, responseCode);
>                 if (in == null) {
>                     // oneway operation or decoupled MEP without
>                     // partial response
>                     connection.getInputStream().close();
>                     return;
>                 }
>             } else {
>
>
>     protected static InputStream getPartialResponse(
>         HttpURLConnection connection,
>         int responseCode
>     ) throws IOException {
>         InputStream in = null;
>         if (responseCode == HttpURLConnection.HTTP_ACCEPTED
>
>             || responseCode == HttpURLConnection.HTTP_OK) {
>
>             if (connection.getContentLength() > 0) {
>                 in = connection.getInputStream();
>             } else if (hasChunkedResponse(connection)
>
>                        || hasEofTerminatedResponse(connection)) {
>
>                 // ensure chunked or EOF-terminated response is non-empty
>                 in = getNonEmptyContent(connection);
>             }
>         }
>         return in;
>     }
>
>
> I think this is what is causing the SOAP Fault not being processed as it
> closes the inputstream because the getPartialResponse only looks for OK
> codes. The WS is a one-way service that does not define a SOAP Fault, but a
> SOAP Fault is being returned.
>
> Let me know what you think
>
> dkulp wrote:
> > Not sure what could be the issue.....   Hmm....
> >
> > What version of CXF and what JDK version are you using?
> >
> >> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
> >>tio n.java:885) at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
> >>ons e(HTTPConduit.java:1933
> >
> > Those frames kind of concern me.   If the response code is 500, then
> > getErrorStream() should return non-null (since there is fault data) and
> > thus
> > getInputStream() should not be called at all.     Is there some sort of
> > proxy
> > or something that could be truncating the response?
> >
> > Dan
> >
> > On Monday 27 October 2008 10:28:54 pm juan.velez wrote:
> >> I have created a CXF WS Provider that returns a SOAP Fault when some
> >> condition occurs. The WSDL does NOT declare the SOAP Fault. When I use
> >> SOAP
> >> UI to test the WS Provider and the condition occurs, I DO get the SOAP
> >> Fault along with the HTTP 500 error:
> >>
> >> HTTP/1.1 500 Internal Server Error
> >> Date: Tue, 28 Oct 2008 02:27:38 GMT
> >> Content-Length: 199
> >> Connection: close
> >> Content-Type: text/xml;charset=UTF-8
> >> Server: Apache-Coyote/1.1
> >>
> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
> >>    <soap:Body>
> >>       <soap:Fault>
> >>          <faultcode>soap:Client</faultcode>
> >>          <faultstring>Juan</faultstring>
> >>       </soap:Fault>
> >>    </soap:Body>
> >> </soap:Envelope>
> >>
> >>  However, when I create a CXF WS Client off the WSDL and execute it
> >> against
> >> the CXF WS Provider, I only get an IOException
> >>
> >> Oct 27, 2008 7:25:35 PM org.apache.cxf.phase.PhaseInterceptorChain
> >> doIntercept
> >> INFO: Interceptor has thrown exception, unwinding now
> >> org.apache.cxf.interceptor.Fault: Could not send Message.
> >>    at
> >> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
> >>nte rceptor.handleMessage(MessageSenderInterceptor.java:64) at
> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> >>hai n.java:221) at
> >> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276) at
> >> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222) at
> >> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> >> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:177)
> >> at
> >> $Proxy28.processExport(Unknown Source)
> >>    at com.areva.mmi.wsdl.MMIService.main(MMIService.java:97)
> >> Caused by: java.io.IOException: Server returned HTTP response code: 500
> >> for
> >> URL: http://localhost:8080/mmi/export
> >>    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >> Method) at
> >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
> >>cce ssorImpl.java:39) at
> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
> >>tru ctorAccessorImpl.java:27) at
> >> java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
> >> sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java
> >>:12 02) at java.security.AccessController.doPrivileged(Native Method) at
> >> sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLC
> >>onn ection.java:1196) at
> >> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
> >>tio n.java:885) at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
> >>ons e(HTTPConduit.java:1933) at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
> >>Con duit.java:1824) at
> >> org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutpu
> >>tSt ream.java:47) at
> >> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:159)
> >> at
> >> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> >> at
> >> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:583) at
> >> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
> >>nte rceptor.handleMessage(MessageSenderInterceptor.java:62) ... 7 more
> >> Caused by: java.io.IOException: Server returned HTTP response code: 500
> >> for
> >> URL: http://localhost:8080/mmi/export
> >>    at
> >> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
> >>tio n.java:1149) at
> >> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
> >> at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
> >>ons e(HTTPConduit.java:1896) ... 13 more
> >> javax.xml.ws.soap.SOAPFaultException: Could not send Message.
> >>    at
> >> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:218)
> >>    at $Proxy28.processExport(Unknown Source)
> >>    at com.areva.mmi.wsdl.MMIService.main(MMIService.java:97)
> >> Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
> >>    at
> >> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
> >>nte rceptor.handleMessage(MessageSenderInterceptor.java:64) at
> >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> >>hai n.java:221) at
> >> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276) at
> >> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222) at
> >> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> >> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:177)
> >> ...
> >> 2 more
> >> Caused by: java.io.IOException: Server returned HTTP response code: 500
> >> for
> >> URL: http://localhost:8080/mmi/export
> >>    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >> Method) at
> >> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
> >>cce ssorImpl.java:39) at
> >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
> >>tru ctorAccessorImpl.java:27) at
> >> java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
> >> sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java
> >>:12 02) at java.security.AccessController.doPrivileged(Native Method) at
> >> sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLC
> >>onn ection.java:1196) at
> >> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
> >>tio n.java:885) at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
> >>ons e(HTTPConduit.java:1933) at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
> >>Con duit.java:1824) at
> >> org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutpu
> >>tSt ream.java:47) at
> >> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:159)
> >> at
> >> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> >> at
> >> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:583) at
> >> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
> >>nte rceptor.handleMessage(MessageSenderInterceptor.java:62) ... 7 more
> >> Caused by: java.io.IOException: Server returned HTTP response code: 500
> >> for
> >> URL: http://localhost:8080/mmi/export
> >>    at
> >> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
> >>tio n.java:1149) at
> >> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367)
> >> at
> >> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
> >>ons e(HTTPConduit.java:1896) ... 13 more
> >>
> >>
> >>  instead of the actual SOAP Fault Exception.  What am I doing wrong?
> >>
> >> Thanks,
> >>
> >> Juan
> >
> > --
> > Daniel Kulp
> > [EMAIL PROTECTED]
> > http://dankulp.com/blog



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://dankulp.com/blog

Reply via email to