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

Perl client, .NET server -- specifying multiple parameters?

Expand Messages
  • obc_spike
    I ve been using single-parameter method calls on a Perl-to-.NET web service for a while now, but now that I want to use multiple parameters, the connection
    Message 1 of 3 , Jan 15, 2004
    • 0 Attachment
      I've been using single-parameter method calls on a Perl-to-.NET web
      service for a while now, but now that I want to use multiple
      parameters, the connection crashes utterly. This is the syntax I had,
      works like a champ:

      my $method = SOAP::Data->name('UpdateInq')
      ->attr({xmlns => 'http://cscweb/WebServices'});

      my @param = ( SOAP::Data->name('sINQ' => $inq) );
      return $soapInq->call($method => @param)->result;

      Then I changed it to this, figuring I could add the second parameter
      to @param:

      my $method = SOAP::Data->name('UpdateInq')
      ->attr({xmlns => 'http://cscweb/WebServices'});

      my @param = [SOAP::Data->name('sINQ' => $inq), SOAP::Data->name('sID'
      => $id)];
      return $soapInq->call($method => @param)->result;

      CRASH! No data gets through for either parameter. Buildings burn, mobs
      roam the streets in search of blood. No good. What's the syntax for 2
      (or more) parameters, since the typical perl array doesn't do it?

      Thanks,
      Matthew
    • Duncan Cameron
      ... From: obc_spike To: Sent: Thursday, January 15, 2004 10:50 PM Subject: [soaplite] Perl client, .NET
      Message 2 of 3 , Jan 16, 2004
      • 0 Attachment
        ----- Original Message -----
        From: "obc_spike" <obc_spike@...>
        To: <soaplite@yahoogroups.com>
        Sent: Thursday, January 15, 2004 10:50 PM
        Subject: [soaplite] Perl client, .NET server -- specifying multiple
        parameters?


        > I've been using single-parameter method calls on a Perl-to-.NET web
        > service for a while now, but now that I want to use multiple
        > parameters, the connection crashes utterly. This is the syntax I had,
        > works like a champ:
        >
        > my $method = SOAP::Data->name('UpdateInq')
        > ->attr({xmlns => 'http://cscweb/WebServices'});
        >
        > my @param = ( SOAP::Data->name('sINQ' => $inq) );
        > return $soapInq->call($method => @param)->result;
        >
        > Then I changed it to this, figuring I could add the second parameter
        > to @param:
        >
        > my $method = SOAP::Data->name('UpdateInq')
        > ->attr({xmlns => 'http://cscweb/WebServices'});
        >
        > my @param = [SOAP::Data->name('sINQ' => $inq), SOAP::Data->name('sID'
        > => $id)];

        Your syntax is awry, square brackets are for an array reference, so
        @param contains one element which is a reference to an array of two
        elements each of which is a SOAP::Data object. Try round brackets or
        even remove @array and put the parameters in the call() itself

        Regards

        Duncan
      • obc_spike
        ... Thanks for the help, that was definitely the syntax fix. There was another underlying problem that showed itself in debug mode. In this code: my @param =
        Message 3 of 3 , Jan 16, 2004
        • 0 Attachment
          > Your syntax is awry, square brackets are for an array reference, so
          > @param contains one element which is a reference to an array of two
          > elements each of which is a SOAP::Data object. Try round brackets or
          > even remove @array and put the parameters in the call() itself

          Thanks for the help, that was definitely the syntax fix. There was
          another underlying problem that showed itself in debug mode. In this
          code:

          my @param = (SOAP::Data->name('sINQ' => $inq), SOAP::Data->name('sID'
          => $id));

          sID was a database ID I'd grabbed from another .NET service.
          Apparently, it held onto its original name and type (with a different
          namespace). When I passed it as a SOAP::Lite value under the name
          'sID', the second service couldn't use it. So I concatenated it
          locally with '', which (apparently) copies it to a local namespace
          variable. My understanding isn't crystal clear on the concepts, but at
          least this is working:

          my $inq = shift || die "need inq output";
          my $id = '' . shift || die "need hardware id";

          my $method = SOAP::Data->name('UpdateInq')
          ->attr({xmlns => 'http://cscweb/WebServices'});

          my @param = (SOAP::Data->name('sINQ' => $inq),
          SOAP::Data->name('HardwareID' => $id));
          return $soapInq->call($method => @param)->result;
          }

          Thanks,
          Matthew
        Your message has been successfully submitted and would be delivered to recipients shortly.