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

Re: [soaplite] Re: boolean type in XML Schema 1999

Expand Messages
  • Paul Kulchenko
    Hi, Simon! Unfortunately it depends on XML schema you re looking at. For example this schema [1] says: An instance of a datatype that is defined as boolean can
    Message 1 of 6 , Nov 28, 2001
    • 0 Attachment
      Hi, Simon!

      Unfortunately it depends on XML schema you're looking at. For example
      this schema [1] says:

      An instance of a datatype that is defined as boolean can have the
      following legal lexical values {0, 1, true, false, yes, no}.

      My understanding is that {0, 1} should be allowed (and it is and was
      allowed), because current version of specification defines many
      attributes as restriction of boolean type and requires "1|0" values.
      For example:

      <xs:attribute name="mustUnderstand" default="0">
      <xs:simpleType>
      <xs:restriction base="xs:boolean">
      <xs:pattern value="0|1" />
      </xs:restriction>
      </xs:simpleType>
      </xs:attribute>

      Which means that "1|0" are legal boolean values in XML schema that
      were used for SOAP 1.1 spec. Unfortunately presence of several XML
      Schema versions for the same year makes it absolutely confusing. I'm
      not sure that namespace referenced by
      http://www.w3.org/1999/XMLSchema means to use latest schema for year
      1999. I'll try to clarify that on soapbuilders list and will fix that
      if it's my mistake.

      Best wishes, Paul.

      [1] http://www.w3.org/1999/05/06-xmlschema-2/#boolean

      --- eat_lemon@... wrote:
      > Hi Paul,
      >
      > I forgot to mention to you that I'm talking to a Java Server using
      > Apache SOAP. My code is basically: SOAP::Data->type(boolean => 1).
      > On the Java server side, it is deserializing as false when I use
      > soaplite v0.52 (true when I use soaplite v0.50). I checked the
      > 1999
      > schema too, and it says boolean type should be "true/false".
      > PLEASE
      > look at the link to the 1999 schema below:
      >
      > http://www.w3.org/TR/1999/WD-xmlschema-2-19991217/#boolean
      >
      > Thanks a lot for your help!
      >
      > Regards,
      >
      > Simon
      >
      > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
      > > Hi, Simon!
      > >
      > > > However, after I upgraded to soaplite v0.52, XML Schema 1999
      > > > doesn't accept "1/0" properly, it treats all "1/0" input as
      > > "false".
      > > Hm, can't confirm that. Both "1" and "true" give me 1, "0" and
      > > "false" give me 0 and all other values produce "Wrong boolean
      > value"
      > > error. I checked 1999 and 2001 Schemas. Would you post your code?
      >
      > Why
      > > do you think it's wrong? Below is mine. Thanks.
      > >
      > > Best wishes, Paul.
      > >
      > > $d = SOAP::Deserializer->deserialize(q!<?xml version="1.0"
      > > encoding="utf-8"?>
      > > <soap:Envelope
      > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      > >
      > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      > > <soap:Body>
      > > <ns1:something xmlns:ns1="something">
      > > <input xsi:type="xsd:boolean">false</input>
      > > <input xsi:type="xsd:boolean">0</input>
      > > <input xsi:type="xsd:boolean">true</input>
      > > <input xsi:type="xsd:boolean">1</input>
      > > </ns1:something>
      > > </soap:Body>
      > > </soap:Envelope>!);
      > >
      > > print $d->paramsall; # 0011
      > >
      > > --- eat_lemon@y... wrote:
      > > > Hi Paul,
      > > >
      > > > I upgraded my soaplite from 0.50 to 0.52, but I ran into
      > problems
      > > > in
      > > > boolean. I did a search on boolean in the messages and found
      > the
      > > > below message (#895) from you. I used the XML Schema 1999 and
      > it
      > > > accepted "true/false" from soaplite v0.50 without any problems.
      >
      > > > However, after I upgraded to soaplite v0.52, XML Schema 1999
      > > > doesn't
      > > > accept "1/0" properly, it treats all "1/0" input as "false".
      > So
      > I
      > > > did a search for the XML Schema 1999 and found that it says
      > boolean
      > > >
      > > > type only accepts "true/false". Below is the link:
      > > >
      > > > http://www.w3.org/TR/1999/WD-xmlschema-2-19991217/#boolean
      > > >
      > > > Is this a bug? Right now, I just used the as_boolean from
      > v0.50.
      > > >
      > > > Thanks a lot for your help!
      > > >
      > > > Regards,
      > > >
      > > > Simon
      > > >
      > > >
      > > > > That's a known problem with SOAP::Lite v0.51. boolean type in
      >
      > XML
      > > > > Schema 1999 doesn't accept 'true/false', only '1/0' which is
      > > > > incorrect. You either need to use XML Schema 2001 (instead of
      > > > 1999)
      > > > > which does correct processing or do something like this
      > (right
      > > > after
      > > > > 'use SOAP::Lite;' or 'use SOAP::Transport::HTTP;'):
      > > > >
      > > > > *SOAP::XMLSchema1999::Deserializer::as_boolean =
      > > > > *SOAP::XMLSchemaSOAP1_1::Deserializer::as_boolean =
      > > > > \&SOAP::XMLSchema2001::Deserializer::as_boolean;
      > > > >
      > > > > It's already fixed in the current version which will be
      > available
      > > > > --cough, cough -- really soon. Let me know if you still have
      > any
      > > > > problem.
      > > > >
      > > > > Best wishes, Paul.
      > > >
      > > >
      > > > ------------------------ Yahoo! Groups Sponsor
      > > >
      > > > To unsubscribe from this group, send an email to:
      > > > soaplite-unsubscribe@y...
      > > >
      > > >
      > > >
      > > > Your use of Yahoo! Groups is subject to
      > > > http://docs.yahoo.com/info/terms/
      > > >
      > > >
      > >
      > >
      > > __________________________________________________
      > > Do You Yahoo!?
      > > Yahoo! GeoCities - quick and easy web site hosting, just
      > $8.95/month.
      > > http://geocities.yahoo.com/ps/info1
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
      http://geocities.yahoo.com/ps/info1
    Your message has been successfully submitted and would be delivered to recipients shortly.