How to convert a WSDL file made for SOAP 1.1 to support SOAP 1.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!
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.
精彩评论