October 26, 2017
Axis-2 and Axis-1 compatibility issues in ColdFusion
Comments
(0)
October 26, 2017
Axis-2 and Axis-1 compatibility issues in ColdFusion
(0)

Note: Due to the recent migration of ColdFusion blogs, some blogs were inadvertently lost during the process. We are recovering the blogs, and as we find out more, we shall republish the blogs here. This blog is one such.

Problem

With ColdFusion, you can use of Axis-2 web services. But you might face issues if you are implementing Axis-2 with Axis-1. Axis-2 services are incompatible with Axis-1 services in ColdFusion due to the difference in WSDLs. 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, if you are publishing your web services using Axis-2, then the web services should be consumed using only Axis-2. Similarly, if you are publishing your web services using Axis-1, then the web services should be consumed using only Axis-1.

Solution

ColdFusion supports backward compatibility with it’s earlier versions. ColdFusion allows you to specify the version of Axis in which web services should be published or consumed. You can control the access at three levels:

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

Publishing a web service

Server level: The option wsversion defines the default version of Axis that will be used to publish the web services in ColdFusion if you have not specified it at the Application/Component level.

The default value of this option is set to ‘2‘, which means by default your web services will be published using Axis-2. You can anytime change it to ‘1‘ if you are facing any issues.

Application level: In Application.cfc, you can specify an attribute, as shown below:

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

Setting this attribute at Application level ensures that all web services in this application are published using this version of Axis, if not already overridden at the component level.Component level: In you WebService component (

Component level: In the web service component (mywebservice.cfc), you can specify the attribute, as shown below:

<cfcomponent wsversion=”1″>

Specifying this attribute ensures that this WebSweb service is published using Axis-1.

Consuming a web service

ColdFusion automatically detects if the web service is published in Axis-2 or Axis-1. If the web service published in Axis-2, ColdFusion consumes it using Axis-2, unless overridden.

 You can, however, override this behavior at two levels if you are certain of the published version:
  1. Application level: In Application.cfc, you can specify an attribute as <cfset this.wssettings.version.consume = “2”>.
    Setting this attribute at the Application level ensures that all web services in this Application are consumed using this version of Axis if not overridden at the component level.
  2. Invoking level: While invoking the web service, you can specify an attribute ‘wsversion‘ to let ColdFusion know 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">

 

Note: This blog was originally written by former Adobe employee.

0 Comments
Add Comment