Return-Path: X-Original-To: apmail-cxf-dev-archive@www.apache.org Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C029FEB5A for ; Thu, 17 Jan 2013 06:29:06 +0000 (UTC) Received: (qmail 18218 invoked by uid 500); 17 Jan 2013 06:29:04 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 17677 invoked by uid 500); 17 Jan 2013 06:29:03 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 17648 invoked by uid 99); 17 Jan 2013 06:29:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jan 2013 06:29:02 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of freeman.fang@gmail.com designates 209.85.210.49 as permitted sender) Received: from [209.85.210.49] (HELO mail-da0-f49.google.com) (209.85.210.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Jan 2013 06:28:55 +0000 Received: by mail-da0-f49.google.com with SMTP id v40so949116dad.8 for ; Wed, 16 Jan 2013 22:28:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:mime-version:content-type:from:in-reply-to:date :cc:message-id:references:to:x-mailer; bh=/ojzHAuMHH5mg0BOzJtwqFjmGbHo5WzLBBMaP2WCGBw=; b=uohnI88LNhYq4dPzNW6feyb86SL+v4E9+JH5mmUZAKE9GkfWGLWuD0aOxB8n5pxLv6 yiGB8zKDq7vvTee19WZk0C4VTJTC7q5qemIgdiM2qGqgd6FgYTOsDhqf50/f5QNbIN/M FyJxBXQRfeml0HSbyFV2YgIdoA6V+mMpgzynH1GBXzFxaeTtKmSbIWKAk0oALp3evVZe G+QoqRtcbYsdO//LrSmWIWF/wcD7uatW1HaLw0e+bftOre+z7O8HWRPk6xWKNCFNyyA+ RRRn6zH5hjfOuL450k3UU+4F5dX7Iz8APgFAz4NJg+jhPIvL5gGhbi3ZF+TyyDlaXp8J Jbcw== X-Received: by 10.68.197.135 with SMTP id iu7mr10366956pbc.71.1358404113429; Wed, 16 Jan 2013 22:28:33 -0800 (PST) Received: from [192.168.1.102] ([123.119.244.123]) by mx.google.com with ESMTPS id a1sm587666pav.2.2013.01.16.22.28.28 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jan 2013 22:28:32 -0800 (PST) Subject: Re: no WebServiceException caught when invoking a method which returns null using the rpc/literal style Mime-Version: 1.0 (Apple Message framework v1280) Content-Type: multipart/alternative; boundary="Apple-Mail=_07FEA389-75F0-4B55-8FED-FCAC9752EBB1" From: Freeman Fang In-Reply-To: Date: Thu, 17 Jan 2013 14:28:22 +0800 Cc: users Message-Id: References: To: dev@cxf.apache.org X-Mailer: Apple Mail (2.1280) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_07FEA389-75F0-4B55-8FED-FCAC9752EBB1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, I just added a test[1] which demonstrate how cxf follow this spec. = Please take a look. [1]http://svn.apache.org/viewvc?rev=3D1434564&view=3Drev =EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF= =BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D=EF=BC=8D Freeman(Yue) Fang Red Hat, Inc.=20 FuseSource is now part of Red Hat Web: http://fusesource.com | http://www.redhat.com/ Twitter: freemanfang Blog: http://freemanfang.blogspot.com http://blog.sina.com.cn/u/1473905042 weibo: @Freeman=E5=B0=8F=E5=B1=8B On 2013-1-17, at =E4=B8=8B=E5=8D=881:27, Bin Zhu wrote: > Hi all, > Accdoring to jsr224 3.6.2.3, 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. >=20 > 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? >=20 > Here is the test code: > try{ > System.out.flush(); System.err.flush(); > System.out.println("invoking method that returns null, > expecting exception"); > System.out.println("s.returnNull=3D"+s.returnNull("hello > there null")); > } catch (WebServiceException e){ > System.out.println("caught expected = WebserviceException"); > e.printStackTrace(); > System.out.flush(); System.err.flush(); > ok =3D true; > } > Assert.assertTrue("Wrong/No exception received for null > return", ok); >=20 > 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: > = xmlns:ns1=3D"http://serverrpc.testdata.soapbinding.annotations/">soap:ServerCannot > write part return. RPC/Literal parts cannot be null. (WS-I BP > = R2211)" >=20 > Related code in > = /cxf-rt-bindings-soap/src/main/java/org/apache/cxf/binding/soap/intercepto= r/RPCOutInterceptor.java >=20 > if (objs.hasValue(part)) { > Object o =3D objs.get(part); > if (o =3D=3D null) { > //WSI-BP R2211 - RPC/Lit parts are not allowed > to be xsi:nil > throw new Fault( > new > org.apache.cxf.common.i18n.Message("BP_2211_RPCLIT_CANNOT_BE_NULL", >=20 > LOG, part.getConcreteName())); > } --Apple-Mail=_07FEA389-75F0-4B55-8FED-FCAC9752EBB1--