Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Sending SOAP message with multiple entries in an associative arraywith the same key

Expand Messages
  • Leon de Rooij
    Thank you so much, that was exactly the hint that I needed :-) I can get all the data that is sent to me now.. Regards, Leon
    Message 1 of 2 , Aug 17, 2004
    • 0 Attachment
      Thank you so much, that was exactly the hint that I needed :-)
      I can get all the data that is sent to me now..

      Regards,

      Leon

      On Mon, 2004-08-16 at 18:05, Duncan Cameron wrote:
      > At 2004-08-16, 12:35:56 Leon de Rooij <leon@...> wrote:
      >
      > >Hi,
      > >
      > >I am trying to parse a SOAP request with SOAP::Lite which contain an
      > >associative array with multiple entries with the same key.
      > >Unfortunately
      > >SOAP::Lite overwrites the first entry with the second entry.
      > >
      > >This is part of the WSDL that I wrote for it:
      > >
      > >....
      > ><xsd:complexType name="dhcpservice">
      > > <sequence>
      > > <xsd:element name="status" minOccurs="0" maxOccurs="1"
      > > type="xsd:string"/>
      > > <xsd:element name="mac" minOccurs="0" maxOccurs="unbounded"
      > > type="xsd:string"/>
      > > <xsd:element name="ip" minOccurs="0" maxOccurs="1"
      > > type="xsd:string"/>
      > > </sequence>
      > ></xsd:complexType>
      > >
      > ><xsd:complexType name="service">
      > > <sequence>
      > > <xsd:element name="dhcp" minOccurs="0" maxOccurs="unbounded"
      > > type="typens:dhcpservice"/>
      > > <xsd:element name="www" minOccurs="0" maxOccurs="unbounded"
      > > type="typens:wwwservice"/>
      > > </sequence>
      > ></xsd:complexType>
      > >....
      > >
      > >Now, I want to be able to send a complexType 'service' which can
      > >contain
      > >more than one 'dhcpservice' objects.
      > >
      > >My colleague who uses gSoap sends the following SOAP Request (partly,
      > >for easier reading):
      > >
      > >....
      > ><service xsi:type="ns1:service">
      > > <dhcp xsi:type="ns1:dhcpservice">
      > > <status>active</status>
      > > <mac>00:00:00:00:00:00</mac>
      > > <ip>1.2.3.4</ip>
      > > </dhcp>
      > > <dhcp xsi:type="ns1:dhcpservice">
      > > <status>inactive</status>
      > > <mac>11:11:11:11:11:11</mac>
      > > <ip>4.3.2.1</ip>
      > > </dhcp>
      > ></service>
      > >....
      > >
      > >And when I then Dump the data that I get in SOAP::Lite, it's just the
      > >second dhcpservice. It looks like the first one gets overwritten:
      > >
      > >$VAR1 = bless( {
      > > 'dhcp' => bless( {
      > > 'status' => 'inactive',
      > > 'mac' => '11:11:11:11:11:11',
      > > 'ip' => '4.3.2.1'
      > > }, 'dhcpservice' )
      > >}, 'service' );
      > >
      > >Sounds logical of course, as an associative array can only have
      > >key/value pairs wherein the key has to be unique.
      > >
      > >I tried working around this by making an extra array which contains
      > >these objects, and it works, but everything gets really ugly that way.
      > >
      > >Is there a way so I can still get more than one object with the same
      > >key
      > >and while still using this WSDL ? As I said, gSOAP has no problem with
      > >it at all, but my only option is to use perl for this.. Maybe there's
      > >something that I can do with (de-)serializing, but that's looking quite
      > >complicated from what I read in the docs..
      > >
      > You need to use a technique similar to the one shown in this earlier
      > post to the list.
      > http://groups.yahoo.com/group/soaplite/message/1521
      >
      > You can get the SOAP envelope (the SOM object) on the server side by
      > inheriting from the SOAP::Server::Parameters class, see the section in
      > the docs ACCESSING HEADERS AND ENVELOPE ON SERVER SIDE
      >
      > Regards
      > Duncan
      >
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.