cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bin Zhu <>
Subject no WebServiceException caught when invoking a method which returns null using the rpc/literal style
Date Thu, 17 Jan 2013 05:27:49 GMT
Hi all,
Accdoring to jsr224, due to the limitations described in
section 5.3.1 of theWS-I Basic Profile specification (see [8]), null
values cannot be used as method arguments or as the return value from
a method which uses the rpc/literal binding.
 (Null Values in rpc/literal): If a null value is passed as an
argument to amethod, or returned
from amethod, that uses the rpc/literal style, then an implementation
MUST throw a WebServiceException.

However, in my test application using CXF 2.6.2, when when invoking a
method which returns null using the rpc/literal style, their will be
no  WebServiceException caught. Is this possible an issue in CXF?

Here is the test code:
                System.out.flush(); System.err.flush();
                System.out.println("invoking method that returns null,
expecting exception");
there null"));
            } catch (WebServiceException e){
                System.out.println("caught expected WebserviceException");
                System.out.flush(); System.err.flush();
                ok = true;
             Assert.assertTrue("Wrong/No exception received for null
return", ok);

I looked into the SOAP message/CXF code, there is Fault thrown in CXF,
however, the test code can't get the WebServiceException as requested
in the spec.
SOAP message:
<soap:Envelope xmlns:soap=""><soap:Body><ns1:returnNullResponse
write part return. RPC/Literal parts cannot be null. (WS-I BP

Related code in

                if (objs.hasValue(part)) {
                    Object o = objs.get(part);
                    if (o == null) {
                        //WSI-BP R2211 - RPC/Lit parts are not allowed
to be xsi:nil
                        throw new Fault(

LOG, part.getConcreteName()));

View raw message