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

array of struct

Expand Messages
  • John Liu
    Hi, there, Tony provided an example of sending a struct from SOAP::Lite. I tried to test echoStructArray use the php SOAPx4 endpoint, I couldnot make it work:
    Message 1 of 4 , Oct 15, 2001
    • 0 Attachment
      Hi, there,

      Tony provided an example of sending a struct
      from SOAP::Lite.

      I tried to test echoStructArray use the php SOAPx4 endpoint,
      I couldnot make it work:

      use SOAP::Lite +trace;

      SOAP::Data->import('name');

      my %hash = (
      varInt => 5,
      varString => "test string",
      varFloat => 6.2
      );

      my %hash2 = (
      varInt => 5,
      varString => "test string2",
      varFloat => 6.2
      );


      push (@arr, \%hash, \%hash2);

      $h=SOAP::Lite
      -> uri('http://soapinterop.org/')
      -> proxy('http://dietrich.ganx4.com/soapx4/soap.php')
      -> echoStructArray(name("testStruct" => \@arr));
      ...

      the trace:
      SOAP::Transport::new: ()
      SOAP::Serializer::new: ()
      SOAP::Deserializer::new: ()
      SOAP::Parser::new: ()
      SOAP::Lite::new: ()
      SOAP::Transport::HTTP::Client::new: ()
      SOAP::Data::new: ()
      SOAP::Lite::call: ()
      SOAP::Serializer::envelope: ()
      SOAP::Serializer::envelope: echoStructArray SOAP::Data=HASH(0x82906c0)
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x83aeea8)
      SOAP::Transport::HTTP::Client::send_receive: POST
      http://dietrich.ganx4.com/soapx4/soap.php
      Accept: text/xml
      Accept: multipart/*
      Content-Length: 987
      Content-Type: text/xml; charset=utf-8
      SOAPAction: "http://soapinterop.org/#echoStructArray"

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      xmlns:namesp1="http://xml.apache.org/xml-soap"><SOAP-ENV:Body><namesp2:echoS
      tructArray xmlns:namesp2="http://soapinterop.org/"><testStruct
      SOAP-ENC:arrayType="namesp1:SOAPStruct[2]" xsi:type="SOAP-ENC:Array"><item
      xsi:type="namesp1:SOAPStruct"><varFloat
      xsi:type="xsd:float">6.2</varFloat><varString xsi:type="xsd:string">test
      string</varString><varInt xsi:type="xsd:int">5</varInt></item><item
      xsi:type="namesp1:SOAPStruct"><varFloat
      xsi:type="xsd:float">6.2</varFloat><varString xsi:type="xsd:string">test
      string2</varString><varInt
      xsi:type="xsd:int">5</varInt></item></testStruct></namesp2:echoStructArray><
      /SOAP-ENV:Body></SOAP-ENV:Envelope>
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x84c414c)
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
      Connection: Close
      Date: Mon, 15 Oct 2001 22:32:00 GMT
      Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_gzip/1.3.19.1a
      Content-Length: 899
      Content-Type: text/xml; charset=UTF-8
      Client-Date: Mon, 15 Oct 2001 22:37:07 GMT
      Client-Peer: 64.65.61.213:80
      Status: 200
      X-Powered-By: PHP/4.0.6

      <?xml version="1.0"?>
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:si="http://soapinterop.org/xsd"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
      <echoStructArrayResponse>
      <echoStructArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":struct[2]">
      <item>
      <varFloat xsi:type="xsd:float">6.2</varFloat>
      <varString xsi:type="xsd:string">test string</varString>
      <varInt xsi:type="xsd:int">5</varInt>
      </item>
      <item>
      <varFloat xsi:type="xsd:float">6.2</varFloat>
      <varString xsi:type="xsd:string">test string2</varString>
      <varInt xsi:type="xsd:int">5</varInt>
      </item>
      </echoStructArray>
      </echoStructArrayResponse>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      SOAP::Deserializer::deserialize: ()
      SOAP::Parser::decode: ()
      Unspecified namespace for type ':struct[2]'
      <?xml version="1.0"?>
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:si="http://soapinterop.org/xsd"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
      <echoStructArrayResponse>
      <echoStructArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":struct[2]">
      <item>
      <varFloat xsi:type="xsd:float">6.2</varFloat>
      <varString xsi:type="xsd:string">test string</varString>
      <varInt xsi:type="xsd:int">5</varInt>
      </item>
      <item>
      <varFloat xsi:type="xsd:float">6.2</varFloat>
      <varString xsi:type="xsd:string">test string2</varString>
      <varInt xsi:type="xsd:int">5</varInt>
      </item>
      </echoStructArray>
      </echoStructArrayResponse>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      at teststruct1.pl line 22
      SOAP::Lite::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Transport::HTTP::Client::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Parser::DESTROY: ()

      Can anybody help?

      Thanks.

      johnl
    • Paul Kulchenko
      Hi, John! ... arrayType that SOAPx4 returns doesn t look valid to me, hence SOAP::Lite complains. Dietrich? Best wishes, Paul. ...
      Message 2 of 4 , Oct 15, 2001
      • 0 Attachment
        Hi, John!

        > I tried to test echoStructArray use the php SOAPx4 endpoint,
        > I couldnot make it work:
        > SOAP-ENC:arrayType=":struct[2]">
        > Unspecified namespace for type ':struct[2]'
        arrayType that SOAPx4 returns doesn't look valid to me, hence
        SOAP::Lite complains. Dietrich?

        Best wishes, Paul.

        --- John Liu <johnl@...> wrote:
        > Hi, there,
        >
        > Tony provided an example of sending a struct
        > from SOAP::Lite.
        >
        > I tried to test echoStructArray use the php SOAPx4 endpoint,
        > I couldnot make it work:
        >
        > use SOAP::Lite +trace;
        >
        > SOAP::Data->import('name');
        >
        > my %hash = (
        > varInt => 5,
        > varString => "test string",
        > varFloat => 6.2
        > );
        >
        > my %hash2 = (
        > varInt => 5,
        > varString => "test string2",
        > varFloat => 6.2
        > );
        >
        >
        > push (@arr, \%hash, \%hash2);
        >
        > $h=SOAP::Lite
        > -> uri('http://soapinterop.org/')
        > -> proxy('http://dietrich.ganx4.com/soapx4/soap.php')
        > -> echoStructArray(name("testStruct" => \@arr));
        > ...
        >
        > the trace:
        > SOAP::Transport::new: ()
        > SOAP::Serializer::new: ()
        > SOAP::Deserializer::new: ()
        > SOAP::Parser::new: ()
        > SOAP::Lite::new: ()
        > SOAP::Transport::HTTP::Client::new: ()
        > SOAP::Data::new: ()
        > SOAP::Lite::call: ()
        > SOAP::Serializer::envelope: ()
        > SOAP::Serializer::envelope: echoStructArray
        > SOAP::Data=HASH(0x82906c0)
        > SOAP::Data::new: ()
        > SOAP::Data::new: ()
        > SOAP::Data::new: ()
        > SOAP::Data::new: ()
        > SOAP::Data::new: ()
        > SOAP::Transport::HTTP::Client::send_receive:
        > HTTP::Request=HASH(0x83aeea8)
        > SOAP::Transport::HTTP::Client::send_receive: POST
        > http://dietrich.ganx4.com/soapx4/soap.php
        > Accept: text/xml
        > Accept: multipart/*
        > Content-Length: 987
        > Content-Type: text/xml; charset=utf-8
        > SOAPAction: "http://soapinterop.org/#echoStructArray"
        >
        > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
        > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        >
        xmlns:namesp1="http://xml.apache.org/xml-soap"><SOAP-ENV:Body><namesp2:echoS
        > tructArray xmlns:namesp2="http://soapinterop.org/"><testStruct
        > SOAP-ENC:arrayType="namesp1:SOAPStruct[2]"
        > xsi:type="SOAP-ENC:Array"><item
        > xsi:type="namesp1:SOAPStruct"><varFloat
        > xsi:type="xsd:float">6.2</varFloat><varString
        > xsi:type="xsd:string">test
        > string</varString><varInt xsi:type="xsd:int">5</varInt></item><item
        > xsi:type="namesp1:SOAPStruct"><varFloat
        > xsi:type="xsd:float">6.2</varFloat><varString
        > xsi:type="xsd:string">test
        > string2</varString><varInt
        >
        xsi:type="xsd:int">5</varInt></item></testStruct></namesp2:echoStructArray><
        > /SOAP-ENV:Body></SOAP-ENV:Envelope>
        > SOAP::Transport::HTTP::Client::send_receive:
        > HTTP::Response=HASH(0x84c414c)
        > SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
        > Connection: Close
        > Date: Mon, 15 Oct 2001 22:32:00 GMT
        > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_gzip/1.3.19.1a
        > Content-Length: 899
        > Content-Type: text/xml; charset=UTF-8
        > Client-Date: Mon, 15 Oct 2001 22:37:07 GMT
        > Client-Peer: 64.65.61.213:80
        > Status: 200
        > X-Powered-By: PHP/4.0.6
        >
        > <?xml version="1.0"?>
        > <SOAP-ENV:Envelope
        > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:si="http://soapinterop.org/xsd"
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        > <SOAP-ENV:Body>
        > <echoStructArrayResponse>
        > <echoStructArray xsi:type="SOAP-ENC:Array"
        > SOAP-ENC:arrayType=":struct[2]">
        > <item>
        > <varFloat xsi:type="xsd:float">6.2</varFloat>
        > <varString xsi:type="xsd:string">test string</varString>
        > <varInt xsi:type="xsd:int">5</varInt>
        > </item>
        > <item>
        > <varFloat xsi:type="xsd:float">6.2</varFloat>
        > <varString xsi:type="xsd:string">test string2</varString>
        > <varInt xsi:type="xsd:int">5</varInt>
        > </item>
        > </echoStructArray>
        > </echoStructArrayResponse>
        > </SOAP-ENV:Body>
        > </SOAP-ENV:Envelope>
        > SOAP::Deserializer::deserialize: ()
        > SOAP::Parser::decode: ()
        > Unspecified namespace for type ':struct[2]'
        > <?xml version="1.0"?>
        > <SOAP-ENV:Envelope
        > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:si="http://soapinterop.org/xsd"
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        > <SOAP-ENV:Body>
        > <echoStructArrayResponse>
        > <echoStructArray xsi:type="SOAP-ENC:Array"
        > SOAP-ENC:arrayType=":struct[2]">
        > <item>
        > <varFloat xsi:type="xsd:float">6.2</varFloat>
        > <varString xsi:type="xsd:string">test string</varString>
        > <varInt xsi:type="xsd:int">5</varInt>
        > </item>
        > <item>
        > <varFloat xsi:type="xsd:float">6.2</varFloat>
        > <varString xsi:type="xsd:string">test string2</varString>
        > <varInt xsi:type="xsd:int">5</varInt>
        > </item>
        > </echoStructArray>
        > </echoStructArrayResponse>
        > </SOAP-ENV:Body>
        > </SOAP-ENV:Envelope>
        > at teststruct1.pl line 22
        > SOAP::Lite::DESTROY: ()
        > SOAP::Transport::DESTROY: ()
        > SOAP::Transport::HTTP::Client::DESTROY: ()
        > SOAP::Deserializer::DESTROY: ()
        > SOAP::Serializer::DESTROY: ()
        > SOAP::Data::DESTROY: ()
        > SOAP::Data::DESTROY: ()
        > SOAP::Data::DESTROY: ()
        > SOAP::Data::DESTROY: ()
        > SOAP::Data::DESTROY: ()
        > SOAP::Data::DESTROY: ()
        > SOAP::Parser::DESTROY: ()
        >
        > Can anybody help?
        >
        > Thanks.
        >
        > johnl
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > 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!?
        Make a great connection at Yahoo! Personals.
        http://personals.yahoo.com
      • John Liu
        Paul, Thanks for the quick response. 1. I realized this is not an easy issue - [am i right, Dietrich?] 1) there re other implementations treat :struct[] as a
        Message 3 of 4 , Oct 16, 2001
        • 0 Attachment
          Paul, Thanks for the quick response.

          1. I realized this is not an easy issue - [am i right, Dietrich?]
          1) there're other implementations treat ':struct[]' as a valid type
          see:
          - <echoStructArray xsi:type="SOAP-ENC:Array"
          SOAP-ENC:arrayType=":struct[4]">
          http://tclsoap.sourceforge.net/silab/round2base.html
          <echoStructArray xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":struct[2]">
          http://www.phalanxsys.com/soapclient/echoStructArray.htm#SOAPx4

          2) other implementations not happy with it, like
          com.hp.soap.handlerAPI.TypeUnsupportedException: Malformed type :struct[2]
          HP-SOAP http://soap.bluestone.com/interop/EchoService/results/client/

          2. I donot understand how http://interop.soaplite.com/#SOAP4x passed the
          soap4x
          echoStructArray test. Would you mind showing me the soaplite echoStructArray
          client test code?
          How did you map php's StructArray[array of array?] to soaplite StructArray
          [array of hash?], an example?

          3. While burning oil at night,
          I started to cast doubts on the promises of simpleness -
          SOAP/or the current ways to implement it -
          it attracts and traps as well.

          The current many implementations and interop tests are good news.
          But each implementation is straggly to fully conform std.
          interop test sets and test each other may not be a very efficient
          way to realize the promises of SOAP.

          Just think the following simple facts - not so much an issue for different
          programming langs. to understand each other
          in simple atomic data types such as string, array;
          but many problems in complex types. We got to have a simple approach like
          those
          simple data types, different langs. can find common grounds.

          To me, programming lang. barriers are only the surface problem, the problem
          is lacking a clear yet practical
          neutral representation in wire layer - to define and test standard formulas
          how to translate complex types between common programming languages, for
          example,
          Formula = lookup[structArray][java->perl], by providing definitions and
          methods how
          java's structArray translates to perl's structArray by using atomic data
          types(?), etc.
          - This provides a better set of testbed,
          it masks the details of each lang., and avoids the time consuming guess or
          specific deserielizer in
          each implementation wire layer per lang. This layer can naturally link to
          xsd.

          Just some thoughts ...

          Back to the reality., I do want to find some simple examples about
          echoStructArray,
          perl-java-c++-php-tcl-ruby-.net, to convey array of structs, eps.
          perl-php-java?

          Thanks very much.

          johnl

          -----Original Message-----
          From: Paul Kulchenko [mailto:paulclinger@...]
          Sent: Monday, October 15, 2001 6:08 PM
          To: soaplite@yahoogroups.com
          Cc: dietrich@...; zliu@...
          Subject: Re: [soaplite] array of struct


          Hi, John!

          > I tried to test echoStructArray use the php SOAPx4 endpoint,
          > I couldnot make it work:
          > SOAP-ENC:arrayType=":struct[2]">
          > Unspecified namespace for type ':struct[2]'
          arrayType that SOAPx4 returns doesn't look valid to me, hence
          SOAP::Lite complains. Dietrich?

          Best wishes, Paul.
        • Dana Powers
          Paul s SOAP::Lite package also provides a wonderful implementation of the XML-RPC protocol, which is a much lighter weight way to do what SOAP does. Check out
          Message 4 of 4 , Oct 16, 2001
          • 0 Attachment
            Paul's SOAP::Lite package also provides a wonderful implementation of the
            XML-RPC protocol, which is a much lighter weight way to do what SOAP does.
            Check out www.xmlrpc.org for more information. It currently lists 50
            implementations in 34 languages/environments. We had used SOAP for cross
            platform interoperability in a large commercial environment, but ran into
            the same sorts of problems that you did. After that, we've switched to
            XML-RPC for everything.
            dpk

            ----- Original Message -----
            From: "John Liu" <johnl@...>
            To: <soaplite@yahoogroups.com>
            Sent: Tuesday, October 16, 2001 6:56 AM
            Subject: RE: [soaplite] array of struct


            > Paul, Thanks for the quick response.
            >
            > 1. I realized this is not an easy issue - [am i right, Dietrich?]
            > 1) there're other implementations treat ':struct[]' as a valid type
            > see:
            > - <echoStructArray xsi:type="SOAP-ENC:Array"
            > SOAP-ENC:arrayType=":struct[4]">
            > http://tclsoap.sourceforge.net/silab/round2base.html
            > <echoStructArray xsi:type="SOAP-ENC:Array"
            SOAP-ENC:arrayType=":struct[2]">
            > http://www.phalanxsys.com/soapclient/echoStructArray.htm#SOAPx4
            >
            > 2) other implementations not happy with it, like
            > com.hp.soap.handlerAPI.TypeUnsupportedException: Malformed type :struct[2]
            > HP-SOAP http://soap.bluestone.com/interop/EchoService/results/client/
            >
            > 2. I donot understand how http://interop.soaplite.com/#SOAP4x passed the
            > soap4x
            > echoStructArray test. Would you mind showing me the soaplite
            echoStructArray
            > client test code?
            > How did you map php's StructArray[array of array?] to soaplite StructArray
            > [array of hash?], an example?
            >
            > 3. While burning oil at night,
            > I started to cast doubts on the promises of simpleness -
            > SOAP/or the current ways to implement it -
            > it attracts and traps as well.
            >
            > The current many implementations and interop tests are good news.
            > But each implementation is straggly to fully conform std.
            > interop test sets and test each other may not be a very efficient
            > way to realize the promises of SOAP.
            >
            > Just think the following simple facts - not so much an issue for different
            > programming langs. to understand each other
            > in simple atomic data types such as string, array;
            > but many problems in complex types. We got to have a simple approach like
            > those
            > simple data types, different langs. can find common grounds.
            >
            > To me, programming lang. barriers are only the surface problem, the
            problem
            > is lacking a clear yet practical
            > neutral representation in wire layer - to define and test standard
            formulas
            > how to translate complex types between common programming languages, for
            > example,
            > Formula = lookup[structArray][java->perl], by providing definitions and
            > methods how
            > java's structArray translates to perl's structArray by using atomic data
            > types(?), etc.
            > - This provides a better set of testbed,
            > it masks the details of each lang., and avoids the time consuming guess or
            > specific deserielizer in
            > each implementation wire layer per lang. This layer can naturally link to
            > xsd.
            >
            > Just some thoughts ...
            >
            > Back to the reality., I do want to find some simple examples about
            > echoStructArray,
            > perl-java-c++-php-tcl-ruby-.net, to convey array of structs, eps.
            > perl-php-java?
            >
            > Thanks very much.
            >
            > johnl
            >
            > -----Original Message-----
            > From: Paul Kulchenko [mailto:paulclinger@...]
            > Sent: Monday, October 15, 2001 6:08 PM
            > To: soaplite@yahoogroups.com
            > Cc: dietrich@...; zliu@...
            > Subject: Re: [soaplite] array of struct
            >
            >
            > Hi, John!
            >
            > > I tried to test echoStructArray use the php SOAPx4 endpoint,
            > > I couldnot make it work:
            > > SOAP-ENC:arrayType=":struct[2]">
            > > Unspecified namespace for type ':struct[2]'
            > arrayType that SOAPx4 returns doesn't look valid to me, hence
            > SOAP::Lite complains. Dietrich?
            >
            > Best wishes, Paul.
            >
            >
            >
            > 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/
            >
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.