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

Re: Working with multiple records



Nelson,

The 'any'and 'schema' fields are brand new with v1.7. The problem with this type of web service is that WSDL2RPG does not know the actual return value when it generates the stub module. Even worse the web service could return a different structure every time it is called. I do not like such web services and on my very own opinion these web service are no good programming practice. Actually the web service is just a huge container that can deliver all types of "goods". But you never know what it delivers until you look at the delivery note aka the XML schema.

In order to get the values, please get into the stub module and locate the line where processing is delegated to "WSDL2R98_Any_start" and "WSDL2R98_Any_end". Then write your own "Local_Any_start" and "Local_Any_end" procedures and delegate processing to them. You may use your "Local_Any_start" procedure to initialize your data structure that is intended to temporary store one record of returned data. Inside your "Local_Any_end" procedure you then can write the content of that structure to a file. Feel free to use "depth", "name" and "path" to determine what kind of data arrived and where to put it into your data structure.

Another option is to store the content of the 'any' field into a stream file and then use http_parse_xml_stmf() to parse the data. However I do not see any advantages with that approach.

Sorry, but there is nothing more WSDL2RPG (aka me) can do for you. With RPG it is far to complicated to analyze a XML schema at runtime and then pick up the values based on the current schema.

Thomas.


Smith, Nelson (nsmith) schrieb:
OK. Well hopefully, someone else has asked this question before,
although I couldn't really find a lot about it in the archives.
I'm calling a web service that returns either one record or multiple
records. Wsdl2Rpg has generated the stubs ok for both methods and now I
am trying to figure out how to deal with what is being returned.  The
calling program for the individual record method receives a ds back that
is based on this ds in the stub:

D tns_Product_t DS based(pDummy) D qualified D CategoryID 10I 0 D Discontinued N D ProductID 10I 0 D ProductName 128A varying D QuantityPerUnit... D 128A varying D ReorderLevel 5I 0 D SupplierID 10I 0 D UnitsInStock 5I 0 D UnitsOnOrder 5I 0 D UnitPrice 31S15
That is easy enough to deal with just using the qualified ds fields.

However, the calling program that receives multiple records back, just
receives a pointer to this ds consisting of a data and a schema
structure:

D tns_GetProductsDatasetResultMvd_t... D DS based(pDummy) D qualified D any 16384A varying D schema 4096A varying
Looking at the contents of these structures, everything needed seems to
be there, but I am not sure of the easiest way to use it.  Are there
additional procedures that would parse out the data, based on what is in
the schema part or do I have to do all that by hand?
My primary objective here would be to just create a table and insert the
records as directly as possible from my calling program and I would hope
that there are some tools available to do that. Thanks for all your help.

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas
Raddatz
Sent: Saturday, June 13, 2009 6:59 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: WSDL2RPG Proxy Server parameter

Sorry, there are no more FAQs at the moment. However, for the future I
plan to write FAQs for each question that is asked more than once.

Thomas.

************************************************************************************************************************************************************************************************************
This message originates from Lincare Holdings Inc. It contains information which may be confidential or privileged and is intended only for the individual or entity named above.
It is prohibited for anyone else to disclose, copy, distribute or use the contents of this message. All personal messages express views solely of the sender, which are not to be attributed to Lincare Holdings Inc., and may not be copied or distributed without this disclaimer. If you received this message in error, please notify us immediately at MailAdmin@xxxxxxxxxxx or (800) 284-2006.
************************************************************************************************************************************************************************************************************

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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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