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

Re: [soaplite] XMLSchema version handling for null/nil requests

Expand Messages
  • Crispin Flowerday
    ... My hack doesn t look at the declared namespaces, it works out what namespace was used for the xsi:null / xsi:nil element. The problems come when using
    Message 1 of 5 , May 26, 2005
    • 0 Attachment
      On Wed, 2005-05-25 at 08:52 -0700, Paul Kulchenko wrote:
      > Since none of the namespaces was actually "used" there is no
      > (reliable) way to tell what schema should be used in the response. We
      > can look at declared namespaces (as you implemented in your hack),

      My hack doesn't look at the declared namespaces, it works out what
      namespace was used for the "xsi:null" / "xsi:nil" element.

      The problems come when using the windows SOAP API (or the mono one),
      which doesn't even send the xsi:null / xsi:nil element. In this
      situation the only way is to look at the declared namespaces.

      The current behaviour is definately wrong, as the schema used for
      responses is totally undefined (it depends on the schema used in the
      previous response). This, at least, breaks mono, which doesn't
      understand the 1999 schema, and won't parse response using the 1999
      schema.

      Crispin


      > but it's not reliable (and besides, those namespaces can be declared
      > on any element; not necessarily on soap:envelope).
      >
      > As far as I remember you can specify a default schema to be used when
      > autodetection fails. It might also be possible to add a method that
      > you can override with your own schema detection mechanism, but I'm
      > not sure how feasible this is.
      >
      > Given all this I wouldn't say it's a bug ;)
      >
      > Paul.
      >
      > --- Byrne Reese <byrne@...> wrote:
      > > No, I would consider this a bug. Ideally, SOAP::Lite should use the
      > > same
      > > schema in the response as was sent in the request. Thanks for
      > > catching this.
      > >
      > > Crispin Flowerday wrote:
      > >
      > > > Hi,
      > > >
      > > > I am trying to write a SOAP::Lite server, and have run across
      > > what I
      > > > believe is a bug. It seems that when deserealizing the request
      > > from the
      > > > client, the XMLSchema version is not correctly worked out in the
      > > case
      > > > where there are no arguments to the function, e.g. imagine the
      > > following
      > > > SOAP request:
      > > >
      > > > <?xml version="1.0" encoding="UTF-8"?>
      > > > <soap:Envelope
      > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      > > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      > > >
      > > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      > > > <soap:Body>
      > > > <namesp1:hello xmlns:namesp1="Test" xsi:null="1" />
      > > > </soap:Body>
      > > > </soap:Envelope>
      > > >
      > > > Then the response received from the server uses the 2001 schema,
      > > rather
      > > > than the 1999 schema. This causes all sorts of problems when
      > > mixing
      > > > SOAP::Lite clients, and mono clients.
      > > >
      > > > Attached is a client and a daemon that show the problem, if you
      > > run the
      > > > daemon, and then use the client to send over a 1999 schema
      > > request, it
      > > > comes back using the 2001 schema.
      > > >
      > > > I have a very hacky fix, which is probably totally the wrong way
      > > to fix
      > > > it, by inserting a block like (I know its not a real fix as you
      > > get
      > > > warnings a line slightly further down in the file):
      > > >
      > > > # $name is not used here since type should be encoded as type,
      > > not
      > > > as name
      > > > my ($schema, $class);
      > > > if( $type ) {
      > > > ($schema, $class) = SOAP::Utils::splitlongname($type) if
      > > $type;
      > > > } else {
      > > > my ( $null ) = grep /^$SOAP::Constants::NS_XSI_NILS$/, keys
      > > %$attrs;
      > > > if( $null && $null =~ /^$SOAP::Constants::NS_XSI_NILS$/ ) {
      > > > $schema = $1 || $2;
      > > > }
      > > > }
      > > >
      > > > in place of (in SOAP::Deserializer::decode_value)
      > > >
      > > > my ($schema, $class) = SOAP::Utils::splitlongname($type) if
      > > $type;
      > > >
      > > > Now, is the above described behaviour a bug? And is there a
      > > better fix
      > > > than my hack ? (I'm using 0.65_5)
      > > >
      > > > Crispin
      > > >
      > > >
      > > >
      > > >
      > >
      > ------------------------------------------------------------------------
      > > > *Yahoo! Groups Links*
      > > >
      > > > * To visit your group on the web, go to:
      > > > http://groups.yahoo.com/group/soaplite/
      > > >
      > > > * To unsubscribe from this group, send an email to:
      > > > soaplite-unsubscribe@yahoogroups.com
      > > >
      > > <mailto:soaplite-unsubscribe@yahoogroups.com?subject=Unsubscribe>
      > > >
      > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      > > > Service <http://docs.yahoo.com/info/terms/>.
      > > >
      > > >
      > >
      > >
      > >
      > >
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      > >
      > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.