Thursday, February 28, 2008

Using ColdFusion with SQL Server XML/SOAP Endpoints

John Jarrad has blogged a very nice explanation on how he got ColdFusion 8 working with SQL Server 2005's XML/SOAP Endpoints. John referenced a few of my older posts like the one about how to use the Apache Commons HTTPClient instead of the built in HTTPSender class.

The interesting thing is that he did not use the HTTPClient library (although using this should have allowed the Digest and NTLM authentication to work since the library supports it) because the HTTPSender class (see source here) does in fact support HTTP 1.1, just not by default. The trick is to set the right property on the web service stub so that the Axis engine does the right thing.

The other note to John's post is that you can use cfinvoke if you want to, but you just have to use cfobject/CreateObject to create the web service "stub" first, then pass that in as the webservice attribute of cfinvoke.

<cfset ws = CreateObject("webservice", "")>
<cfset ws._setProperty("axis.transport.version", "1.1")>
<cfinvoke webservice="ws" method="JJData" returnvariable="result">

John also notes that processing the result set and turning it in to a query is pretty slow. Not sure what is causing this other than there is a large amount of data getting processed.


John J said...

Hey Tom - I chose to not switch the to the Common Lib because I didn't want to mess with the default settings on the CF server. The Common library definitely worked with the SQL Server Endpoints, but I'm in an environment where I have to consume both SQL Server Endpoints and CFCs by way of web services... and I read on your previous post that the alternative HTTP lib doesn't do so well with webservice CFCs.

That's my reasoning... for what it's worth.

Another question - Is there any benefit to using the CFINVOKE tag after setting up with the CFOBJECT tag?

Tom said...

No problem using the default HTTP provider. If it works (and we know the default does) it works.

Nope, no difference at all using cfinvoke or function syntax, which was my point. You can code it any way you prefer - there is absolutely NO difference in functionality. Its just syntax.

Gary said...

When I try to access a SSL webservice it always returns this error

The fault returned when invoking the web service operation is:
AxisFault faultCode: {}
Server.userException faultSubcode: faultString: Connection timed out:

Any suggestions would be greatly appreciated!

airshoes said...

I like your blog. Thank you. They are really great .
Some new style Puma Cat shoes is in fashion this year.
The Nike Air Shoes is a best Air Shoes .
Nike Air Rift is good and Cheap Nike Shoes.
If you are a fans of Puma basket,we would offer the good and Cheap Puma Shoes for you .the cheap ugg bootsis best christmas gift now.
The information age is really convenient .

mikeweezer said...

Hi Tom,

I'm trying to connect to Exchange Web Services and I think my issue is related to NTLM authentication. I changed my client-config.wsdd as described and I'm trying to hit our Exchange server's wsdl file, which I can pull up on a browser on the server here:

I'm trying to use this code, but still get 401 (unauthorized) errors.

I can get to it through the browser, though... thoughts?

Thanks for any help you can offer!


Tom said...


You CFML didn't come through but I would use a TCP monitoring tool (sniffer.exe in the CF runtime/bin directory would work) to verify that the NTLM handshake is happening and I would also check the IIS logs to see why the auth (if there ) is getting rejected.