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

String value expected instead of ARRAY reference for unbounded element

Expand Messages
  • bstrathearn
    I m using SOAP::Lite 0.69 CPAN and am trying to implement a client for a service WSDL published here: http://strathearns.org/wds/usps_ws.wsdl While generating
    Message 1 of 6 , Oct 3, 2006
    • 0 Attachment
      I'm using SOAP::Lite 0.69 CPAN and am trying to implement a client for
      a service WSDL published here: http://strathearns.org/wds/usps_ws.wsdl

      While generating arguments for the batch_lookup() function, SOAP::Lite
      with traces turned on, generates an error message if I try to pass an
      array of strings into the second argument. Passing a single string
      will allow the request to succeed and generate correct results.

      If my schema defines the input message as:

      ----------
      <xsd:element name="batch_lookup">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element maxOccurs="1" name="jid-prefix" type="xsd:string"/>
      <xsd:element maxOccurs="unbounded" name="url" type="xsd:string"/>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      ----------

      Then why would SOAP::Lite fail with the following test code:

      ----------
      #!/usr/bin/perl -w

      use SOAP::Lite + "trace";
      my $usps_ws_service = SOAP::Lite
      -> service('http://strathearns.org/wds/usps_ws.wsdl');

      $urls = ["foo.com","bar.org"];
      $result = $usps_ws_service->batch_lookup("thejidprefix",$urls);
      ----------



      The traced error output is:

      ----------
      SOAP::Transport::HTTP::Client::new: ()
      String value expected instead of ARRAY reference
      SOAP::Lite::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      SOAP::Parser::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Transport::HTTP::Client::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      ----------
    • Scott Wiersdorf
      ... You might try this patch to Lite.pm: ... +++ SOAP-Lite-0.69-patched3/lib/SOAP/Lite.pm 2006-08-28 09:19:27.000000000 -0600 @@ -3040,7 +3040,7 @@
      Message 2 of 6 , Oct 4, 2006
      • 0 Attachment
        On Tue, Oct 03, 2006 at 07:12:20PM -0000, bstrathearn wrote:
        > I'm using SOAP::Lite 0.69 CPAN and am trying to implement a client for
        > a service WSDL published here: http://strathearns.org/wds/usps_ws.wsdl

        You might try this patch to Lite.pm:

        <snip>
        --- SOAP-Lite-0.69/lib/SOAP/Lite.pm 2006-08-16 08:49:34.000000000 -0600
        +++ SOAP-Lite-0.69-patched3/lib/SOAP/Lite.pm 2006-08-28 09:19:27.000000000 -0600
        @@ -3040,7 +3040,7 @@
        my $method = 'as_'.$typename;
        # TODO - if can('as_'.$typename) {...}
        my $result = $self->serializer->$method($param, $template->name, $template->type, $template->attr);
        - push(@parameters, $template->value($result->[2]));
        + push(@parameters, $template->value($result ? $result->[2] : $param));
        } else {
        push(@parameters, $param);
        }
        </snip>

        Byrne has this patch, but has been busy with other things.

        Please let me know if it works (or not).

        Scott
        --
        Scott Wiersdorf
        <scott@...>
      • bstrathearn
        Thanks for the timley response. Got the same error after patching, so I ll await the full release update or revert back to 0.60 which some others seem to have
        Message 3 of 6 , Oct 4, 2006
        • 0 Attachment
          Thanks for the timley response.

          Got the same error after patching, so I'll await the full release
          update or revert back to 0.60 which some others seem to have successes
          with for similar WSDLs.



          --- In soaplite@yahoogroups.com, Scott Wiersdorf <scott@...> wrote:
          >
          > On Tue, Oct 03, 2006 at 07:12:20PM -0000, bstrathearn wrote:
          > > I'm using SOAP::Lite 0.69 CPAN and am trying to implement a client for
          > > a service WSDL published here: http://strathearns.org/wds/usps_ws.wsdl
          >
          > You might try this patch to Lite.pm:
          >
          > <snip>
          > --- SOAP-Lite-0.69/lib/SOAP/Lite.pm 2006-08-16
          08:49:34.000000000 -0600
          > +++ SOAP-Lite-0.69-patched3/lib/SOAP/Lite.pm 2006-08-28
          09:19:27.000000000 -0600
          > @@ -3040,7 +3040,7 @@
          > my $method = 'as_'.$typename;
          > # TODO - if can('as_'.$typename) {...}
          > my $result = $self->serializer->$method($param,
          $template->name, $template->type, $template->attr);
          > - push(@parameters, $template->value($result->[2]));
          > + push(@parameters, $template->value($result ? $result->[2] :
          $param));
          > } else {
          > push(@parameters, $param);
          > }
          > </snip>
          >
          > Byrne has this patch, but has been busy with other things.
          >
          > Please let me know if it works (or not).
          >
          > Scott
          > --
          > Scott Wiersdorf
          > <scott@...>
          >
        • bstrathearn
          Sadly, all versions after 0.60 had the same problem. Tried 0.60 and ... thejidprefix
          Message 4 of 6 , Oct 4, 2006
          • 0 Attachment
            Sadly, all versions after 0.60 had the same problem.  Tried 0.60 and 0.55, and those accept the input but mangle the request into:

            ----------
            <SOAP-ENV:Body>
             <batch_lookup xmlns="">
              <batch_lookup>thejidprefix</batch_lookup>
              <SOAP-ENC:Array xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]">
               <item xsi:type="xsd:string">a</item>
               <item xsi:type="xsd:string">b</item>
              </SOAP-ENC:Array>
             </batch_lookup>
            </SOAP-ENV:Body>
            ----------

            My WSDL input message looks very similar to a few listed in Google's AdSense API.  How are they claiming success with 0.60 when my example fails?
            from: http://strathearns.org/wds/usps_ws.wsdl
            <xsd:element name="batch_lookup">
            <xsd:complexType>
            <xsd:sequence>
            <xsd:element maxOccurs="1" name="jid-prefix" type="xsd:string"/>
            <xsd:element maxOccurs="unbounded" name="url" type="xsd:string"/>
            </xsd:sequence>
            </xsd:complexType>
            </xsd:element>
            from: https://www.google.com/api/adsense/v2/AccountService?wsdl
            <element name="createAdSenseAccount">
             <complexType>
              <sequence>
               <element name="loginEmail" type="xsd:string"/>
               <element name="entityType" type="impl:EntityType"/>
               <element name="websiteUrl" type="xsd:string"/>
               <element name="websiteLocale" type="xsd:string"/>
               <element name="usersPreferredLocale" type="xsd:string"/>
               <element name="emailPromotionPreferences" type="xsd:boolean"/>
               <element maxOccurs="unbounded" name="synServiceTypes" type="impl:SyndicationService_Type"/>
               <element name="hasAcceptedTCs" type="xsd:boolean"/>
              </sequence>
             </complexType>
            </element>



            --- In soaplite@yahoogroups.com, "bstrathearn" <billythekid@...> wrote:
            >
            > Thanks for the timley response.
            >
            > Got the same error after patching, so I'll await the full release
            > update or revert back to 0.60 which some others seem to have successes
            > with for similar WSDLs.
            >
            >
            >
            > --- In soaplite@yahoogroups.com, Scott Wiersdorf scott@ wrote:
            > >
            > > On Tue, Oct 03, 2006 at 07:12:20PM -0000, bstrathearn wrote:
            > > > I'm using SOAP::Lite 0.69 CPAN and am trying to implement a client for
            > > > a service WSDL published here: http://strathearns.org/wds/usps_ws.wsdl
            > >
            > > You might try this patch to Lite.pm:
            > >
            > > <snip>
            > > --- SOAP-Lite-0.69/lib/SOAP/Lite.pm 2006-08-16
            > 08:49:34.000000000 -0600
            > > +++ SOAP-Lite-0.69-patched3/lib/SOAP/Lite.pm 2006-08-28
            > 09:19:27.000000000 -0600
            > > @@ -3040,7 +3040,7 @@
            > > my $method = 'as_'.$typename;
            > > # TODO - if can('as_'.$typename) {...}
            > > my $result = $self->serializer->$method($param,
            > $template->name, $template->type, $template->attr);
            > > - push(@parameters, $template->value($result->[2]));
            > > + push(@parameters, $template->value($result ? $result->[2] :
            > $param));
            > > } else {
            > > push(@parameters, $param);
            > > }
            > > </snip>
            > >
            > > Byrne has this patch, but has been busy with other things.
            > >
            > > Please let me know if it works (or not).
            > >
            > > Scott
            > > --
            > > Scott Wiersdorf
            > > scott@
            > >
            >
          • Sebastian Jaenicke
            On Wed, Oct 04, 2006 at 10:47:35AM -0600, Scott Wiersdorf wrote: [..] ... Your patch has just helped me to resolve a situation where the first parameter
            Message 5 of 6 , Oct 9, 2006
            • 0 Attachment
              On Wed, Oct 04, 2006 at 10:47:35AM -0600, Scott Wiersdorf wrote:
              [..]
              > --- SOAP-Lite-0.69/lib/SOAP/Lite.pm 2006-08-16 08:49:34.000000000 -0600
              > +++ SOAP-Lite-0.69-patched3/lib/SOAP/Lite.pm 2006-08-28 09:19:27.000000000 -0600
              > @@ -3040,7 +3040,7 @@
              > my $method = 'as_'.$typename;
              > # TODO - if can('as_'.$typename) {...}
              > my $result = $self->serializer->$method($param, $template->name, $template->type, $template->attr);
              > - push(@parameters, $template->value($result->[2]));
              > + push(@parameters, $template->value($result ? $result->[2] : $param));
              > } else {
              > push(@parameters, $param);
              > }

              Your patch has just helped me to resolve a situation where the first
              parameter supplied by the client didn't appear in the SOAP request at
              all.

              Unfortunately, with your patch applied the server is now unable
              to deserialize the message:

              Application failed during request deserialization: Unrecognized type
              '{urn:GenDB}JobCluster'

              I'm attaching the actual SOAP message and a small perl script to reproduce the
              error:

              $ ./soapfail.pl < soap.msg
              Unrecognized type '{urn:GenDB}JobCluster'

              Maybe this is already a known issue and someone has a patch at hand..

              Regards,

              - Sebastian

              --
              Progress (n.): The process through which Usenet has evolved from
              smart people in front of dumb terminals to dumb people in front
              of smart terminals.
              -- obs@...
            • Sebastian Jaenicke
              On Tue, Oct 10, 2006 at 04:25:15AM +0200, Sebastian Jaenicke wrote: [..] ... Somehow the message doesn t seem to match what the WSDL file says:
              Message 6 of 6 , Oct 9, 2006
              • 0 Attachment
                On Tue, Oct 10, 2006 at 04:25:15AM +0200, Sebastian Jaenicke wrote:
                [..]
                > <tns:submit>
                > <Jobs xsi:type="tns:JobCluster">1</Jobs>
                > <enc:Array enc:arrayType="xsd:string[3]" xsi:type="enc:Array">
                > <item xsi:type="xsd:string">sequence_data_goes_here1</item>
                > <item xsi:type="xsd:string">sequence_data_goes_here2</item>
                > <item xsi:type="xsd:string">sequence_data_goes_here3</item>
                > </enc:Array>
                > </tns:submit>

                Somehow the message doesn't seem to match what the WSDL file says:

                <operation name="submit">
                <input message="tns:SubmitRequest"/>
                <output message="tns:SubmitResponse"/>
                </operation>

                <message name="SubmitRequest">
                <part name="Jobs" type="tns:JobCluster"/>
                </message>

                <xsd:complexType name="JobCluster">
                <xsd:complexContent>
                <xsd:element name="toolid" type="xsd:nonNegativeInteger" minOccurs="1" maxOccurs="1"/>
                <xsd:restriction base="enc:Array" minOccurs="1" maxOccurs="1">
                <xsd:attribute name="input" ref="enc:arrayType" wsdl:arraytype="tns:ArrayOfString[]"/>
                </xsd:restriction>
                </xsd:complexContent>
                </xsd:complexType>

                , i.e both the integer value and the array should be encapsulated in "Jobs",
                and the integer value is completely missing its enclosing tags.

                my $id = 1;
                my @seq = ("sequence_data_goes_here1", "sequence_data_goes_here2", "sequence_data_goes_here3");
                my $result = SOAP::Lite
                ->service($WSDL)
                ->submit($id, \@seq);

                Strange..

                - Sebastian

                --
                Progress (n.): The process through which Usenet has evolved from
                smart people in front of dumb terminals to dumb people in front
                of smart terminals.
                -- obs@...
              Your message has been successfully submitted and would be delivered to recipients shortly.