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 AB853D45B for ; Fri, 18 Jan 2013 10:23:18 +0000 (UTC) Received: (qmail 15333 invoked by uid 500); 18 Jan 2013 10:23:17 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 15134 invoked by uid 500); 18 Jan 2013 10:23:17 -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 15094 invoked by uid 99); 18 Jan 2013 10:23:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jan 2013 10:23:16 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of luckyzhubin@gmail.com designates 74.125.82.177 as permitted sender) Received: from [74.125.82.177] (HELO mail-we0-f177.google.com) (74.125.82.177) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jan 2013 10:23:10 +0000 Received: by mail-we0-f177.google.com with SMTP id x48so764057wey.22 for ; Fri, 18 Jan 2013 02:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=i0XaljdPJSN75fXUbaIA5H3YrCEWP5vtUeLYtkdcDhM=; b=qSGmKYVad+5urSh2PS/Fmh7lr1J9kjMN+HknfdiuODsHquN9+xKEFCO4z6bEeof7sL b2Bl3pD2Aq/ai7mbEEzD3KoNHv1fGGhks9zOPOmwkGu70LTY95oyfLLy8A2KgywnKcpz V/LKOC6h8Ft2ld9GlDVUtk64D1ZRIlNjrMh7cOoBuxLIUuywe0CNjSgd3VJRjtjiFUZP AUOgONauVNFHwARj+HewdG0nddiTik/cNfa3fXWw3u5+Zg3rZgd/mZDvMMP8qGZdedC+ oGdirv3EKbEOPSLXL31VSkrxlz+QH44kY2YMfDp/AiaaYQ/eRE35FVjmPl3bwgjnJpoO BL6g== MIME-Version: 1.0 X-Received: by 10.180.33.202 with SMTP id t10mr2751419wii.3.1358504570121; Fri, 18 Jan 2013 02:22:50 -0800 (PST) Received: by 10.194.137.141 with HTTP; Fri, 18 Jan 2013 02:22:50 -0800 (PST) In-Reply-To: References: Date: Fri, 18 Jan 2013 18:22:50 +0800 Message-ID: Subject: Re: no WebServiceException caught when invoking a method which returns null using the rpc/literal style From: Bin Zhu To: users@cxf.apache.org Cc: dev@cxf.apache.org Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Freeman, Thanks very much for your quick response. I compared my cases and yours today and refined my service implementation as yours, but the problem still exists in my test. Finally, I tried to migrate your cases to my CXF env(2.6.2), and the problem still exist: Client will not catch the WebServiceException while the server will throw the Fault as following: Interceptor for {http://apache.org/hello_world_rpclit}SOAPServiceRPCLit#{http://apache.org/= hello_world_rpclit}greetMe has thrown exception, unwinding now Cannot write part out. RPC/Literal parts cannot be null. (WS-I BP R2211). I'm wondering is it possible that this is an issue specific to CXF2.6.2? As now I don't has other CXF version env, I didn't test it on other CXF version yet. Will try to set up new env with higher CXF version and verify it in future. One thing I want to mention is this issue only exists when invoking the return null method but not the null parameter method. If client call a method with a null parameter, then there will be the WebServiceException caught in the client side. As the invoking and implementation of return null method and null parameter method is similar in my case, so it seems that there should be no problem with my usage in the return null method scenario. Thanks. 2013/1/17, Freeman Fang : > 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 > > > =A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD=A3=AD= =A3=AD > Freeman(Yue) Fang > > Red Hat, Inc. > 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=D0=A1=CE=DD > > On 2013-1-17, at =CF=C2=CE=E71: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. >> >> 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: >> 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); >> >> 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:soap=3D"http://schemas.xmlsoap.org/soap/envelope/">> xmlns:ns1=3D"http://serverrpc.testdata.soapbinding.annotations/">soap:ServerCannot >> write part return. RPC/Literal parts cannot be null. (WS-I BP >> R2211)" >> >> Related code in >> /cxf-rt-bindings-soap/src/main/java/org/apache/cxf/binding/soap/intercep= tor/RPCOutInterceptor.java >> >> 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", >> >> LOG, part.getConcreteName())); >> } > >