[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: multiRef guidance



Thomas,

Wow.  You spent a lot of time on my question.  Thanks.

Your English is just fine.  It is much better than my German.

I was in the process of doing my own thing and saving some of the
attributes.  I see from your text, that is not enough.

I will take your advice and spend some more time with WSDL2RPG.

Thanks from Alabama.
Steve


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
thomas.raddatz@xxxxxx
Sent: Tuesday, August 17, 2010 2:23 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: multiRef guidance


Steve,

Working with "multiRef" and RPG is a pain and I do not know whether my

English is good enough to explain how I do it, but I will do my best to

give you an idea of it. I use your sample data as part of my explanation.

Basically my program monitors for multiRef elements. When it encounters a

multiRef reference, e.g. <getGpsReturn href="#id0"/>, it adds that

reference to a map along with the following information (program state):

  From the parameter list of the start-callback procedure:

   userData
   depth
   namespace
   name
   path
   attrs

  From http_parser_get_start_cb() and http_parser_get_end_cb():


   cbStart
   cbEnd

  Others:

   itemIndex  (item index, if itemData is an array entry)
   itemData   (either userData or address of aarray element)
   length     (length of storage of itemData)

I need all that information in order to re-build the program state when

the program goes on and hits a multiRef element <multiRef id="id0" ...>.

When the program hits a multiRef element it calls http_parser_switch_cb()

to switch the callbacks to a special multiRef handler callback. That

callback retrieves the data that is associated to "id0" from the map. Then

it manipulates all input parameter values of the start- and end-callback

procedures to be the same as they were at the time "id0" was added to the

map. Finally it calls the "original" callbacks that have been stored in

"cbStart" and "cbEnd". That way these callbacks are called as if there was

no multiRef.

Last but not least you need to know that multiRef data (id="id0") can be

referenced more than once!

So in case my program encounters that there is a second and third

reference to "id0" it also stores the current program state in an array as

part of the map entry that is associated with "id0". At the end of the

program it copies the multiRef data from the first reference (itemData,

length) to the second, third, ..., references (memcpy()).

I use my own BasicMap and BasicList "objects" as part of my BASICS1

service program in order to use dynamic memory allocation to manage an

unlimited number of entries.

Perhaps you should consider to use WSDL2RPG which supports multiRef

elements. In case you want to look at WSDL2R94 (multiRef handler), you

must know that I use my own eXpat adapter because Scott did not yet

released his HTTP API at the time that I neeed http_parser_switch_cb() and

some other new procedures. The names are slighlty different but they work

the same way. Actually I intended to change everything back to Scott's

eXpat adapter (HTTPXMLR4) but since my one works too, I kept it the way it

is. Honestly lot's of code had been taken from Scott's HTTPXMLR4.

Thomas.





Von:    steve@xxxxxxxxxxx
An:     ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Datum:  16.08.2010 07:09
Betreff:        multiRef guidance
Gesendet von:   ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx



Greetings All.




Please provide me some guidance with "multiRef".





I have found documentation that tells me what they are.  I haven't found

any
docs that tell me how to best deal with them in RPG.




Thanks in advance.




Steve







[Anhang "multiref.txt" gelöscht von Thomas Raddatz/GfD/DE]

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------



--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the
sender.


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------