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.




> 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.
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305304
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to