I am a .NET developer with no coldfusion experience, but I need to write cf code to access a wcf service i've set up. I've got a few WCF services being hosted in IIS 7 with WsHttpBinding, and I'm able to use the services fine by adding service references to a .NET client and using client classes.
It is very straightforward for a .NET developer:
var addressClient = new Service.AddressClient();
addressClient.AddressDTO[] addresses = addressClient.GetAddresses();
It's clear that visual studio does a lot behind the scenes to set up these client classes from the WSDL.
I've seen coldfusion examples using cfinvoke to call web services, but none where they actually set up client classes from the WSDL and create them from the web service response.
So, how is something like this done from coldfusion?
Thanks in advance!
others are correct in that if your webservice is returning simple data types, cf will map them to cf data types and everything is easy. in some cases though you'll have to covert the complex data types to cf data types yourself.
cflib.org has some function to handle these, so you might want to look there. here is a function to convert a .net dataset being returned from a webservice to a cf query. hopefully this will give you an ah-ha moment:
http://www.cflib.org/index.cfm?event=page.udfbyid&udfid=1580
The problem with CF is that is does not do a good job of allowing you to deal with complex objects. So as long as the service is only expecting params of strings and such your OK, but if it wants a complicated nesting of objects it falls apart.
Basically you have to get down to the Axis Java objects.
I answered this once before here:
Web service is expecting a DataSet object, how can I provide that via ColdFusion or in raw XML?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With