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

RE: [soaplite] Re: Deserialization of enumerated values

Expand Messages
  • Byrne Reese
    As it turns out... I can help. I suggest you enter this into SOAP::Lite s bug database hosted by sourceforge. http:://sourceforge.net/projects/soaplite
    Message 1 of 5 , Jun 19, 2003
    • 0 Attachment
      As it turns out... I can help. I suggest you enter this into SOAP::Lite's bug database hosted by sourceforge.
       
      http:://sourceforge.net/projects/soaplite
       
      Development is beginning again and a new version of SOAP::Lite is due out soon. Support for WSDL is forthcoming, but you will have to be patient as it is the developers' belief that some unknown, but probably substantial rewrite of our XML Schema parser is in order... so log this as a bug so we won't lose track of it.
       
      Byrne
       
      -----Original Message-----
      From: Eric Jain [mailto:jain@...]
      Sent: Thursday, June 19, 2003 2:24 AM
      To: soaplite@yahoogroups.com
      Subject: [soaplite] Re: Deserialization of enumerated values

      > sub SOAP::Deserializer::as_rank {
      >     my $self = shift;
      >     my($value, $name, $attr, $chil, $type) = @_;
      >     return $value;
      > }

      Thanks, this does work, though it is a bit awkward with dozens of
      custom types, to say the least, especially since I believe there is
      no reason why this case could not be handled automatically.

      Consider the following example:

        <status xsi:type="ns:Status">completed</status>

      A look into the WSDL would show that 'Status' is an enumeration of
      xsd:string (or some other simple type) values.

        <simpleType name="Status">
          <restriction base="xsd:string">
            <enumeration value="running" />
            <enumeration value="completed" />
            <enumeration value="failed" />
          </restriction>
        </simpleType>

      Looking this up may be overkill, but instead of failing because the
      type 'Status' is not known, the type could simply be treated as a
      simple type! So instead of:

        $res = $class ?
            die "Unrecognized type '$type'\n" :
            $value
          unless defined $res;

      one could do:

        $res = $value ?
            $value :
            die "Unrecognized type '$type'\n"
          unless defined $res;

      or perhaps even:

        $res = $value ?
            bless(\$value, $class) :
            die "Unrecognized type '$type'\n"
          unless defined $res;

      Note that using restrictions on simple types to express enumerations
      is not my invention, but is supported out-of-the-box automatically by
      other toolkits such as Axis, Glue, and even the JAXB specification.

      So, did I overlook anything? Could this modification (or something
      similar) be incorporated into SOAP::Lite? And, who is in charge? :-)



      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    Your message has been successfully submitted and would be delivered to recipients shortly.