thecfguy

A Unique Developer

The fault returned when invoking .Net webservice through ColdFusion.

Recently working with remote webservice call build on .Net platform and calling from ColdFusion and it return following error
The fault returned when invoking the web service operation is:

org.apache.axis2.AxisFault: BarCodeParam cannot be null!!

 

For blogging I have use open .Net webservice to generate barcode for given string. As generateBarCode function taking two argument and first one is complex type which obviously  need to pass as structure as per ColdFusion specification. 

	
	       ws = createObject ("webservice" ,"http://www.webservicex.net/genericbarcode.asmx?WSDL" , {  refreshWSDL=true });
	       arg1 = {
	              Height = 100,
	              Width = 100,
	              Angle = 0,
	              Ratio = 10,
	              Module = 1,
	               Left = 1,
	              Top = 1,
	              CheckSum = false,
	              FontName = "Arial" ,
	              BarColor = "Black" ,
	              BGColor = "White" ,
	              FontSize = 10,
	              barcodeOption = "Code" ,
	              barcodeType = "Code39" ,
	              checkSumMethod = "None" ,
	              showTextPosition = "TopLeft" ,
	              BarCodeImageFormat= "PNG"
	       };
	       barcode = ws.GenerateBarCode(arg1, "98443294" );
	
	

Pretty simple, but got above error when tried to execute it. Although code work fine with me in ColdFusion 9 but not in ColdFusion 10. Well, this is because ColdFuson 10 support wsdl 1.1 and 2.0 and also SOAP 1.1 and SOAP 1.2 protocol. And default wsdl version is 2 and this is creating issue. To resolve issue you just need to pass extra parameter wsversion= 1 in third argument structure and your statement like below. (Yes this new parameter support in ColdFusion 10 though it isn't mention in ColdFusion documentation)

	ws = createObject ("webservice" ,"http://www.webservicex.net/genericbarcode.asmx?WSDL" , {  refreshWSDL=true,wsversion= 1 });
	

Hope this help.