July 25, 2008
For ColdFusion hosting try HostMySite.com. |
Home /
Groups /
ColdFusion Talk (CF-Talk)
Coldfusion/SOAP/Complex datatypes
I am struggling to find a clear example of how to interface CF 7 with a web service, and was wondering if anyone here has managed to achieve what I am trying to acheieve.graham bates 05/12/08 12:58 P Best of luck to you.. When I tried dealing with complex types.. it was rather... complex to say the least.. This was one area where documentation or examples would really help.Jeff Becker 05/12/08 05:29 P Graham,Kris Jones 05/12/08 05:55 P I am struggling to find a clear example of how to interface CF 7 with a web service, and was wondering if anyone here has managed to achieve what I am trying to acheieve. The SOAP API takes the form of; <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <CredentialSoapHeader xmlns="http://tempuri.org/"> <Username>string</Username> <Password>string</Password> </CredentialSoapHeader> </soap:Header> <soap:Body> <GetPageViewByCustom xmlns="http://tempuri.org/"> <pageList> <int>int</int> <int>int</int> </pageList> <startTime>dateTime</startTime> <endTime>dateTime</endTime> <timeBreakdown>int</timeBreakdown> </GetPageViewByCustom> </soap:Body> </soap:Envelope> What I am struggling with is forming complex objects of, for example, type [timeBreakDown] in CF, I am continuously told Web service operation 'myMethod()' with parameters {args} could not be found. Best of luck to you.. When I tried dealing with complex types.. it was rather... complex to say the least.. This was one area where documentation or examples would really help. Take a look at: http://www.mischefamily.com/nathan/index.cfm/2007/2/8/ColdFusion-and-ASPNET-Web-Service-Interoperability-Part-III Hopefully the above helps. It helped us to some degree. Jeff Graham, There was thread on this very recently. Take a look at: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:52942 http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56249 http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304612 http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304692 While the original question had to do with SAP web-services, there was info in the discussion that might help you. Cheers, Kris I finally got somewhere with this. It was most confusing because I didn’t appreciate the complex data types were not just, for example, coldfusion arrays but java classes specific to this web service which happened to be an array. So, what I did, was run the wsdl2java program against the web service, in order to see the java source files which allow you to see the data types of the parameters. I then ran a cfinvoke on the webservice and looked in my cffusion directory, found a newly created directory called “stubs” and zipped up all of the class files that had been generated , renamed it as a jar file, and placed that file in my coldfusion java class path. I then created java objects in coldFusion of those data types, eg <cfset ArrayOfInt = CreateObject("java", "org.tempuri.ArrayOfInt")> Doing a cfdump on the object allowed me to understand how to instantiate the variables with the right data. Then, I wrote small amout of xml defining the SOAP header (user name and password etc) , converted it via xmlparse into xml_obj and then pulled the whole thing together like the following; <cfset args.pageList = ArrayOfInt> <cfscript> ws = CreateObject("webservice", "http://webservice.com/ blah.asmx?wsdl"); addSOAPRequestHeader(ws, "http://tempuri.org/", "dummy_string", xml_obj); gb=ws.GetMetricTimeByCustom(pageList=args.pageList,startTime=args.startTime,endTime=args.endTime,timeBreakdown=args.timeBreakdown,dataType=args.dataType); </cfscript> <cfset xml_obj = xmlparse(gb.getXmlDocument())> <cfdump var="#xml_obj#"> Hopefully this will save people some time. ----- Excess quoted text cut - see Original Post for more -----
|
Mailing Lists
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||