Ok I have a web service that I'm trying to consume in CF9. I'm able to hit the wsdl with SOAPUI and see the results. The results come back in XML format. It basically shows a list of rooms we use as meetings and show the times they are reserved. Here's the CF code I've written for it:

is a Java reference to an object in memory. That object probably contains the XML, as well as methods to interact with that XML.

What do you get when you use CFDUMP to view FindResourceDetailForDayResponse?

To interact with the XML once you get it, CF lets you treat XML documents as if they were nested arrays and structures. So, you can iterate over them using native CF operations and functions. You can also use XML DOM API calls like you would in many other environments. Finally, you can use XPath to match nodes anywhere in your XML.

<!-- write a copy of the response to the file system --> <cffile action="write" file="#session.server_root#/xmlOrders/#now()_response.xml" output="#soapResponse#" >

<!--- Query for the response nodes using XPath. Because the SOAP XML document has name spaces, querying the document becomes a little funky. Rather than accessing the node name directly, we have to use its local-name(). ---> <cfset responseNodes = xmlSearch( #soapResponse#, "//*[ local-name()='SOL_Acknowledgement']" ) />

I would highly recommend using cfdump while you are debugging this issue. It will keep you away from getting sidetracked from the real issue. So instead of cfoutput'ing your variables just cfdump the entire structure. That way you can get a better picture of what is happening (or not).

Thanks BKBK, that worked for me. Now I'm getting the XML returned from the webservice. Now I just need to be able to query the XML data but I think I can find/figure that out on my own. Thanks everyone for the help.

I was having this same issue and found a way to get at the values while still using the cfinvoke method instead of using cfhttp. To re-iterate when I made a cfinvoke call to the web service and dumped the result I would see an object dump with methods but no values (not the soap response I was expecting). You are able to retrieve the values from the service call by utilizing those methods that you see returned in the object. So for example, in this post a cfinvoke call was made to the web service and the result was stored in return variable "FindResourceDetailForDayResponse". The cfdump that was included shows the methods returned for that web service. In order to get the actual data from the call you can reference them like this for simple values: FindResourceDetailForDayResponse.getSimpleValue(). For complex values (like in the example from this post) you must dig a little deeper. If you keep cfdump'ing the returned methods you will finally get to the simple values. Then it is just a matter of calling each method in turn, like: FindResourceDetailForDayResponse.get_any().getStartTime() and FindResourceDetailForDayResponse.get_any().getEndTime() etc.

I know this is an old post but I just wanted to get this info out here because I haven't seen it mentioned anywhere else. You can certainly call the webservice using cfhttp as others have mentioned but then you need to deal with the resulting XML object. By calling the methods as I have shown you can access the values directly without the need to traverse the XML tree. If there is an issue with processing the soap response in this way then please let me know. It seems to be working for me.

Miguel - one thing I would watch out for is if one of the properties associated with a getter methods does not contain a value, you will get a NULL value back. In ColdFusion setting a variable to a NULL value will remove that variable from the memory space and give you a variable is not defined error when you try to use it. Typically this is not a huge issue, but .NET based web services are the worst at this sort of thing (returning NULL values, that is). I always caution users who are consuming web services using the <cfinvoke> method to check all of their getMethod() calls for NULL values or use an isdefined() check before using the variable. Rolling that checking logic into a UDF makes it a little easier to implement.

One advantage that the SOAP method has is that since you are dealing with native XML, it is a little easier to handle missing elements/attributes from your web service call.