Michael, I am not sure that I thorougly understood the problem. What I understood is that the value of a key/value pair sometimes is a simple type, e.g. a string, and sometimes a map. Is that right? Given that my assumption is correct, you may try to change the WSDL file to use a <choice> to distinguish between these two data types. Please have a look at the attached sample. Hopefully it helps you to make it. Snippet from the changed wsdl file: <complexType name="mapItem"> <sequence> <element name="key" nillable="true" type="xsd:anyType"/> <choice> <element name="value" nillable="true" type="apachesoap:AnyMap"/> <element name="value2" nillable="true" type="xsd:anyType"/> </choice> </sequence> </complexType> Anfter having changed the wsdl like that I needed to tweak the generated stub. I replaced "value" with "value" at several places (but not all) and I retrieved the "type" attribute (getSchemaAttr()) to distinguish between the types of element "value": dataType = getSchemaAttr('type': attrs); // FIX: added select; when (depth = 2 and name = 'value' and // FIX: added dataType = 'Map'); // FIX: added These nice XML "any" types is what we really do not need with RPG. :-( Regards, Thomas. ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 26.02.2013 13:55:07: > Von: mkoester@xxxxxxxxxxxxx > An: ftpapi@xxxxxxxxxxxxxxxxxxxxxx, > Datum: 26.02.2013 14:11 > Betreff: RE: WSDL2RPG Trouble parsing multiple data maps from webservice > Gesendet von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx > > Thank you Thomas. > Attached is the debug log with just a couple value elements > modified. I know you're getting toward the end of your day, as I'm > just beginning mine. > > -- Michael > > -----Original Message----- > From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [[1]mailto:ftpapi- > bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of thomas.raddatz@xxxxxx > Sent: Tuesday, February 26, 2013 2:07 AM > To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: WSDL2RPG Trouble parsing multiple data maps from webservice > > > Micheal, > > Please provide a sample response message of the web service. You may > either post the complete debug log (without sensitive data) or you > may take the response XML string out of the debug log and post it here. > > The problem you describe is a tricky one because we reach the > capabilities of RPG. In Java it is not a problem to have a map and > to assign a string or another map to a key. Actually you can assign > every object to a key. But in RPG you are almost stuck. But first, > let me see what we can do. > > Thomas. > > ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 26.02.2013 00:00:54: > > > Von: mkoester@xxxxxxxxxxxxx > > An: ftpapi@xxxxxxxxxxxxxxxxxxxxxx, > Datum: 26.02.2013 00:11 > > Betreff: WSDL2RPG Trouble parsing multiple data maps from webservice > > Gesendet von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx > > > I've been using the Thomas Raddatz WSDL2RPG tool, but I'm seeing > > some occurrences of failures. Getting the error "-1: Length of > > varying length variable is out of range." If I recall correctly, > > this error may have originated in one of the WSDL2R94 procedures. > > After a lot of digging around, I find that on these occurrences, > > there appears to be a couple of different data maps being returned > > by the webservice. The production program is handling the simple > > type, where I receive back items defined as: > > > > D impl_getRGDeviceDetailsReturnMvd_t... > > D DS template > > D qualified > > D item likeds(apachesoap_RpgArrayOfItem_t) > > > D apachesoap_RpgArrayOfItem_t... > > D DS template > > D qualified > > D x 10I 0 > > D mapItem likeds(apachesoap_mapItem_t) > > D dim(DIM_A1) // DIM_A1 = 512 > > > D apachesoap_mapItem_t... > > D DS template > > D qualified > > D key 256A varying > > D value 256A varying > > > This works well until I encounter a nested array, where the > "Value" > is actually a map of a number of key/value pairs. > > > So I messed with it until I got a test program to accommodate those. > > (I used patterns from another program Thomas helped me set up last > > August.) I also had to do a lot of trial/error to get the array > > dimensions right so it would compile and run without error. It now > > runs without error (at least for my very limited test inputs), and I > > can get the key/value pairs of the inner nested values, using the > > following definitions in my test stubs: > > D > apachesoap_RpgArrayOfItem_t... > > D DS template > > D qualified > > D x 10I 0 > > D mapItem likeds(apachesoap_mapItem_t) > > D dim(DIM_A1) // DIM_A1 > = > 400 for this test stub > > > D apachesoap_mapItem_t... > > D DS template > > D qualified > > D key 64A varying > > D value likeds(apachesoap_AnyMap_t) > > > D apachesoap_AnyMap_t... > > D DS template > > D qualified > > D item likeds > > (apachesoap_RpgArrayOfItem1_t) > > > D apachesoap_RpgArrayOfItem1_t... > > D DS template > > D qualified > > D x 10I 0 > > D anyMapItem likeds(apachesoap_anyMapItem_t) > > D dim(DIM_A2) // DIM_A2 > = > 64 for this test stub > > > D apachesoap_anyMapItem_t... > > D DS template > > D qualified > > D key 64A varying > > D value 64A varying > > > All is cool except that the returned data is a mix of the nested > > types and the simple types. I have not found a way to resolve the > > simple value, which my test stubs don't appear to resolve. I get > > the "simple" key, but the value is expected to also be a nested > set > of key/value pairs, which for some pairs it is, but others it > is not. > > I know what the result set should be from a "northbound > Interface" > that should be using the same web service, and I see > the different > types of data maps there. I just can't seem to > replicate those > results with my programs. > > > Attached is the original wsdl from the web service > (Provision.wsdl) > and a modified version that provides for the > nested key/value pairs > (Provision4.wsdl). The method I'm working > with here is > getRGDeviceDetails. I've attached my test caller as > well (ws5test05.txt). > > > If you think you can help me through this, let me know what > other > pieces you might need. > > > Many thanks, > > Michael > > > > > [Anhang "Provision.xml" gelöscht von Thomas Raddatz/OBI/DE] > > > > > [Anhang > "Provision4.wsdl" gelöscht von Thomas Raddatz/OBI/DE] > > > > > [Anhang > "ws5test05.txt" gelöscht von Thomas Raddatz/OBI/DE] > > > > > > ---------------------------------------------------------------- > > > > > ------- > > This is the FTPAPI mailing list. To unsubscribe, please go to: > > [2]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. > [Anhang "httpapi_debug.txt" gelöscht von Thomas Raddatz/OBI/DE] > ----------------------------------------------------------------------- > This is the FTPAPI mailing list. To unsubscribe, please go to: > [3]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. References 1. mailto:ftpapi- 2. http://www.scottklement.com/mailman/listinfo/ftpapi 3. http://www.scottklement.com/mailman/listinfo/ftpapi
Attachment:
2013-02-27_MK.zip
Description: Zip archive
----------------------------------------------------------------------- This is the FTPAPI mailing list. To unsubscribe, please go to: http://www.scottklement.com/mailman/listinfo/ftpapi -----------------------------------------------------------------------