Wednesday, June 28, 2006

ColdFusion auto WSDL generation weird behaviour

ColdFusion auto generates WSDL's for web services. When it does this, it has to provide a name for the web service. The servie name is defined as follows in the wsdl:

<wsdl:service name="myAPIService">
<wsdl:port binding="impl:myAPI.cfcSoapBinding" name="myAPI.cfc">
<wsdlsoap:address location="http://www.somedomain.com/myAPI.cfc" />
</wsdl:port>
</wsdl:service>

The weird behaviour that I have observed is that the name it gives can be with different case on different ocassions. For example in above service I have seen names like:
myAPIService
MyAPIService
myapiService

all for the same cfc on the same server. The difference I found was the way the wsdl was called the first time after a change had been made to the cfc. So if, I called the wsdl as:
http://www.somedomain.com/myAPI.cfc?wsdl
the service name would be myAPIService

If wsdl was http://www.somedomain.com/MyAPI.cfc?wsdl
the service name would be MyAPIService

If wsdl was http://www.somedomain.com/myapi.cfc?wsdl
the service name would be myapiService

Now this can create many problems when calling your webservice from other platforms. I resolved this by always calling the wsdl immediately after making changes to it in the format I wanted.

No comments: