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] <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ves="http://service.esb.com/"> <soapenv:Header/> <soapenv:Body> <ves:getByNameResponse/> </soapenv:Body> </soapenv:Envelope> 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 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <route group="com.esb.camel.route.InternalGetRouteBuilder" id="searchByNameRouteGET" xmlns="http://camel.apache.org/schema/spring"> <from uri="cxf:bean:getConsumerEndpoint"/> <to uri="getByNamePreProcessor"/> <setHeader headerName="CamelHttpQuery"> <property>params_tos</property> </setHeader> <setHeader headerName="CamelHttpMethod"> <simple>GET</simple> </setHeader> <setBody> <expressionDefinition/> (this is setBody(xpath("/*")) </setBody> <to uri="http://192.168.16.201:10080/apex/api/query?authUsername=n4api&authPassword=lookitup&authMethod=Basic&httpClient.authenticationPreemptive=true"/> <to uri="xslt:xslt/transformationByNameXSLT.xslt?failOnNullBody=false"/> <unmarshal> <protobuf xsi:type="dataFormat" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> </unmarshal> </route> 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 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ves="http://vessel.service.esb.com/"> <soapenv:Header/> <soapenv:Body> <ves:getVesselVisitByNameResponse> <vesselVisitor/> </ves:getVesselVisitByNameResponse> </soapenv:Body> </soapenv:Envelope> My CXF bean is <camelcxf:cxfEndpoint id="getConsumerEndpoint" serviceClass="com.esb.service.vessel.VesselVisitorsService" address="/vesselVisitorsService"> <camelcxf:properties> <entry key="dataFormat" value="POJO" /> </camelcxf:properties> </camelcxf:cxfEndpoint> 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.