Hi Freeman, Yep, interceptor fixes the problem!
Regards, Andrei. -----Original Message----- From: Freeman Fang [mailto:freeman.f...@gmail.com] Sent: 17 October 2011 13:28 To: users@camel.apache.org Subject: Re: Camel CXF component: SOAP 1.1 & 1.2 support Hi, My gut feeling is that this issue is kinda of similar with the one I encountered with servicemix-cxf-bc JBI component(which means only determine soap version from the servicemodel but ignore the real incoming message), could you do a quick test here? You can add an outInterceptor for your camel-cxf endpoint, the interceptor should be like import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.phase.Phase; public class SetSoapVersionInterceptor extends AbstractSoapInterceptor { public SetSoapVersionInterceptor() { super(Phase.WRITE); addBefore(SoapOutInterceptor.class.getName()); } public void handleMessage(SoapMessage message) throws Fault { if (message.getExchange() != null) { if (message.getExchange().getInMessage() instanceof SoapMessage) { ((SoapMessage )message ).setVersion (((SoapMessage)message.getExchange().getInMessage()).getVersion()); } } } } Tell me if this can fix it. Freeman On 2011-10-17, at 下午6:50, Andrei Shakirin wrote: > Hi, > > I have a small issue with Camel CXF component supporting both SOAP > bindings: 1.1 and 1.2. > > If I take pure CXF service and specify: > > @ServiceMode(value = Service.Mode.MESSAGE) @BindingType(value = > "http://www.w3.org/2003/05/soap/bindings/HTTP/") > > this CXF Service accepts both kind of requests: SOAP 1.1 & SOAP 1.2 > and expects appropriate responses: SOAP 1.1 response for SOAP 1.1 > request and SOAP 1.2 response for SOAP 1.1 request. It works as > expected. > > If I take Camel CXF component and specify the same annotations for > the interface, I have the following behavior: > all requests (1.1 & 1.2) is still accepted, but I can provide ONLY > 1.2 responses and faults. > If I try to set 1.1 response as answer for 1.1 request: > exchange.getOut().setBody(response, StaxSource.class); the following > exception is throwing: > > 11:46:27,411 | WARN | qtp25691505-91 | > PhaseInterceptorChain | ache.cxf.comm > on.logging.LogUtils 371 | - - | Interceptor for > {http://com.dpdhl/cig/facade/v1 }WSFaca > de#{http://facade.cig.dpdhl.com/}invoke has thrown exception, > unwinding now > org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made > to insert a node wher e it is not permitted. > at > com > .sun > .org > .apache.xerces.internal.dom.CoreDocumentImpl.insertBefore(CoreDocume > ntImpl.java:391)[:1.6.0_22] > at > com > .sun > .org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java: > 235)[ > :1.6.0_22] > at > com > .sun > .xml.messaging.saaj.soap.SOAPPartImpl.appendChild(SOAPPartImpl.java: > 502) > [67:org.apache.servicemix.bundles.saaj-impl:1.3.2.2] > at > org > .apache > .cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.java:11 > 4)[132:org.apache.cxf.bundle:2.4.2] > > Absolutely the same exception is thrown in pure CXF provider if I send > wrong version of response (for example 1.1 response for 1.2 request). > > Question: is there any possibility to say Camel CXF component that it > should accept SOAP 1.1 Response as answer to SOAP 1.1 Request? > Sample code illustrating the problem can be provided if necessary. > > Regards, > Andrei. > --------------------------------------------- Freeman Fang FuseSource Email:ff...@fusesource.com Web: fusesource.com Twitter: freemanfang Blog: http://freemanfang.blogspot.com