Today I had a request from a valued customer to troubleshoot an issue with a web-service driven feature in their in-house CF-based sales system that stopped working after a server upgrade that saw them move from CF8 to CF10 and an OS upgrade to Win Server 2012 and hence, IIS8.
The previously written CFC that consumed the external web-service was a simple affair of the form:
1 2 3 4 | <cfscript> ws = CreateObject("webservice", "http://example.com/WebServices/example.asmx?wsdl"); rslt = ws.GetExampleData("#arg1#","#arg2#"); </cfscript> |
After the upgrade, any attempt to run the code caused an Axis2 501 error:
org.apache.axis2.AxisFault: Transport error: 501 Error: Not Implemented
Upon further investigation, this error suggests the HTTP protocol being used is not implemented by the web-service being consumed. The solution, it seemed, would be to find a way for force the protocol being used to HTTP/1.0. Further Googling of the Apache Axis2 methods and constant values, plus how CF10 handles creating web service stubs, the final solution was a simple extra line of code:
1 2 3 4 5 | <cfscript> ws = CreateObject("webservice", "http://example.com/WebServices/example.asmx?wsdl"); ws._getServiceClient().getOptions().setProperty("__HTTP_PROTOCOL_VERSION__", "HTTP/1.0"); rslt = ws.GetExampleData("#arg1#","#arg2#"); </cfscript> |
Hopefully that will be of use to anyone struggling with the same issue!
Recent Comments