You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by fs <mh...@gmail.com> on 2014/03/04 15:04:34 UTC

Camel CXF - SOAP 1.1 vs SOAP 1.2

Hi,

we have a SOAP 1.2 WSDL and a CXF endpoint configured based on that. 

Everything works fine when there are no exceptions in the integration i.e.
we get back a SOAP 1.2 response as supposed.

But when an exception occurs in the route, it seems that a soap fault is
returned - that is also fine except for the fact that the fault is delivered
on a SOAP 1.1 envelope. We would like to have the soap fault that is based
on the SOAP 1.2 version in this case.

Don't know why this is happening, but if anyone has an idea how to proceed
we'd really appreciate it a lot.

We are using ServiceMix 4.5.3 with Camel 2.10.7 and CXF 2.6.9



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by fs <mh...@gmail.com>.
Yes, the <soap:soapBinding version="1.2"/> seems to do the trick. 

But only after taking the correct namespace
http://cxf.apache.org/blueprint/bindings/soap into use.

Now we get soap fault in the SOAP 1.2 format. 

Thanks a lot for the help!



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285p5748322.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by Willem Jiang <wi...@gmail.com>.
You can setup the soap binding just like this.


<cxf:cxfEndpoint id="myEndpoint" address="http://localhost:${CXFTestSupport.port3}/test"
    serviceClass="org.apache.camel.wsdl_first.Person" serviceName="${CxfEndpointBeans.serviceName}" endpointName="${CxfEndpointBeans.endpointName}"
    wsdlURL="person.wsdl" loggingFeatureEnabled="true" loggingSizeLimit="200">
    <cxf:binding>
         <soap:soapBinding version="1.2"/>
    </cxf:binding>
  </cxf:cxfEndpoint>

or just add below lines to SEI (foo.bar.FooBarPort)

@BindingType(SOAPBinding.SOAP12HTTP_BINDING)

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 5, 2014 at 5:05:25 PM, Willem Jiang (willem.jiang@gmail.com) wrote:
> Can you setup the wsdlUrl attribute of the cxfEndpoint, in this way camel-cxf can pick  
> up right soap binding version for you.
>  
> --
> Willem Jiang
>  
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>  
>  
>  
> On March 5, 2014 at 3:23:38 PM, fs (mhollanti@gmail.com) wrote:
> > Btw, if change the cxf-endpoint dataFormat to PAYLOAD I get the following soap fault.  
> > It seems that the cxf-endpoint is seen as a SOAP 1.1 endpoint for some reason? soap:VersionMismatch  
> > A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint. -- View this message  
> > in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285p5748315.html  
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>  
>  


Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by Willem Jiang <wi...@gmail.com>.
Can you setup the wsdlUrl attribute of the cxfEndpoint, in this way camel-cxf can pick up right soap binding version for you.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 5, 2014 at 3:23:38 PM, fs (mhollanti@gmail.com) wrote:
> Btw, if change the cxf-endpoint dataFormat to PAYLOAD I get the following soap fault.  
> It seems that the cxf-endpoint is seen as a SOAP 1.1 endpoint for some reason? soap:VersionMismatch  
> A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint. -- View this message  
> in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285p5748315.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by fs <mh...@gmail.com>.
Btw, if change the cxf-endpoint dataFormat to PAYLOAD I get the following
soap fault. It seems that the cxf-endpoint is seen as a SOAP 1.1 endpoint
for some reason?

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:VersionMismatch</faultcode>
         <faultstring>A SOAP 1.2 message is not valid when sent to a SOAP
1.1 only endpoint.</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285p5748315.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by fs <mh...@gmail.com>.
Ok, here are the missing code snippets

1. cxf-endpoint configuration in blueprint XML

    <cxf:cxfEndpoint id="foo"
        address="/foobar"
        serviceClass="foo.bar.FooBarPort">
        <cxf:properties>
            <entry key="dataFormat" value="MESSAGE" />
        </cxf:properties>
    </cxf:cxfEndpoint>

2. In the route we use the onException thing

     onException(Exception.class).
            process(new FaultProcessor());

3. And exception is set to exchange in a processor

public class FaultProcessor implements Processor {    
    @Override
    public void process(Exchange exchange) {
        exchange.setException(new RuntimeCamelException()));
    }
}

4. Finally here's the wsdl

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="foo"
    targetNamespace="http://foo.bar"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://foo.bar"
    xmlns:ns="http://foo.bar"
    xmlns:ele="foo.bar/xsd"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
    <types>
        <xsd:schema
            targetNamespace="http://foo.bar">
            <xsd:import namespace="foo.bar/xsd"
                schemaLocation="foo.xsd" />
        </xsd:schema>
    </types>
    <message name="FooRequest">
        <part name="parameters" element="ele:Foo" />
    </message>
    <message name="FooResponse">
        <part name="parameters" element="ele:Foo" />
    </message>
    <portType name="FooBarPort">
        <operation name="Foo">
            <input name="FooRequest"
                message="tns:FooRequest" />
            <output name="FooResponse"
                message="tns:FooResponse" />
        </operation>
    </portType>
    <binding name="FooBarPortBinding" type="tns:FooBarPort">
        <soap12:binding style="document"
            transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
        <operation name="Foo">
            <soap12:operation />
            <input name="FooRequest">
                <soap12:body use="literal" />
            </input>
            <output name="FooResponse">
                <soap12:body use="literal" />
            </output>
        </operation>
    </binding>
    <service name="FooBarService">
        <port name="FooBarPortBindingPort" binding="tns:FooBarPortBinding">
            <soap12:address
                location="http://localhost:${HttpDefaultPort}/service" />
        </port>
    </service>
</definitions>


We have used cxf-codegen-plugin (wsdl2java) for code generation.





--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285p5748314.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by Willem Jiang <wi...@gmail.com>.
We need more information about how did you configure the camel-cxf endpoint.
I guess you were not using POJO data format, and you may need to update the camel-cxf endpoint to let it use SOAP 1.2 binding.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 4, 2014 at 10:05:05 PM, fs (mhollanti@gmail.com) wrote:
>  
> Hi,
>  
> we have a SOAP 1.2 WSDL and a CXF endpoint configured based on that.  
>  
> Everything works fine when there are no exceptions in the integration  
> i.e.
> we get back a SOAP 1.2 response as supposed.
>  
> But when an exception occurs in the route, it seems that a soap  
> fault is
> returned - that is also fine except for the fact that the fault  
> is delivered
> on a SOAP 1.1 envelope. We would like to have the soap fault that  
> is based
> on the SOAP 1.2 version in this case.
>  
> Don't know why this is happening, but if anyone has an idea how  
> to proceed
> we'd really appreciate it a lot.
>  
> We are using ServiceMix 4.5.3 with Camel 2.10.7 and CXF 2.6.9  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-SOAP-1-1-vs-SOAP-1-2-tp5748285.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.  
>  


Re: Camel CXF - SOAP 1.1 vs SOAP 1.2

Posted by Henryk Konsek <he...@gmail.com>.
Hi,

> But when an exception occurs in the route...

Please attach the appropriate route snippets and SOAP messages. It
will increase the chance that somebody here could help you :) .

Cheers.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com