Dear all, I am trying to get a spring-ws route (Camel 2.14.0) to populate the SOAP body of the response without annotating the response class with @XmlRootElement. I was hoping that by placing an instance of JAXBElement as the message body this could be done, but no luck. Unless the @XmlRootElement annotation is present the type conversion in org.apache.camel.component.spring.ws.SpringWebserviceConsumer::invoke(MessageContext) fails and returns null. Line 66 ff:
Message responseMessage = exchange.getOut(Message.class); .. // responseBody is null unless @XmlRootElement is present; // Source is javax.xml.transform.Source. Source responseBody = responseMessage.getBody(Source.class); I am looking for a way to return "raw values" and generic list types where I do not even have a class that I could annotate with @XmlRootElement. A sample ObjectFactory method generated by xjc looks like this: @XmlElementDecl(namespace = "http://some.org/my/namespace", name = "addDelegationResponse") public JAXBElement<Integer> createAddDelegationResponse(Integer value) { return new JAXBElement<Integer>(_AddDelegationResponse_QNAME, Integer.class, null, value); } My route looks like this: <route id="addDelegation"> <from uri="spring-ws:soapaction:http://some.org/my/namespace/addDelegation?endpointMapping=#endpointMapping" /> <setExchangePattern pattern="InOut" /> <unmarshal ref="jaxb" /> <bean beanType="ch.vivates.ams.ws.domain.RequestFactory" method="getDelegation" /> <enrich uri="vm:pas-put" /> <!-- ResponseFactory uses ObjectFactory to create JAXBElement --> <bean beanType="ch.vivates.ams.ws.domain.ResponseFactory" method="addDelegationResponse" /> <!-- Response has empty SOAP body because type conversion fails --> </route> Is there another way to do this with spring-ws? Changing the WSDL is not really an option for me at this point. Thanks! Ralf -- View this message in context: http://camel.465427.n5.nabble.com/spring-ws-does-not-marshal-response-message-without-XmlRootElement-tp5759215.html Sent from the Camel - Users mailing list archive at Nabble.com.
