Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E7E2104E4 for ; Wed, 12 Feb 2014 15:35:52 +0000 (UTC) Received: (qmail 46144 invoked by uid 500); 12 Feb 2014 15:35:51 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 46065 invoked by uid 500); 12 Feb 2014 15:35:49 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 46048 invoked by uid 99); 12 Feb 2014 15:35:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Feb 2014 15:35:48 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=NORMAL_HTTP_TO_IP,SPF_SOFTFAIL,URI_HEX,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of rampugh@gmail.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Feb 2014 15:35:44 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WDbqM-0006VR-VF for users@camel.apache.org; Wed, 12 Feb 2014 07:35:23 -0800 Date: Wed, 12 Feb 2014 07:35:22 -0800 (PST) From: Chubutin To: users@camel.apache.org Message-ID: <1392219322960-5747194.post@n5.nabble.com> Subject: How to return null element with Camel-CXF MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi! I'm having problems when I try to return a null element in SOAP response. When I send a null body as response to CXF Bean, this Bean doesn't create a null response and return that null element to the response. So, i want to return a null element in the response but I can't. If I test the service with mocks I can see if the response is [1] This will get a null element in the response and this is what I want. But, CXF doesn't make that response with any element in the body response. My camel route with CXF consumer, processors, http call and xslt this is my route params_tos GET (this is setBody(xpath("/*")) I use a dataformat at the end to Marshall the XML after the XSLT. When I send null to the dataformat it get an exception. After the xslt transformation I send many thing to test, but I cant get figure what to configure in my service to response a null response. like [1] I only can response a not null response, like My CXF bean is The SEI of The service is @WebService(name = "VesselVisitorsService") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED, style = Style.DOCUMENT, use = Use.LITERAL) public interface com.esb.service.vessel.VesselVisitorsService { @WebMethod(operationName = "getByName") @RequestWrapper(localName = "visitorName") @ResponseWrapper(localName = "getByNameResponse") @WebResult(name = "vesselVisitor") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED, style = Style.DOCUMENT, use = Use.LITERAL) public VesselVisitor getByName( @WebParam(name = "vesselName") String vesselName) throws ServiceException; In org.apache.cxf.databinding.AbstractWrapperHelper Object wrapperObject = createWrapperObject(wrapperType); for (int x = 0; x < setMethods.length; x++) { if (getMethods[x] == null && setMethods[x] == null && fields[x] == null) { //this part is a header or something //that is not part of the wrapper. continue; } * Object o = lst.get(x); [2]* o = getPartObject(x, o); if (o instanceof List && getMethods[x] != null) { List col = CastUtils.cast((List)getMethods[x].invoke(wrapperObject)); if (col == null) { //broken generated java wrappers if (setMethods[x] != null) { setMethods[x].invoke(wrapperObject, o); } else { fields[x].set(wrapperObject, lst.get(x)); } } else { List olst = CastUtils.cast((List)o); col.addAll(olst); } } else if (setMethods[x] != null) { setMethods[x].invoke(wrapperObject, o); } else if (fields[x] != null) { fields[x].set(wrapperObject, lst.get(x)); } } The line remarked is what get the NPE. So in debugging I initialized a List and put a null element to the list. And with this I had a null valid response! So, Does I always have to response with a list with a element inside the wrapper to make a null response? Thank you! -- View this message in context: http://camel.465427.n5.nabble.com/How-to-return-null-element-with-Camel-CXF-tp5747194.html Sent from the Camel - Users mailing list archive at Nabble.com.