cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@iona.com>
Subject Re: [jira] Created: (CXF-194) Fault doesn't work in xml binding
Date Wed, 01 Nov 2006 10:38:41 GMT

after investigate xml fault system test case

public void testXMLFault() throws Exception {
        XMLService service = new XMLService(
                this.getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl"), 
serviceName);
        assertNotNull(service);
        Greeter greeter = service.getPort(portName, Greeter.class);
        try {
            greeter.pingMe();
            fail("did not catch expected PingMeFault exception");
        } catch (PingMeFault ex) {
            assertEquals("minor value", 1, ex.getFaultInfo().getMinor());
            assertEquals("major value", 2, ex.getFaultInfo().getMajor());
             BindingProvider bp = (BindingProvider)greeter;
            Map<String, Object> responseContext = bp.getResponseContext();
            String contentType = (String) 
responseContext.get(Message.CONTENT_TYPE);
            assertEquals("text/xml", contentType);
            Integer responseCode = (Integer) 
responseContext.get(Message.RESPONSE_CODE);
            assertEquals(500, responseCode.intValue());
        } catch (Exception ex) {
            assertTrue("did not catch expected PingMeFault exception",
                      !(ex instanceof PingMeFault));
        }
    }

found that this test in fact cannot guarantee Fault works for xml 
binding, that's why system test pass but demo failed

assertTrue("did not catch expected PingMeFault exception",
                      !(ex instanceof PingMeFault));
should be change to fail("did not catch expected PingMeFault exception");
since only PingMeFault is expected here

Freeman Fang (JIRA) wrote:

>Fault doesn't work in xml binding
>---------------------------------
>
>                 Key: CXF-194
>                 URL: http://issues.apache.org/jira/browse/CXF-194
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.0-M1
>            Reporter: Freeman Fang
>             Fix For: 2.0-M1
>
>
>when I run hello_world_xml_wrapped sample, I get exception like
>
>     [java] Exception in thread "main" org.apache.cxf.binding.xml.XMLFault: org.apache.hello_world_xml_http.wrapped.PingMeFault:
PingMeFault raised by server     [java]     at org.apache.cxf.binding.xml.interceptor.XMLFaultInInterceptor.handleMessage(XMLFaultInInterceptor.java:61)
>     [java]     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
>     [java]     at org.apache.cxf.interceptor.AbstractFaultChainIntiatorObserver.onMessage(AbstractFaultChainIntiatorObserver.java:75)
>     [java]     at org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor.handleMessage(XMLMessageInInterceptor.java:85)
>     [java]     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
>     [java]     at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:245)
>     [java]     at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:476)
>     [java]     at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doClose(HTTPConduit.java:443)
>     [java]     at org.apache.cxf.io.AbstractCachedOutputStream.close(AbstractCachedOutputStream.java:80)
>     [java]     at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:251)
>     [java]     at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:58)
>     [java]     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:147)
>     [java]     at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:143)
>     [java]     at org.apache.cxf.jaxws.EndpointInvocationHandler.invokeSync(EndpointInvocationHandler.java:128)
>     [java]     at org.apache.cxf.jaxws.EndpointInvocationHandler.invoke(EndpointInvocationHandler.java:114)
>     [java]     at $Proxy34.pingMe(Unknown Source)
>     [java]     at demo.hw.client.Client.main(Client.java:78)
>     [java] Java Result: 1
>
>seems Fault doesn't work now in xml binding. I guess someone change something occasionally
cause this problem since I remember it should be fine days before
>
>  
>


-- 
Freeman Fang
Software Engineer

IONA Asia Pacific Software Development Center
No.2 Floor A Unit Information Center
Zhongguancun Software Park Haidian District,
Beijing, P.R.China

Tel.: +86-10-82825151 -  ex. 551
Fax: +86-10-8282-5210
freeman.fang@iona.com
-------------------------------------------------
Making Software Work Together TM




Mime
View raw message