Wednesday, February 18, 2009

Axis2 - How to set the SOAP Version on a client

There may be instances where you want your Axis2 client to send request in a specific SOAP Version. Axis2 supports both SOAP 1.1 as well as SOAP 1.2. The default used is SOAP 1.2.

Setting the SOAP version can be done as follows, for SOAP 1.1
serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

for SOAP 1.2
serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

1 comments:

Brandon said...

Very useful! Wish the javadoc explained how to do this more clearly. There are numerous constants available, but no clear explanation on how to use them in the axis2 documentation.