On Oct 20, 2010, at 10:59 AM, Michael Check wrote:

> So along the line of my previous question regarding SOAP, we're
> getting XML data back from a server and need to get it to be used in
> A4D.  Naturally, I think rowsets.  So I'm looking for the best path
> (or tools that will help jump the gaps) to get the SOAP response in
> XML blob format, into a Rowset.
> 
> Of course, what I'd like to do is create a map (similar to the RowSet
> examples in the docs) with the data columsn to be returned and send
> those into my library, with a Rowset returned.
> 
> Here's what I'm thinking now:
> In A4D Create text map of needed column names that correspond to
> remote server fields
> Send into wrapper method that processes SOAP Client request to their server
> Get back XML Blob of data
> Parse XML into columns names and data (as separate arrays?)
> Send back to A4D (best way?  Big blob of arrays?  ObjectTools?)
> Send into RowSet library.
> Voila! (Sort of)
> 
> Any suggestions?  Anyone done this before?

On Oct 20, 2010, at 11:48 AM, Aparajita Fishman wrote:

> Active4D can't unpack a blob of arrays. I would create two arrays: array of 
> column names and array of pointers to the process data arrays. Pass those to 
> Active4D, it can access the data through the pointers.


I may be faced with the same type of challenge in interfacing with Quickbooks 
using the SDK, which only speaks XML. I've done this type of conversion, 
saving, retrieving, etc using a couple different methods. I have not had to 
deal with rowsets (or an array of object), but beside Aparajita's suggestion 
I'll talk about a couple other approaches I've tried.

ObjectTools.  Since I extensively use collections, not being able to stored 
nested collections or arrays in collection to blob has been a bummer. You have 
to write a few 4D ObjectTools wrapper methods t0  get and put the different 
types (some process variables also needed). I then wrote a couple of Active4D 
library methods ObjectToCollection and CollectionToObject that allows you to 
save a collection in an OT blob and retain arrays and embedded collection. It 
is limited to "sane" data types. 

JSON.  Parse the XML into a collection then convert the collection to JSON with 
the JSON library (or directly into JSON). Store the text. Again, depending on 
the complexity, I wrote a JsonParseSimple library method that parses the JSON 
text into a collection.

I never learned how to use the 4D XML library because I couldn't call it from 
Active4D.  I tried to avoid wrapper methods since I could never count on my 4D 
desktop developer to release new structures when I needed them. I wrote my own 
XML parse methods in Active4D, but again they were limited to simple, known XML 
structures.

The problem with the collection approach and rowsets is sorting, if that is 
important.

If the QuickBooks project get a go ahead, I may have a head start since I will 
probably use a RubyGem that interfaces with QuickBooks and can return, XML, 
JSON or whatever - but that is throwing another process in the mix.

Steve Alex

PS You can contact me privately if your interested in any of the code mentioned 
about and I'll post it on github.


_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to