You say that the web service returns XML, why don't you work the XML with CF's 
XML functions?  

Do a CFDump on what they send and see what it is.  If it is XML you will 
probably need to run XMLParse() on it to turn it into a CF XML object.  Then 
run CFDump on it.

The CF documentation has some great examples of how to work with XML.
http://livedocs.adobe.com/coldfusion/7/htmldocs/00001505.htm#1158596




-----Original Message-----
From: Archie Campbell [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 27, 2007 11:07 AM
To: CF-Talk
Subject: Re: CF page calling a Webservice that returns a complex structure

Maybe I am posting on the wrong forum.
Is that a better one to use?
Thanks
Archie

Archie Campbell wrote:
> I am finding this task uncharacteristically difficult to do with Cold 
> Fusion.
> I suspect there is an easier way, I just cant think of it.
>
> Here is the situation.
>
> There is an external Webservice that returns XML containing information 
> on all unpaid invoices for a customer.
> The XML document contains 1 or many invoices each having 1 or many 
> invoice detail lines.
> The CF program I am writing is supposed to:
>     . call the webservice
>     . get the XML info and either:
>                A. save it in an XML text file for further processing by 
> Excel or Access or another CF program or ...
>                B. convert it to a struct, process it a bit, like total 
> fields, rename fields
>                     producing a new struct which is then saved to an XML 
> text file
>
> The external (non CF) webservice returns a "complex" structure like:
>
> InvoiceCollection
>     . countOfInvoices
>     . totalAmount
>     . Invoices:      (repeating multiple times)
>            . invoiceNumber
>            . invoiceDate
>            . invoiceAmount
>            . countOfInvoiceLines
>            . InvoiceLines   (repeating multiple times)
>                      . lineNumber
>                      . description
>                      . amount
>
> I have successfully accepted the webservice return object and produced a 
> CF struct from it.
> It was a bit tedious, but I have it done.
>
> After I had the struct I thought I could use the data conversion routine 
> StructToXml from cflib.org to produce a string that I would write to a 
> file with cffile.
> It was missing the arrayOfStructs. Not much there.
> Then I read the fine print on StructToXml and noted that it says it 
> converts "simple" structs.
> A struct whose elements include an array of stucts is not included in 
> the definition of simple.
> Darn I said.
>
> Basically, right now, I have my struct and I am stuck.
> What I originally thought to be a simple task for Cold Fusion (CF nicely 
> takes many otherwise complex tasks and makes them simple)
> has got me stuck.
>
> Any thoughts would be appreciated.
>
> Thanks
> Archie Campbell
>
>
>
>          
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

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

Reply via email to