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

enums in soaplite

Expand Messages
  • anmue2002
    Hi all, probably is this the same problem I posted two days before. How can I build a simple type with enums in soaplite like: xs:simpleType
    Message 1 of 2 , Apr 23, 2002
    • 0 Attachment
      Hi all,

      probably is this the same problem I posted two days before. How can I
      build a simple type with enums in soaplite like:

      xs:simpleType name="AEC_AttributeType">
      <xs:restriction base="xs:string">
      <xs:enumeration value="FILE"/>
      <xs:enumeration value="GROUP"/>
      <xs:enumeration value="DATE"/>
      <xs:enumeration value="SWITCH"/>
      </xs:restriction>
      </xs:simpleType>

      If I code it like

      "return SOAP::Data->type(AEC_AttributeType => 'FILE');"

      I get an error.


      I would really appreciate any help.

      anmue2002
    • Duncan Cameron
      ... I think that you need to provide your own serialiser for AEC_AttributeType. define a subroutine similar to this: sub SOAP::Serializer::as_mytype { my $self
      Message 2 of 2 , Apr 23, 2002
      • 0 Attachment
        On 2002-04-23 anmue2002 wrote:
        >Hi all,
        >
        >probably is this the same problem I posted two days before. How can I
        >build a simple type with enums in soaplite like:
        >
        >xs:simpleType name="AEC_AttributeType">
        > <xs:restriction base="xs:string">
        > <xs:enumeration value="FILE"/>
        > <xs:enumeration value="GROUP"/>
        > <xs:enumeration value="DATE"/>
        > <xs:enumeration value="SWITCH"/>
        > </xs:restriction>
        ></xs:simpleType>
        >
        >If I code it like
        >
        >"return SOAP::Data->type(AEC_AttributeType => 'FILE');"
        >
        >I get an error.
        >
        I think that you need to provide your own serialiser for AEC_AttributeType.
        define a subroutine similar to this:

        sub SOAP::Serializer::as_mytype {
        my $self = shift;
        my($value, $name, $type, $attr) = @_;
        $attr->{'xsi:type'} = $type;
        return [$name, $attr, $value];
        }

        There's a little bit about this in the SOAP::Lite docs under SOAP::Serializer.

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