Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 35852 invoked from network); 30 Nov 2009 19:09:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Nov 2009 19:09:33 -0000 Received: (qmail 74869 invoked by uid 500); 30 Nov 2009 19:09:32 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 74765 invoked by uid 500); 30 Nov 2009 19:09:32 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 74755 invoked by uid 99); 30 Nov 2009 19:09:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2009 19:09:32 +0000 X-ASF-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [69.147.102.76] (HELO smtp113.plus.mail.re1.yahoo.com) (69.147.102.76) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 30 Nov 2009 19:09:29 +0000 Received: (qmail 42407 invoked from network); 30 Nov 2009 19:09:02 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.gr; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=DKii4TGnO6fX7HOkTKLGxRxSCRsRlhOMs6K09ae8qwaTfCpB5zRSl+W4TwRqw/7vgPnQZMgQoyescFB+2KE+aE0T6eCkI+yKmQ/Ynx9zpn1iELDVUKxhgxRWR5ruZ/+ZZo25WYapKzgOZJsha5+N9EArh6DhInGaGO9jbhEiPxI= ; Received: from cust-87-227.on4.ontelecoms.gr (akarypid@92.118.87.227 with plain) by smtp113.plus.mail.re1.yahoo.com with SMTP; 30 Nov 2009 11:09:01 -0800 PST X-Yahoo-SMTP: zqOro8aswBATGnFGyBkfgkPClVMj X-YMail-OSG: Nb9rG0sVM1kZkdEtDbnjPlv9k6bhS0.UTbBzdXPAlCVL.J3qrQBNPLP1767ajwYKiCRFgh4RxAKJjOIgglIuzF72JeonbgzFjO4WLRk4xmF5CuBdABMIm3S.K2QhQ7p7upRs2pUI_qw7LHyASPvBlnN0SNtiOZV8wPQSklerbrABNZFM3uAxoGiWkccEL2yr3rrLGLE2O8YSkwP7kuYuQRxA3Dq_ul80trfEVedgSc7hBX3_Ao11SDqiCKPP85AJy.AHJdSFc.9.nzjRqq9Fh1cdF.152sAkzhokyiekz17F6XzeXHNjTtp3p9NdmgBwMc9qX4lmCYfTH4y0mIGQJDj7L5H5hYdiL18H6fuG1fSJZhVDt_uZjIA5sshnX.WTuWfaKK6xvdpb7._1QtkklvhKmxKF7KCMdq_k0tlL5Z.Z3lrM8THZN37eaELj4S_GHwq_ljzeNfy50PJCago8VBJMFWM8movOEQ-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4B14184D.4050904@yahoo.gr> Date: Mon, 30 Nov 2009 21:09:01 +0200 From: Alexandros Karypidis User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: users@cxf.apache.org Subject: Re: NPE caused by cxf-rt-ws-policy with WS-Addressing policy in WSDL References: <4B140D9C.3060900@yahoo.gr> In-Reply-To: <4B140D9C.3060900@yahoo.gr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ok, I've been reading through the source code of CXF and found that the error seems to be related with the service mode and the SAAJ interceptor. This may be a bug, so if someone more knowledgable could help out in isolating, please read on (note that the references to CXF sources are from the 2.2.4 release): When the endpoint uses "message" mode: @WebServiceProvider(...) > @ServiceMode(Mode.MESSAGE) @BindingType(value = HTTPBinding.HTTP_BINDING) public class MyServiceProvider implements Provider { ... Then the "org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor" will behave as follows (LINE 81): if (saajOut != null) { doSoap(message); Where (LINE 147): private void doSoap(Message message) { MessageContentsList list = (MessageContentsList)message.getContent(List.class); Object o = list.get(0); The NPE is because "message.getContent(List.class);" returns null in this case. I believe doSoap() should be re-written as: private void doSoap(Message message) { MessageContentsList list = (MessageContentsList)message.getContent(List.class); if(list != null) { // =========== do nothing if there is no content Object o = list.get(0); if (o instanceof SOAPMessage) { SOAPMessage soapMessage = (SOAPMessage)o; if (soapMessage.countAttachments() > 0) { message.put("write.attachments", Boolean.TRUE); } } message.getInterceptorChain().add(internal); } // =========== end of addition } Does this sound right? Alexandros Karypidis wrote: > Hi, > > I need some help with WS-Policy in CXF 2.2.4 > > I have been fighting to enable WS-Addressing using the WS-Addressing > Metadata policy assertions. I attahed a policy in my WSDL with: > xmlns:wsp='http://www.w3.org/ns/ws-policy'> > xmlns:wsam='http://www.w3.org/2007/05/addressing/metadata' > > > > > > Now, I have two separate CXF applications (the provider-app and the > client-app). Both activate the policy framework by: > 1) Adding a dependency in their pom.xml to "cxf-rt-ws-policy" > 2) Including in their spring "beans.xml" an > resource="classpath:META-INF/cxf/cxf-extension-policy.xml" /> > > The problem is that when the provider has WS-Policy enabled, the > MAPAggregator throws an NPE. > > So, if I do (1) and (2) for both the "client WAR" and the "provider > WAR", I get an NPE at the provider-side, while the incoming request is > being processed. If I remove (1) and (2), the policy still gets parsed > properly and Addressing headers are added by CXF in the client, > without the provider complaining. I assume that in this case the > addressing interceptors are not added to the endpoint of the provider, > so it doesn't attempt to process the WS-Addressing headers, thus > avoiding the NPE. > > The NullPointerException is thrown while the server processes the > request at: > java.lang.NullPointerException > at > org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor.doSoap(MessageModeOutInterceptor.java:149) > > at > org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor.handleMessage(MessageModeOutInterceptor.java:82) > > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236) > > at > org.apache.cxf.ws.addressing.ContextUtils.rebaseResponse(ContextUtils.java:380) > > at > org.apache.cxf.ws.addressing.MAPAggregator.mediate(MAPAggregator.java:355) > > ... > I looked at the CXF code and the catch() block which prints out the > above stack trace also logs: > WARNING: SERVER_TRANSPORT_REBASE_FAILURE_MSG > > I'm using CXF 2.2.4 / Sun JDK 1.6.0_16 and get the same error when > deploying the "provider-app" on: > > - Tomcat 6.0.20 > - JBoss 5.1 > - WebLogic 10.3.2 > > Any ideas what could be wrong?