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

Newbie question about SOAP:Lite

Expand Messages
  • fyang1024
    I m implementing a client endpoint in Perl using SOAP::Lite. The code is as following: my $ld_service =
    Message 1 of 6 , Nov 1, 2005
    View Source
    • 0 Attachment
      I'm implementing a client endpoint in Perl using SOAP::Lite. The code
      is as following:

      my $ld_service =
      SOAP::Lite->service("http://localhost/lams/services/LearningDesignService?wsdl");
      my @lds =
      $ld_service->getAllLearningDesigns($serverid,$datetime,$hashvalue,$username);

      The service endpoint is implemented in Java using Axis framework. The
      "getAllLearningDesigns" service will return an array of
      "SimpleLearningDesignVO" object defined in Java. The code is as following:

      /**
      * SimpleLearningDesignVO.java
      *
      * This file was auto-generated from WSDL
      * by the Apache Axis 1.2 May 03, 2005 (02:20:24 EDT) WSDL2Java emitter.
      */


      public class SimpleLearningDesignVO implements java.io.Serializable {
      private java.lang.Long sid;
      private java.lang.String title;
      private java.lang.String workspace;

      public SimpleLearningDesignVO() {
      }

      public SimpleLearningDesignVO(
      java.lang.Long sid,
      java.lang.String title,
      java.lang.String workspace) {
      this.sid = sid;
      this.title = title;
      this.workspace = workspace;
      }

      //omitted lots of irrelevant code
      }

      I implemented client endpoints both in Java and PHP, and both work fine.

      But when I run the code in Perl, it gave me this error message:



      duplicate attribute at line 1, column 455, byte 455 at
      D:/Perl/site/lib/XML/Parser.pm line 187
      <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"><soapenv:Body><ns1:getAllLearningDesignsResponse
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns1="urn:lamsws"><getAllLearningDesignsReturn
      soapenc:arrayType="ns1:SimpleLearningDesignVO[5]"
      xsi:type="soapenc:Array" xsi:type="ns1:ArrayOfSimpleLearningDesignVO"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><getAllLearningDesignsReturn
      href="#id0"/><getAllLearningDesignsReturn
      href="#id1"/><getAllLearningDesignsReturn
      href="#id2"/><getAllLearningDesignsReturn
      href="#id3"/><getAllLearningDesignsReturn
      href="#id4"/></getAllLearningDesignsReturn></ns1:getAllLearningDesignsResponse><multiRef
      id="id0" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns2:SimpleLearningDesignVO"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns2="urn:lamsws"><sid xsi:type="soapenc:long">200</sid><title
      xsi:type="soapenc:string">Test QA</title><workspace
      xsi:type="soapenc:string">public</workspace></multiRef><multiRef
      id="id2" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns3:SimpleLearningDesignVO"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns3="urn:lamsws"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><sid
      xsi:type="soapenc:long">231</sid><title
      xsi:type="soapenc:string">Optional Activity</title><workspace
      xsi:type="soapenc:string">public</workspace></multiRef><multiRef
      id="id4" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns4:SimpleLearningDesignVO"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns4="urn:lamsws"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><sid
      xsi:type="soapenc:long">246</sid><title
      xsi:type="soapenc:string">Greatness</title><workspace
      xsi:type="soapenc:string">public</workspace></multiRef><multiRef
      id="id1" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns5:SimpleLearningDesignVO"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns5="urn:lamsws"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><sid
      xsi:type="soapenc:long">214</sid><title
      xsi:type="soapenc:string">Group then Multitask
      Sequence</title><workspace
      xsi:type="soapenc:string">public</workspace></multiRef><multiRef
      id="id3" soapenc:root="0"
      soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xsi:type="ns6:SimpleLearningDesignVO"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:ns6="urn:lamsws"
      xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><sid
      xsi:type="soapenc:long">243</sid><title
      xsi:type="soapenc:string">Single Forum sequence</title><workspace
      xsi:type="soapenc:string">public</workspace></multiRef></soapenv:Body></soapenv:Envelope>
      at D:\Program Files\Apache Group\Apache2\perl\testws.pl line 36


      What's wrong with my code?

      Thanks.
    • Peter Sinnott
      ...
      Message 2 of 6 , Nov 2, 2005
      View Source
      • 0 Attachment
        On Wed, Nov 02, 2005 at 05:57:29AM -0000, fyang1024 wrote:
        > I'm implementing a client endpoint in Perl using SOAP::Lite. The code
        > is as following:
        >
        >
        > I implemented client endpoints both in Java and PHP, and both work fine.
        >
        > But when I run the code in Perl, it gave me this error message:
        >
        >
        >
        > duplicate attribute at line 1, column 455, byte 455 at
        > D:/Perl/site/lib/XML/Parser.pm line 187

        <getAllLearningDesignsReturn
        soapenc:arrayType="ns1:SimpleLearningDesignVO[5]"
        xsi:type="soapenc:Array"
        xsi:type="ns1:ArrayOfSimpleLearningDesignVO"
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        The getAllLearningDesignsReturn tag has 2 attributes with
        the same name xsi:type. This is not valid xml.

        >
        > What's wrong with my code?

        Nothing,it is a axis bug.

        http://issues.apache.org/jira/browse/AXIS-2100
        http://issues.apache.org/jira/browse/AXIS-2127

        There is a patch included with the bug reports but it
        should already be included in version 1.3

        http://www.apache.org/dyn/closer.cgi/ws/axis/1_3

        >
        > Thanks.

        --
        We exist to dramatically coordinate market-driven intellectual capital
        while maintaining the highest standards
      • fyang1024
        Thanks. Now It doesn t report error any more. But the result was unexpected. My Perl code is like this: my $ld_service =
        Message 3 of 6 , Nov 2, 2005
        View Source
        • 0 Attachment
          Thanks. Now It doesn't report error any more.
          But the result was unexpected.

          My Perl code is like this:
          my $ld_service = SOAP::Lite->service("$serverurl"."$relativeurl");

          my @lds =
          $ld_service->getAllLearningDesigns($serverid,$datetime,$hashvalue,$username);

          print "$#lds\n";
          foreach $ld (@lds){
          print "$ld{'id'},$ld{'workspace'},$ld{'title'}:\n";
          }

          The @lds turned out to be empty, but on the server side, Java reports
          it sent out an array of 5 objects.

          I believe there's something wrong in my Perl code, since the PHP/Java
          clients I wrote both work well.

          Can anybody point it out? Many thanks.
        • Eric Bridger
          You service method call getAllLearningsDesigns will return a reference to an array which you must dereference: my $ref = $ld_service- getAll.... my @lds =
          Message 4 of 6 , Nov 10, 2005
          View Source
          • 0 Attachment
            You service method call getAllLearningsDesigns will return a reference
            to an array which you must dereference:
            my $ref = $ld_service->getAll....

            my @lds = @{$ref};

            Eric


            On Wed, 2005-11-02 at 22:30, fyang1024 wrote: Thanks. Now It doesn't
            report error any more.
            But the result was unexpected.

            My Perl code is like this:
            my $ld_service = SOAP::Lite->service("$serverurl"."$relativeurl");

            my @lds =
            $ld_service->getAllLearningDesigns($serverid,$datetime,$hashvalue,$username);

            print "$#lds\n";
            foreach $ld (@lds){
            print "$ld{'id'},$ld{'workspace'},$ld{'title'}:\n";
            }

            The @lds turned out to be empty, but on the server side, Java reports
            it sent out an array of 5 objects.

            I believe there's something wrong in my Perl code, since the PHP/Java
            clients I wrote both work well.

            Can anybody point it out? Many thanks.






            ________________________________________________________________________
            YAHOO! GROUPS LINKS

            1. Visit your group "soaplite" on the web.

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

            3. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            Service.

            ________________________________________________________________________
          • Fei Yang
            I tried this and it still doesn t work. I have already implemented a new method which returns a single string instead of an array of objects in service
            Message 5 of 6 , Nov 14, 2005
            View Source
            • 0 Attachment
              I tried this and it still doesn't work.
              I have already implemented a new method which returns
              a single string instead of an array of objects in
              service endpoint to walk around this problem.

              Here is the message from Bryan Reese:

              Axis does not support SOAP encoding, which is the
              default of SOAP::Lite.

              I would encourage you to install SOAP::Lite 0.65_6
              from sourceforge:
              http://sourceforge.net/project/showfiles.php?group_id=66000

              Try calling the service using the updated software via
              WSDL. If it doesn't work, I would suggest you consult
              documentation at majordojo about how to compose a
              message manually:

              http://www.majordojo.com/soaplite/


              --- Eric Bridger <eric@...> wrote:

              > You service method call getAllLearningsDesigns will
              > return a reference
              > to an array which you must dereference:
              > my $ref = $ld_service->getAll....
              >
              > my @lds = @{$ref};
              >
              > Eric
              >
              >
              > On Wed, 2005-11-02 at 22:30, fyang1024 wrote:
              > Thanks. Now It doesn't
              > report error any more.
              > But the result was unexpected.
              >
              > My Perl code is like this:
              > my $ld_service =
              > SOAP::Lite->service("$serverurl"."$relativeurl");
              >
              > my @lds =
              >
              $ld_service->getAllLearningDesigns($serverid,$datetime,$hashvalue,$username);
              >
              > print "$#lds\n";
              > foreach $ld (@lds){
              > print
              > "$ld{'id'},$ld{'workspace'},$ld{'title'}:\n";
              > }
              >
              > The @lds turned out to be empty, but on the server
              > side, Java reports
              > it sent out an array of 5 objects.
              >
              > I believe there's something wrong in my Perl code,
              > since the PHP/Java
              > clients I wrote both work well.
              >
              > Can anybody point it out? Many thanks.
              >
              >
              >
              >
              >
              >
              >
              ________________________________________________________________________
              > YAHOO! GROUPS LINKS
              >
              > 1. Visit your group "soaplite" on the web.
              >
              > 2. To unsubscribe from this group, send an
              > email to:
              > soaplite-unsubscribe@yahoogroups.com
              >
              > 3. Your use of Yahoo! Groups is subject to
              > the Yahoo! Terms of
              > Service.
              >
              >
              ________________________________________________________________________
              >
              >
              >
              >




              ____________________________________________________
              Do you Yahoo!?
              Find a local business fast with Yahoo! Local Search
              http://au.local.yahoo.com
            • Eric Bridger
              The key is upgrading to version 0.65 On Mon, 2005-11-14 at 19:35, Fei Yang wrote: I tried this and it still doesn t work. I have already implemented a new
              Message 6 of 6 , Nov 15, 2005
              View Source
              • 0 Attachment
                The key is upgrading to version 0.65


                On Mon, 2005-11-14 at 19:35, Fei Yang wrote: I tried this and it still
                doesn't work.
                I have already implemented a new method which returns
                a single string instead of an array of objects in
                service endpoint to walk around this problem.

                Here is the message from Bryan Reese:

                Axis does not support SOAP encoding, which is the
                default of SOAP::Lite.

                I would encourage you to install SOAP::Lite 0.65_6
                from sourceforge:
                http://sourceforge.net/project/showfiles.php?group_id=66000

                Try calling the service using the updated software via
                WSDL. If it doesn't work, I would suggest you consult
                documentation at majordojo about how to compose a
                message manually:

                http://www.majordojo.com/soaplite/


                --- Eric Bridger <eric@...> wrote:

                > You service method call getAllLearningsDesigns will
                > return a reference
                > to an array which you must dereference:
                > my $ref = $ld_service->getAll....
                >
                > my @lds = @{$ref};
                >
                > Eric
                >
                >
                > On Wed, 2005-11-02 at 22:30, fyang1024 wrote:
                > Thanks. Now It doesn't
                > report error any more.
                > But the result was unexpected.
                >
                > My Perl code is like this:
                > my $ld_service =
                > SOAP::Lite->service("$serverurl"."$relativeurl");
                >
                > my @lds =
                >
                $ld_service->getAllLearningDesigns($serverid,$datetime,$hashvalue,$username);
                >
                > print "$#lds\n";
                > foreach $ld (@lds){
                > print
                > "$ld{'id'},$ld{'workspace'},$ld{'title'}:\n";
                > }
                >
                > The @lds turned out to be empty, but on the server
                > side, Java reports
                > it sent out an array of 5 objects.
                >
                > I believe there's something wrong in my Perl code,
                > since the PHP/Java
                > clients I wrote both work well.
                >
                > Can anybody point it out? Many thanks.
                >
                >
                >
                >
                >
                >
                >
                ________________________________________________________________________
                > YAHOO! GROUPS LINKS
                >
                > 1. Visit your group "soaplite" on the web.
                >
                > 2. To unsubscribe from this group, send an
                > email to:
                > soaplite-unsubscribe@yahoogroups.com
                >
                > 3. Your use of Yahoo! Groups is subject to
                > the Yahoo! Terms of
                > Service.
                >
                >
                ________________________________________________________________________
                >
                >
                >
                >




                ____________________________________________________
                Do you Yahoo!?
                Find a local business fast with Yahoo! Local Search
                http://au.local.yahoo.com


                SPONSORED LINKS
                Protocol analyzer
                Ssl protocol
                Protocol converter
                Sip protocol
                Protocol analysis
                Protocol

                ________________________________________________________________________
                YAHOO! GROUPS LINKS

                1. Visit your group "soaplite" on the web.

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

                3. 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.