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

ComplexType

Expand Messages
  • xiaoling_leng
    Dear All, I am a new SOAPLite user, I am trying to write a SOAP::Lite client to talk to my GSOAP server. I had a little bit of progress Yesterday, but still
    Message 1 of 2 , Nov 3, 2004
    • 0 Attachment
      Dear All,

      I am a new SOAPLite user, I am trying to write a SOAP::Lite client
      to talk to my GSOAP server. I had a little bit of progress
      Yesterday, but still haveing problem to send right SOAP data
      structure through. Anyone can help me please!!

      ________________________________________
      part of WSDL file
      _______________________________________
      <types>

      <schema targetNamespace="http://npc57.hopewiser.com/TableService"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:table="http://npc57.hopewiser.com/TableService"
      xmlns="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified"
      attributeFormDefault="qualified">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType name="Field">
      <sequence>
      <element name="name" type="xsd:string" minOccurs="0"
      maxOccurs="1" nillable="true"/>
      <element name="type" type="xsd:string" minOccurs="0"
      maxOccurs="1" nillable="true"/>
      <element name="value" type="xsd:string" minOccurs="0"
      maxOccurs="1" nillable="true"/>
      </sequence>
      </complexType>
      <complexType name="ArrayOfField">
      <sequence>
      <element name="tablename" type="xsd:string" minOccurs="0"
      maxOccurs="1" nillable="true"/>
      <element name="fld" type="table:Field" minOccurs="1"
      maxOccurs="unbounded"/>
      </sequence>
      </complexType>
      </schema>
      </types>
      <message name="insertRecRequest">
      <part name="TableDef" type="table:ArrayOfField"/>
      </message>

      _____________________________________
      part of my SOAP::Lite client
      _____________________________________

      my $tablename = 'PROV';

      for($i=0;$i<10; $i++){
      $fld[$i] = SOAP::Data
      ->name (fld=>
      \ SOAP::Data->value(
      SOAP::Data->name('name' => $name[$i]),
      SOAP::Data->name('type' => $type[$i]),
      SOAP::Data->name('value' => $value[$i])
      ));
      }
      my $params = SOAP::Data
      ->name(TableDef =>
      \SOAP::Data->value(
      SOAP::Data->name(tablename => $tablename),
      SOAP::Data->name(fld =>
      [map{
      SOAP::Data->name(fld => $_)->type('Field')
      } @fld]
      )));

      my $table = SOAP::Lite
      -> service('file:./TableService.wsdl');
      my $tir = $table->insertRec($params);

      _____________________________________
      The XML data structure looks like
      -------------------------------------
      <TableDef>
      <tablename xsi:type="xsd:string">PROV</tablename>
      <fld xsi:type="SOAP-ENC:Array"
      SOAP-ENC:arrayType="xsd:ur-type[10]">
      <fld>
      <name xsi:type="xsd:string">UID</name>
      <type xsi:type="xsd:string">BIGINT(8)</type>
      <value xsi:type="xsd:int">22</value>
      </fld>
      <fld>
      <name xsi:type="xsd:string">UPRN</name>
      <type xsi:type="xsd:string">BIGINT(12)
      </type><value xsi:type="xsd:long">100021275644</value>
      </fld>
      <fld>
      <name xsi:type="xsd:string">CHANGE_TYPE</name>
      <type xsi:type="xsd:string">CHAR(1)</type>
      <value xsi:type="xsd:string">I</value>
      </fld>
      <fld>
      <name xsi:type="xsd:string">PROVENANCE_CODE</name>
      <type xsi:type="xsd:string">CHAR(1)</type>
      <value xsi:type="xsd:string">U</value>
      </fld>
      </fld>
      </TableDef>


      ---------------------------------------------------
      The structure had one more layer of <fld> which is not what I wanted
      But I don't know how to get rid of it. Anyone out there can help
      please!

      Thank you.


      Xiaoling
    • Andrew Cooks
      Hi Xiaoling ... I had similar problems using ComplexTypes, SOAP::Lite and wsdl files. I suggest you also investigate SOAP::WSDL
      Message 2 of 2 , Nov 3, 2004
      • 0 Attachment
        Hi Xiaoling

        xiaoling_leng wrote:
        >
        > I am a new SOAPLite user, I am trying to write a SOAP::Lite client
        > to talk to my GSOAP server. I had a little bit of progress
        > Yesterday, but still haveing problem to send right SOAP data
        > structure through. Anyone can help me please!!
        >

        I had similar problems using ComplexTypes, SOAP::Lite and wsdl files.

        I suggest you also investigate SOAP::WSDL
        (http://search.cpan.org/~mkutter/SOAP-WSDL-1.20/WSDL.pm) if you need to
        use ComplexTypes and wsdl files. It simplified my work a lot.

        Regards

        Andrew
      Your message has been successfully submitted and would be delivered to recipients shortly.