Dan,

I tried the following code in my unit test, but I don't see the stack trace
returning with the soap fault.

        Endpoint endpoint = Endpoint.create(serviceInstance);
        List<Handler> handlers = new ArrayList<Handler>();
        Map<String, Object> properties = new HashMap<String, Object>();

        properties.put("faultStackTraceEnabled",
                       "true");
        handlers.add(new ServiceHandler());
        endpoint.getBinding().setHandlerChain(handlers);
        endpoint.publish(endpointLocation);
        endpoint.setProperties(properties);

My response still misses the stack trace

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>Mock up exception</faultstring>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

Thanks,
Kiffin




kiffin wrote:
> 
> I have the following code in my unit test and I get an "Connection refuse
> connect" exception
> 
>         Endpoint endpoint = Endpoint.create(serviceInstance);
>         List<Handler> handlers = new ArrayList<Handler>();
>         Map<String, Object> properties = new HashMap<String, Object>();
> 
>         properties.put("faultStackTraceEnabled",
>                        "true");
>         handlers.add(new ServiceHandler());
>         endpoint.getBinding().setHandlerChain(handlers);
>         endpoint.setProperties(properties);
>         endpoint.publish(endpointLocation);
> 
> If I change it to the following code, the endpoint works but not the
> property.
> 
>         List<Handler> handlers = new ArrayList<Handler>();
>         Map<String, Object> properties = new HashMap<String, Object>();
> 
>         properties.put("faultStackTraceEnabled",
>                        "true");
>         handlers.add(new ServiceHandler());
> 
>         Endpoint endpoint = Endpoint.publish(endpointLocation,
>                                                          
> serviceInstance);
>         endpoint.getBinding().setHandlerChain(handlers);
>         endpoint.setProperties(properties);
> 
> I don't understand why the first version wouldn't work. 
> 
> 
> 
> 
> dkulp wrote:
>> 
>> On Tue February 16 2010 12:50:44 pm kiffin wrote:
>>> Dan,
>>> 
>>> I am using the Endpoint class in my unit test. Could I call the
>>> setProperties method with this property?
>> 
>> I think so, yes.   You may need to to do it before the call to publish
>> though.   
>> Basically, do ep = Endpoint.create(...) and then ep.publish(addr) as
>> separate 
>> steps with the ep.setProeprties stuff in the middle.
>> 
>> Dan
>> 
>> 
>>> 
>>> Thanks,
>>> Kiffin
>>> 
>>> dkulp wrote:
>>> > You can give this a try, but a caveat in that I've never tried this so
>>> I
>>> > don't
>>> > know what the resulting soap message looks like:
>>> > 
>>> > If you set a property on the endpoint like:
>>> > <jaxws:properties>
>>> > 
>>> >     <entry key="faultStackTraceEnabled" value="true" />
>>> > 
>>> > </jaxws:properties>
>>> > 
>>> > the the SOAP out interceptors will stick a stack trace into the fault.
>>> > Not
>>> > exactly sure what that ends up looking like.
>>> > 
>>> > Dan
>>> > 
>>> > On Fri February 12 2010 5:58:05 pm kiffin wrote:
>>> >> That response message was from running a test using the CXF stack.
>>> The
>>> >> message below is from the Sun stack running the same test. We need to
>>> do
>>> >> some post-processing on service exception and need to know the root
>>> >> cause of that exception.
>>> >> 
>>> >> Thanks,
>>> >> Kiffin
>>> >> 
>>> >> <?xml version="1.0" standalone="no"?>
>>> >> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/";>
>>> >> 
>>> >>     <S:Body>
>>> >>     
>>> >>         <ns2:Fault
>>> xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/";
>>> >> 
>>> >> xmlns:ns3="http://www.w3.org/2003/05/soap-envelope";>
>>> >> 
>>> >>             <faultcode>
>>> >>             
>>> >>                 ns2:Server
>>> >>             
>>> >>             </faultcode>
>>> >>             <faultstring>
>>> >>             
>>> >>                 java.lang.RuntimeException: Mock up exception
>>> >>             
>>> >>             </faultstring>
>>> >>             <detail>
>>> >>             
>>> >>                 <ns2:exception
>>> xmlns:ns2="http://jax-ws.dev.java.net/";
>>> >> 
>>> >> class="com.expd.arch.service.ServiceException" note="To disable this
>>> >> feature, set
>>> >> com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace
>>> >> system property to false">
>>> >> 
>>> >>                     <message>
>>> >>                     
>>> >>                         java.lang.RuntimeException: Mock up exception
>>> >>                     
>>> >>                     </message>
>>> >>                     <ns2:stackTrace>
>>> >>                     
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.expd.arch.service.ServiceException"
>>> >> file="ServiceException.java"
>>> >> line="101" method="wrap"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.expd.service.calculation.impl.CalculationService"
>>> >> file="CalculationService.java" line="134"
>>> >> method="throwExceptionInMethod"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="sun.reflect.NativeMethodAccessorImpl"
>>> >> file="NativeMethodAccessorImpl.java" line="native" method="invoke0"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="sun.reflect.NativeMethodAccessorImpl"
>>> >> file="NativeMethodAccessorImpl.java" line="39" method="invoke"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="sun.reflect.DelegatingMethodAccessorImpl"
>>> >> file="DelegatingMethodAccessorImpl.java" line="25" method="invoke"/>
>>> >> 
>>> >>                         <ns2:frame class="java.lang.reflect.Method"
>>> >> 
>>> >> file="Method.java" line="597" method="invoke"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.api.server.InstanceResolver$1"
>>> >> file="InstanceResolver.java" line="246" method="invoke"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java"
>>> >> line="146" method="invoke"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.sei.EndpointMethodHandler"
>>> >> file="EndpointMethodHandler.java" line="257" method="invoke"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.sei.SEIInvokerTube"
>>> >> file="SEIInvokerTube.java"
>>> >> line="93" method="processRequest"/>
>>> >> 
>>> >>                         <ns2:frame
>>> class="com.sun.xml.ws.api.pipe.Fiber"
>>> >> 
>>> >> file="Fiber.java" line="598" method="__doRun"/>
>>> >> 
>>> >>                         <ns2:frame
>>> class="com.sun.xml.ws.api.pipe.Fiber"
>>> >> 
>>> >> file="Fiber.java" line="557" method="_doRun"/>
>>> >> 
>>> >>                         <ns2:frame
>>> class="com.sun.xml.ws.api.pipe.Fiber"
>>> >> 
>>> >> file="Fiber.java" line="542" method="doRun"/>
>>> >> 
>>> >>                         <ns2:frame
>>> class="com.sun.xml.ws.api.pipe.Fiber"
>>> >> 
>>> >> file="Fiber.java" line="439" method="runSync"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.WSEndpointImpl$2"
>>> >> file="WSEndpointImpl.java" line="243" method="process"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit"
>>> >> file="HttpAdapter.java" line="444" method="handle"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.HttpAdapter"
>>> >> file="HttpAdapter.java" line="244" method="handle"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.server.WSHttpHandler"
>>> >> file="WSHttpHandler.java" line="106" method="handleExchange"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.server.WSHttpHandler"
>>> >> file="WSHttpHandler.java" line="91" method="handle"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.net.httpserver.Filter$Chain" file="Filter.java"
>>> line="65"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                         <ns2:frame
>>> class="sun.net.httpserver.AuthFilter"
>>> >> 
>>> >> file="AuthFilter.java" line="65" method="doFilter"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.net.httpserver.Filter$Chain" file="Filter.java"
>>> line="68"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="sun.net.httpserver.ServerImpl$Exchange$LinkHandler"
>>> >> file="ServerImpl.java" line="555" method="handle"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="com.sun.net.httpserver.Filter$Chain" file="Filter.java"
>>> line="65"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="sun.net.httpserver.ServerImpl$Exchange" file="ServerImpl.java"
>>> >> line="527" method="run"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="java.util.concurrent.ThreadPoolExecutor$Worker"
>>> >> file="ThreadPoolExecutor.java" line="886" method="runTask"/>
>>> >> 
>>> >>                         <ns2:frame
>>> >> 
>>> >> class="java.util.concurrent.ThreadPoolExecutor$Worker"
>>> >> file="ThreadPoolExecutor.java" line="908" method="run"/>
>>> >> 
>>> >>                         <ns2:frame class="java.lang.Thread"
>>> >> 
>>> >> file="Thread.java" line="619" method="run"/>
>>> >> 
>>> >>                     </ns2:stackTrace>
>>> >>                     <ns2:cause class="java.lang.RuntimeException"
>>> >> 
>>> >> note="To
>>> >> disable this feature, set
>>> >> com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system
>>> >> property to false">
>>> >> 
>>> >>                         <message>
>>> >>                         
>>> >>                             Mock up exception
>>> >>                         
>>> >>                         </message>
>>> >>                         <ns2:stackTrace>
>>> >>                         
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.expd.service.calculation.impl.CalculationService"
>>> >> file="CalculationService.java" line="126"
>>> >> method="throwRuntimeException"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.expd.service.calculation.impl.CalculationService"
>>> >> file="CalculationService.java" line="132"
>>> >> method="throwExceptionInMethod"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="sun.reflect.NativeMethodAccessorImpl"
>>> >> file="NativeMethodAccessorImpl.java" line="native" method="invoke0"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="sun.reflect.NativeMethodAccessorImpl"
>>> >> file="NativeMethodAccessorImpl.java" line="39" method="invoke"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="sun.reflect.DelegatingMethodAccessorImpl"
>>> >> file="DelegatingMethodAccessorImpl.java" line="25" method="invoke"/>
>>> >> 
>>> >>                             <ns2:frame
>>> class="java.lang.reflect.Method"
>>> >> 
>>> >> file="Method.java" line="597" method="invoke"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.api.server.InstanceResolver$1"
>>> >> file="InstanceResolver.java" line="246" method="invoke"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.InvokerTube$2" file="InvokerTube.java"
>>> >> line="146" method="invoke"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.sei.EndpointMethodHandler"
>>> >> file="EndpointMethodHandler.java" line="257" method="invoke"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.sei.SEIInvokerTube"
>>> >> file="SEIInvokerTube.java"
>>> >> line="93" method="processRequest"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="598"
>>> >> method="__doRun"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="557"
>>> >> method="_doRun"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="542"
>>> >> method="doRun"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="439"
>>> >> method="runSync"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.server.WSEndpointImpl$2"
>>> >> file="WSEndpointImpl.java" line="243" method="process"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit"
>>> >> file="HttpAdapter.java" line="444" method="handle"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.HttpAdapter"
>>> >> file="HttpAdapter.java" line="244" method="handle"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.server.WSHttpHandler"
>>> >> file="WSHttpHandler.java" line="106" method="handleExchange"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.xml.ws.transport.http.server.WSHttpHandler"
>>> >> file="WSHttpHandler.java" line="91" method="handle"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.net.httpserver.Filter$Chain" file="Filter.java"
>>> line="65"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="sun.net.httpserver.AuthFilter" file="AuthFilter.java"
>>> line="65"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.net.httpserver.Filter$Chain" file="Filter.java"
>>> line="68"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="sun.net.httpserver.ServerImpl$Exchange$LinkHandler"
>>> >> file="ServerImpl.java" line="555" method="handle"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="com.sun.net.httpserver.Filter$Chain" file="Filter.java"
>>> line="65"
>>> >> method="doFilter"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="sun.net.httpserver.ServerImpl$Exchange" file="ServerImpl.java"
>>> >> line="527" method="run"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="java.util.concurrent.ThreadPoolExecutor$Worker"
>>> >> file="ThreadPoolExecutor.java" line="886" method="runTask"/>
>>> >> 
>>> >>                             <ns2:frame
>>> >> 
>>> >> class="java.util.concurrent.ThreadPoolExecutor$Worker"
>>> >> file="ThreadPoolExecutor.java" line="908" method="run"/>
>>> >> 
>>> >>                             <ns2:frame class="java.lang.Thread"
>>> >> 
>>> >> file="Thread.java" line="619" method="run"/>
>>> >> 
>>> >>                         </ns2:stackTrace>
>>> >>                     
>>> >>                     </ns2:cause>
>>> >>                 
>>> >>                 </ns2:exception>
>>> >>             
>>> >>             </detail>
>>> >>         
>>> >>         </ns2:Fault>
>>> >>     
>>> >>     </S:Body>
>>> >> 
>>> >> </S:Envelope>
>>> >> 
>>> >> dkulp wrote:
>>> >> > Per spec, the "faultstring" should be the result of
>>> >> > exception.getMessage().
>>> >> > Thus, we output whatever that returns.   Is there any way you can
>>> look
>>> >> 
>>> >> at
>>> >> 
>>> >> > the
>>> >> > sun generated exceptions or something to see if they are doing
>>> >> 
>>> >> something
>>> >> 
>>> >> > funky
>>> >> > with the getMessage() call?
>>> >> > 
>>> >> > Is the sample below from the CXF test or the Sun test?
>>> >> > 
>>> >> > Dan
>>> >> > 
>>> >> > On Fri February 12 2010 5:26:51 pm kiffin wrote:
>>> >> >> I have another question on soap fault. I could see the root cause
>>> >> >> returning
>>> >> >> from the soap fault from my Sun JAX-WS service,  but I am not
>>> seeing
>>> >> 
>>> >> it
>>> >> 
>>> >> >> in
>>> >> >> the CXF implementation. Is there a way for CXF to return the root
>>> >> 
>>> >> cause
>>> >> 
>>> >> >> of
>>> >> >> the soap fault to a client?  Here's the example response from my
>>> >> >> test.
>>> >> >> 
>>> >> >> <soap:Envelope
>>> >> >> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>>> >> >> 
>>> >> >>     <soap:Header/>
>>> >> >>     <soap:Body>
>>> >> >>     
>>> >> >>         <soap:Fault>
>>> >> >>         
>>> >> >>             <faultcode>
>>> >> >>             
>>> >> >>                 soap:Server
>>> >> >>             
>>> >> >>             </faultcode>
>>> >> >>             <faultstring>
>>> >> >>             
>>> >> >>                 java.lang.RuntimeException: Mock up exception
>>> >> >>             
>>> >> >>             </faultstring>
>>> >> >>             <detail>
>>> >> >>             
>>> >> >>                 <ns1:ServiceException
>>> >> >> 
>>> >> >> xmlns:ns1="urn:expd.com:service:calculation"/>
>>> >> >> 
>>> >> >>             </detail>
>>> >> >>         
>>> >> >>         </soap:Fault>
>>> >> >>     
>>> >> >>     </soap:Body>
>>> >> >> 
>>> >> >> </soap:Envelope>
>>> >> >> 
>>> >> >> Thanks,
>>> >> >> Kiffin
>>> >> >> 
>>> >> >> dkulp wrote:
>>> >> >> > On Fri February 12 2010 3:06:52 pm kiffin wrote:
>>> >> >> >> Hi. I am porting a Sun JAX-WS service to CXF. Sun has a system
>>> >> >> 
>>> >> >> property
>>> >> >> 
>>> >> >> >> - com.sun.xml.ws.transport.http.client.HttpTransportPipe.dum -
>>> >> 
>>> >> which
>>> >> 
>>> >> >> >> dumps the request/response message on the console. Does CXF
>>> have
>>> >> >> >> an equivalent property to dump the request/response message on
>>> >> >> >> the console?
>>> >> >> > 
>>> >> >> > OK.  Didn't know about that specific property.   Sun seems to
>>> have
>>> >> >> > several properties like that which CXF would respond to, but
>>> that
>>> >> 
>>> >> one
>>> >> 
>>> >> >> > isn't one. I'll add it.
>>> >> >> > 
>>> >> >> > With 2.2.6, you can chose one of:
>>> >> >> > 
>>> >> >> > Boolean.getBoolean("org.apache.cxf.logging.enabled");
>>> >> 
>>> >>
>>> Boolean.getBoolean("com.sun.xml.ws.transport.local.LocalTransportPipe.du
>>> >> 
>>> >> >> m
>>> >> >> 
>>> >> >> > p");
>>> >> 
>>> >>
>>> Boolean.getBoolean("com.sun.xml.ws.util.pipe.StandaloneTubeAssembler.dum
>>> >> 
>>> >> >> > p");
>>> >> 
>>> >> Boolean.getBoolean("com.sun.xml.ws.transport.http.HttpAdapter.dump");
>>> >> 
>>> >> >> > It wouldn't go to the console.  It would go the
>>> java.util.logging,
>>> >> 
>>> >> but
>>> >> 
>>> >> >> by
>>> >> >> 
>>> >> >> > default, that would go to the console.
>> 
>> -- 
>> Daniel Kulp
>> [email protected]
>> http://www.dankulp.com/blog
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump-tp27568694p27614895.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to