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

Re: [soaplite] Object Serialisation Issue

Expand Messages
  • Duncan Cameron
    ... From: Josh Glover To: Sent: Tuesday, February 10, 2004 10:38 PM Subject: [soaplite] Object
    Message 1 of 2 , Feb 11, 2004
    • 0 Attachment
      ----- Original Message -----
      From: "Josh Glover" <josh.glover@...>
      To: <soaplite@yahoogroups.com>
      Sent: Tuesday, February 10, 2004 10:38 PM
      Subject: [soaplite] Object Serialisation Issue


      > Hello All,
      >
      > I am working on a SOAP::Lite client, using S::L 0.55. I frequently
      make use
      > of this idiom:
      >
      >
      > my $soap = SOAP::Lite
      > ->proxy( 'soapd:8080/soapd/' )
      > ->uri( 'Foo/Bar' );
      >
      > my $bar = $soap->New->result;
      >
      > $bar->{key0} = "val0";
      > $bar->{key1} = "val1";
      >
      > $soap->put( $bar );
      >
      >
      > I am calling a constructor on the SOAP server, which returns me a
      Foo::Bar
      > object. I fill in a few attributes and then "put" the object back into
      the
      > persistence store on the server. This works like a charm. The
      serialiser
      > produces the following envelope:
      >
      >
      > <?xml version="1.0" encoding="UTF-8"?>
      > <SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:namesp3="http://namespaces.soaplite.com/perl"
      > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:namesp4="http://xml.apache.org/xml-soap"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      > <SOAP-ENV:Body>
      > <namesp2:put xmlns:namesp2="Foo/Bar">
      > <Foo__Bar xsi:type="namesp3:Foo__Bar">
      > <key0 xsi:type="xsd:string">val0</key0>
      > <key1 xsi:type="xsd:string">val1</key1>
      > </Foo__Bar>
      > </namesp2:put>
      > </SOAP-ENV:Body>
      > </SOAP-ENV:Envelope>
      >
      >
      > The problem occurs when one of my attributes contains whitespace, e.g.
      >
      > $bar->{"Key 0"} = "Val 0";
      >
      > Then, S::L serialises my object like this:
      >
      >
      > <?xml version="1.0" encoding="UTF-8"?>
      > <SOAP-ENV:Envelope
      > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:apachens="http://xml.apache.org/xml-soap"
      > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      > <SOAP-ENV:Body>
      > <namesp2:put xmlns:namesp2="Foo/Bar">
      > <Foo__Bar xsi:type="apachens:Map">
      > <item>
      > <key xsi:type="xsd:string">Key 0</key>
      > <value xsi:type="xsd:string">Val 0</value>
      > </item>
      > </Foo__Bar>
      > </namesp2:put>
      > </SOAP-ENV:Body>
      > </SOAP-ENV:Envelope>
      >
      >
      > This, of course, causes my server to break, since it gets a class name
      > when it is expecting an object (i.e. a reference to a blessed hash).
      >
      > Now, to some degree, this is a "Doctor, it hurts when I do this."
      "Then
      > stop doing that." problem, but I would like to know what is causing
      this
      > behaviour. Is it part of the SOAP spec, or a bug in S::L's serialiser?
      >
      Well, a space character is not allowed in an XML element name, so
      SOAP::Lite cannot serialise the key value of "Key 0" as an element.
      Given that, what is your server expecting a client to do?

      Regards

      Duncan Cameron
    Your message has been successfully submitted and would be delivered to recipients shortly.