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

Complex types

Expand Messages
  • pela3247
    Dear list! I wonder how to deal with complex datatypes in wsdl-files. My WSDL-files looks like this ....
    Message 1 of 2 , Feb 17, 2006
    View Source
    • 0 Attachment
      Dear list!

      I wonder how to deal with complex datatypes in wsdl-files. My
      WSDL-files looks like this

      ....

      <complexType name="data">
      <all>
      <element name="type" type="xsd:string"></element>
      <element name="content" type="xsd:string"></element>
      </all>
      </complexType>

      <xsd:complexType name="arrayofdata">
      <xsd:complexContent>
      <xsd:restriction base="soapenc:Array">
      <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:data[]"/>
      </xsd:restriction>
      </xsd:complexContent>
      </xsd:complexType>

      ...

      In my imagination, this would me allow to send multiple data-types, ie
      an array of data. Am I completely out in the blue? How would such a
      thing look in perl-code? How do I then access my data on the server side?

      Cheers
      /Per
    • Eric Bridger
      See http://www.majordojo.com/archives/2003_04.html#000008 - How to nest XML elements using SOAP::Lite The trick is to use SOAP::Data objects and references to
      Message 2 of 2 , Feb 17, 2006
      View Source
      • 0 Attachment
        See http://www.majordojo.com/archives/2003_04.html#000008 - How to nest
        XML elements using SOAP::Lite

        The trick is to use SOAP::Data objects and references to SOAP::Data
        objects to build up complex xml.

        Don't have time to decipher your WSDL but here is an example
        (server-side) of building up an array. Same can be done on the client
        side to send to a server.
        ======================
        my @types = ();
        # datatypes are in $dt_ref
        foreach my $dtype ( sort keys %$dt_ref ) {
        my $type = SOAP::Data->name(gm_type => $dtype);
        push(@types,$type);
        }
        my $measuredTypes = SOAP::Data
        ->name(measuredTypes => \@types);

        Producing something like:


        <measuredTypes soapenc:arrayType="xsd:string[3]"
        xsi:type="soapenc:Array">
        <gm_type xsi:type="xsd:string">AIR_TEMPERATURE</gm_type>
        <gm_type xsi:type="xsd:string">CHLOROPHYLL</gm_type>
        <gm_type xsi:type="xsd:string">SEA_LEVEL_PRESSURE</gm_type>
        </measuredTypes>


        On Fri, 2006-02-17 at 07:53, pela3247 wrote:
        > Dear list!
        >
        > I wonder how to deal with complex datatypes in wsdl-files. My
        > WSDL-files looks like this
        >
        > ....
        >
        > <complexType name="data">
        > <all>
        > <element name="type" type="xsd:string"></element>
        > <element name="content" type="xsd:string"></element>
        > </all>
        > </complexType>
        >
        > <xsd:complexType name="arrayofdata">
        > <xsd:complexContent>
        > <xsd:restriction base="soapenc:Array">
        > <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:data[]"/>
        > </xsd:restriction>
        > </xsd:complexContent>
        > </xsd:complexType>
        >
        > ...
        >
        > In my imagination, this would me allow to send multiple data-types, ie
        > an array of data. Am I completely out in the blue? How would such a
        > thing look in perl-code? How do I then access my data on the server side?
        >
        > Cheers
        > /Per
        >
        >
        >
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.