.NET components via ColdFusion – a practical example with v3 Leisure CABS

We recently came across a project where our client, a holiday listing site, wanted to integrate with a third party information provider. Not a problem we said! It turns out that the .NET webservice was something like we had never seen before. There were no arguments or datatypes, just an input of some XML against […]
June 6, 2009 9:16 am

We recently came across a project where our client, a holiday listing site, wanted to integrate with a third party information provider. Not a problem we said! It turns out that the .NET webservice was something like we had never seen before. There were no arguments or datatypes, just an input of some XML against a DTD. This meant that instead of passing in a number of arguments, we had to get just one, the XML that would normally be generated by ColdFusion, wrapped in the SOAP envelope and sent.

If you have had any major dealings with webservices in CF then you will know that there is no fine grain control over how CF puts the SOAP packets together. We tried a few different avenues and quickly discovered that passing a datatype of XML to the webservices resulted in CF running XMLParse over the XML we put in. Clearly not the correct result.

The next (and our last) option was to look at going around the CF SOAP constructor using Java, but with a lack of skills at the time it didn’t seem to be an option. Enter .NET, and the V3 example app. This came with a dll file that did the SOAP wrapping and took some straight XML from the sample application. It was a long shot but hey, we were out of options. So we took the dll and asked CF to open it as a native object. It works brilliantly. To get inside the dll we used Lutz Reflector to find methods and arguments. CF didn’t seem to be able to dump out this information effortlessly.

Once you have hooked up CF to talk with the DLL, it works much like any other object or CFC. Pass in some variables and receive some back. Rinse, and repeat. The result, if you can’t talk to the .NET asmx webservice in a simple XML format, then you need to bypass CF. Java would be able to handle it in most cases, but where the XML was the SOAP body, or the arguments are defined by a DTD, then one of your best options is to make use of the ColdFusion 8 .NET service. Of course it requires that the provider of the service is able to provide you with a .NET component to accept your XML, and wrap it appropriately for you.

Leave a Comment

Login
Log in below to access your courses.
Log In With Google
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.