cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <>
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(
        Greeter greeter = service.getPort(portName, Greeter.class);
        try {
            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) 
            assertEquals("text/xml", contentType);
            Integer responseCode = (Integer) 
            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:
>             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(
>     [java]     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
>     [java]     at org.apache.cxf.interceptor.AbstractFaultChainIntiatorObserver.onMessage(
>     [java]     at org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor.handleMessage(
>     [java]     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
>     [java]     at org.apache.cxf.endpoint.ClientImpl.onMessage(
>     [java]     at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(
>     [java]     at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doClose(
>     [java]     at
>     [java]     at org.apache.cxf.transport.http.HTTPConduit.close(
>     [java]     at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(
>     [java]     at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
>     [java]     at org.apache.cxf.endpoint.ClientImpl.invoke(
>     [java]     at org.apache.cxf.jaxws.EndpointInvocationHandler.invokeSync(
>     [java]     at org.apache.cxf.jaxws.EndpointInvocationHandler.invoke(
>     [java]     at $Proxy34.pingMe(Unknown Source)
>     [java]     at demo.hw.client.Client.main(
>     [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
Making Software Work Together TM

View raw message