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

Re: WSDL2RPG Trouble parsing multiple data maps from webservice



Sender: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
On-Behalf-Of: thomas.raddatz@xxxxxxxxxxx
Subject: Re: WSDL2RPG Trouble parsing multiple data maps from webservice
Message-Id: <512E5EA3.20305@xxxxxxxxxxx>
Recipient: StrausB@xxxxxxxxxx
--- Begin Message ---
Michael,

Thank you for the additional information. I assume that I did it right because the problem you had were the the simple string values of the outer map of key/value pairs. And here is why I assume that it is correct:

The response message is defined as:

   <wsdl:part name="getRGDeviceDetailsReturn" type="apachesoap:Map"/>

Type "apachesoap:Map" looks like this:

   <complexType name="Map">
    <sequence>
     <element name="item"
              minOccurs="0"
              maxOccurs="unbounded"
              type="apachesoap:mapItem"/>
    </sequence>
   </complexType>

And "apachesoap:mapItem" lookes like this:

   <complexType name="mapItem">
    <sequence>
     <element name="key" nillable="true" type="xsd:anyType"/>
     <element name="value" nillable="true" type="apachesoap:AnyMap"/>
    </sequence>
   </complexType>

"apachesoap:AnyMap" is pretty much the same as "apachesoap:Map" but has a value of "anyType" instead of "mapItem".

That clearly explains why you get back the key/value pairs of the inner map which are represented by "AnyMap".

What I changed is that I allowed an alternative item beside the value of the outer map:

   <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>

This way the value of "key" can be either a map or a "anyType" (most likely a string). Because of <choice>, only one option can be true.

Furthermore I use the "type" attribute to distinguish between a simple string and a map:

   String value, because of [s448:type="s449:string"]:

   <value xmlns:s448="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:s449="http://www.w3.org/2001/XMLSchema";
    s448:type="s449:string">simpleString</value>

   Map value, because of [xsi:type="ns1:Map"]:

   <value xmlns:ns1="http://xml.apache.org/xml-soap";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:type="ns1:Map">

It is somewhat odd that I do not take care for translating and testing the namespace prefix of the value of the type attribute. I just take the value following the colon and silently ignore the prefix. Actually I had to make sure that e.g. "ns1" is mapped to "http://xml.apache.org/xml-soap"; in order to be sure that is the right "Map" and not another "Map" of another namespace.

Regards,

Thomas.

Am 27.02.2013 16:20, schrieb Koester, Michael:
Hi Thomas.

A clarification:
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?
What I call a simple type is actually a data structure of a set of key/value pairs.  Most of those key/value pairs have a string for a value.  Where it gets tricky is that some of the values are not strings -- instead, those values are a nested array of an inner set of key value pairs.  My test program has successfully identified and displayed the strings showing those inner keys and values. But to get there, my code does not accommodate displaying any of the "simple" types where the outer value is just a string.

Example:
I get a count of 348 outer key/value pairs.
Pair #1 has a key, "RG_GEN_PROFILE", and a value (which I can't get to with my current test program), "CSA3_746MOD Bridge/PPPoE 30m/3".  You can see that if you search the debug log for RG_GEN_PROFILE, but because the programs identify that outer value as a map of inner key value pairs instead of the string, I don't know how to find and display it.

Outer pair #29 has a key, "3", and its value is an array of 4 inner key/value pairs:
   inner pair #1 has a key, "Topology", and a value, "AL-FXS-DEL".
   Inner pair #2 has a key, "Name", and a value, "tel3".
   ...

These inner keys and values I'm able to identify and display. My test program shows the following:
    DSPLY  item x is   348.
    DSPLY  1: RG_GEN_PROFILE =>
     ...
    DSPLY  26: INET_SERVICE_TYPE =>
    DSPLY  27: VOIP_ECHOCAN_1 =>
    DSPLY  28: VOIP_ECHOCAN_2 =>
    DSPLY  inner pairs: 4.
    DSPLY  29/1: Topology => AL-FXS-DEL
    DSPLY  29/2: Name => tel3
    DSPLY  29/3: ID => 3
    DSPLY  29/4: Physical Port => tel3
    DSPLY  inner pairs: 4.
    DSPLY  30/1: Topology => AL-FXS-DEL
    DSPLY  30/2: Name => tel2
    DSPLY  30/3: ID => 2
    DSPLY  30/4: Physical Port => tel2
    DSPLY  31: inetProfileMOName =>
    DSPLY  inner pairs: 4.
    DSPLY  32/1: Topology => AL-FXS-DEL
    DSPLY  32/2: Name => tel1
    DSPLY  32/3: ID => 1
    DSPLY  32/4: Physical Port => tel1
    ...
Note that pairs 1, 26, 27, 28, and 31 are the simple types, and pairs 29, 30, and 32 have the nested sets, each having 4 inner key/value pairs.

Does that help?

I'll try to see what I can do with what you sent me.  If the above details cause you to determine that we're on the wrong path, let me know.

Thanks so much.
-- Michael

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


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