2

Years ago, I built a SOAP 1.1 service based upon a WSDL I was given. This was rather basic: I executed Axis' WSDL2Java and used the generated classes as base.

Now I'm told to migrate this service so people can reach it using SOAP 1.2.

What should I change in my WSDL file so my new generated service (still using Axis' WSDL2Java) supports SOAP 1.2?

It's important to understand that I'm service provider: I don't want solutions that only work for clients.

Many thanks!

Olivier Grégoire
  • 33,839
  • 23
  • 96
  • 137

1 Answers1

5

Structurally, you will need to add support of SOAP 1.2 in your WSDL document. Your 'abstract' WSDL part defines the types, messages and portTypes. (I'm assuming here that you want to update your WSDL1.1 doc to add SOAP1.2 support for your existing service)

To support SOAP1.2 you will need to add SOAP1.2-compliant bindings and service definitions. As an example, we have this port definition:

<wsdl:portType name="ServerSoap">
    <wsdl:operation name="SomeOperation"> ...

You will need to add a SOAP1.2 binding section for your operation:

<wsdl:binding name="ServerSoap12" type="tns:ServerSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="SomeOperation">
        <soap12:operation soapAction="..." style="document" /> ...

And a service:

<wsdl:service name="Server">
        <!-- SOAP1.1 Service -->
        <wsdl:port name="ServerSoap" binding="tns:ServerSoap">
        <soap:address location="http://localhost:8080/Server" />
    </wsdl:port>

        <!-- SOAP1.2 Service -->
    <wsdl:port name="ServerSoap12" binding="tns:ServerSoap12">
        <soap12:address location="http://localhost:8080/Server" />
    </wsdl:port>
</wsdl:service>

Note that the two definitions can co-exist and your service can remain backwards compatible with SOAP1.1. The clients will have to make the choice to use SOAP1.1 or SOAP1.2.

In practical terms, you could try generating the WSDL from the code you have, indicating Axis to generate bindings for SOAP1.2. I'm not an AXIS user, so RTM java2wsdl for a way to do that.

maasg
  • 37,100
  • 11
  • 88
  • 115
  • Thank you very much! I have too few time left today to test it out, so I'll try this on Monday. – Olivier Grégoire Jun 24 '11 at 14:49
  • what is `soap12`? where is it described? i have `xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"` but generated web-service supports only soap 1.1 for some reason – 4ntoine Dec 01 '14 at 07:33
  • @4ntoine `soap12` is the namespace alias, defined in the header of the file. Should be something like the declaration you give in your comment. – maasg Dec 01 '14 at 07:44
  • any thoughts why cxf's wsdl2java generated soap 1.1 bindings for soap 1.2 wsdl? http://stackoverflow.com/questions/27191245/how-to-generate-soap-1-2-binding-for-wsdl-using-wsdl2java – 4ntoine Dec 01 '14 at 07:45
  • 1
    @4ntoine no idea. It's (luckily) a very long time since I used SOAP. Life is better now. – maasg Dec 01 '14 at 07:46
  • agree, but some specs like `ONVIF` still use XML – 4ntoine Dec 01 '14 at 07:47