Friday 13 July 2012

Axis-2 and Axis-1 compatibility issues

 Axis-2 and Axis-1 compatibility issues


Problem:

With ColdFusion 10 you can leverage power of Axis-2 WebServices. But you might get into issues if you are mixing Axis-2 with Axis-1. Axis-2 services are incompatible with Axis-1 services in ColdFusion because of the way their WSDL's are formed. Though by design Axis-1 and Axis-2 are compatible but in ColdFusion you might run into issues if you are using ColdFusion complex data types.

Since Axis-1 and Axis-2 are incompatible in ColdFusion, this means that if you are publishing your WebServices using Axis-2, then they should be consumed using Axis-2 only. Similarly if you are publishing your WebServices using Axis-1 then they should be consumed using Axis-1 only.

ColdFusion 10 Solution:

ColdFusion has taken all the measures to support backward compatibility with it's earlier versions. ColdFusion allows you to specify the version of Axis in which WebServices should be published or consumed. ColdFusion has given a control at three levels:

  1. Server level
  2. Application level
  3. Component level

Publishing

  1. Server level: In ColdFusion 10 WebServices administrator page there is a new setting called as wsversion. This setting defines the default version of Axis that will be used to publish the WebServices in ColdFusion if you have not specified it at Application/Component level.

    Default value of this setting is set to '2', which means by default your WebServices will be published using Axis-2. You can anytime change it to '1' if you are facing the problems.

    This will be very handy if you are consuming all your WebServices from ColdFusion 9. In ColdFusion 9 Axis-2 is not supported and hence your WebServices will be consume by Axis-1 only, so that is why if all your WebServices are consumed in ColdFusion 9 then you can set this to default '1' for whole server.
  2. Application level: In Application.cfc you can specify an attribute as this:

    <cfset this.wssettings.version.publish = "2">

    Setting this attribute at Application level will ensure that all WebServices in this Application will be published using this version of Axis if not overridden at component level.
  3. Component level: In you WebService component (mywebservice.cfc) you can specify this attribute as this:

    <cfcomponent wsversion="1">Specifying this attribute will ensure that this WebService will be published using Axis-1

Consuming

ColdFusion understands that WebServices could be published from any platform and can be consumed from CF so to make it easy CF automatically detects if the service is published in Axis-2 or Axis-1. If it's published in Axis-2, CF will consume it using Axis-2 unless overridden and same goes for Axis-1 too.

You can however override this behavior if you are very sure of the published verison, at two levels:
  1. Application level: In Application.cfc you can specify an attribute as this:

    <cfset this.wssettings.version.consume = "2">Setting this attribute at Application level will ensure that all WebServices in this Application will be consumed using this version of Axis if not overridden at component level.
  2. Invoking level: While invoking the WebService you can specify an attribute 'wsversion' to tell CF from which version the Service should be consumed.

    ws=createObject("webservice","http://localhost:8500/mycfc.cfc?wsdl",{wsversion="2"})
    <cfinvoke webservice = "http://localhost:8500/mycfc.cfc?wsdl" method="echo" wsversion="2" returnVariable="foo" >


I am sure that if you read this post, you will never stuck in Axis-1/Axis-2 compatibility issues.
Specially it is a must for any user who is publishing WebService as in ColdFusion 10 but consuming them in ColdFusion 9 or earlier releases. It's because in CF 10 by default Axis-2 will be used whereas in earlier CF releases only Axis-1 was supported, so you might run into issues if will not take measures.

3 comments:

  1. As a Axis2 team member I would like clarify about client usage, if the service published using Axis2 then you can could use any WS client technologies (or languages) to consume exposed services there is no limitation in such way that exposed services only support for Axis2 clients. Axis2 expose WS-I BP 1.0 complaint services hence services can be consumed with any WS-I BP 1.0 compliant tool or client side technologies. In very initial development level we have conducted number of interoperability tests with other platform including .NET , PHP, C etc.

    ReplyDelete
    Replies
    1. Thanks for your input. I will get back to you as soon as I can.

      Delete
    2. Sagara, based on your input I have updated the very first paragraph of my post which should remove possibilities of any confusion. Though Axis-1 and Axis-2 are compatible but what I wanted to say is that they are not compatible in ColdFusion because of the way their schemas are represented in WSDL. I hope this is much clearer now.

      Delete