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

Newbie problem: Parameter passing in web service call w/SOAP::Lite...

Expand Messages
  • dcaffey_fl
    Dear SOAP::Lite Users Group, I m a newbie trying to write a PERL client to talk to an MS- Win web service and I m having some trouble with parameter passing.
    Message 1 of 1 , Oct 14, 2003
    View Source
    • 0 Attachment
      Dear SOAP::Lite Users' Group,

      I'm a newbie trying to write a PERL client to talk to an MS-
      Win web service and I'm having some trouble
      with parameter passing. My parameter looks like it's getting passed
      ok in the trace below but the web service
      never gets it. The web service currently just echoes back what was
      passed to it. Maybe one of you can tell
      me what I'm doing wrong or what I'm leaving out. Thanks in advance
      for any help provided.

      Sincerely,

      Dom
      Email: dcaffey_fl@...



      What follows is a sample SOAP request and response for the MS-Win web
      service that I'm trying to converse with. The
      placeholders shown need to be replaced with actual values.

      POST /AECSpiDr/AECSpiDr.asmx HTTP/1.1
      Host: localhost
      Content-Type: text/xml; charset=utf-8
      Content-Length: length
      SOAPAction: "http://tempuri.org/Transact"

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <Transact xmlns="http://tempuri.org/">
      <sTransaction>string</sTransaction>
      </Transact>
      </soap:Body>
      </soap:Envelope>
      HTTP/1.1 200 OK
      Content-Type: text/xml; charset=utf-8
      Content-Length: length

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <TransactResponse xmlns="http://tempuri.org/">
      <TransactResult>string</TransactResult>
      </TransactResponse>
      </soap:Body>
      </soap:Envelope>


      Here's my PERL script that I'm trying to make talk to the MS-
      Win web service:


      #!/bin/perl -w

      # Test client to verify communications with AECSpiDr webservice.

      use SOAP::Lite +trace;

      $myURI = 'http://10.243.37.59/AECSpiDr/AECSpiDr.asmx';
      $myPROXY = $myURI;

      my $soap = SOAP::Lite
      -> uri($myURI) # class
      -> proxy($myPROXY); # service that provides access to class

      $soap->readable(1); # emit XML that is easy for human eyes to read.

      $soap->envprefix('soap'); # make look more like MS-Win web service
      example.

      $soap->on_action(sub {'http://tempuri.org/Transact'}); # SOAPAction
      values must match.

      $soap->autotype(0); # disable autotyping mechanism because we're
      going to explicitly tell SOAP what's what.

      $myHello = "Hello?";
      my $WebServiceArg = SOAP::Data->type('string')->name('sTransaction')-
      >value($myHello);

      my $result = $soap->Transact($WebServiceArg); # call the webservice

      if($result->fault)
      {
      print "\nSOAP Fault occurred:" .
      "\n\tCode = " . $result->faultcode .
      "\n\tString = " . $result->faultstring .
      #"\n\tActor = " . $result-faultactor .
      #"\n\tDetail = " . $result-faultdetail .
      "\n";
      } else {
      print "\nCall result is \"" . $result->result() . "\".";
      }

      print "\n";


      Here's the output of the SOAP transaction generated by using
      the "trace" option:


      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: Transact SOAP::Data=HASH(0x40254b30)
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH
      (0x403d37f4)
      SOAP::Transport::HTTP::Client::send_receive: POST
      http://10.243.37.59/AECSpiDr/AECSpiDr.asmx
      Accept: text/xml
      Accept: multipart/*
      Content-Length: 553
      Content-Type: text/xml; charset=utf-8
      SOAPAction: http://tempuri.org/Transact

      <?xml version="1.0" encoding="UTF-8"?>
      <soap:Envelope xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/"
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"

      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      >
      <soap:Body
      >
      <namesp1:Transact
      xmlns:namesp1="http://10.243.37.59/AECSpiDr/AECSpiDr.asmx"
      >
      <sTransaction xsi:type="xsd:string"
      >Hello?</sTransaction>
      </namesp1:Transact>
      </soap:Body>
      </soap:Envelope>
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH
      (0x4051dfd4)
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
      Cache-Control: private, max-age=0
      Date: Tue, 14 Oct 2003 21:00:38 GMT
      Server: Microsoft-IIS/5.0
      Content-Length: 409
      Content-Type: text/xml; charset=utf-8
      Client-Date: Tue, 14 Oct 2003 20:59:39 GMT
      Client-Peer: 10.243.37.59:80
      X-AspNet-Version: 1.1.4322
      X-Powered-By: ASP.NET

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
      <TransactResponse xmlns="http://tempuri.org/">
      <TransactResult>AECSpiDr Web Service received
      the following raw transaction data:</TransactResult>
      </TransactResponse>
      </soap:Body>
      </soap:Envelope>
      SOAP::Deserializer::deserialize: ()
      SOAP::Parser::decode: ()
      SOAP::SOM::new: ()
      SOAP::Lite::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Transport::HTTP::Client::DESTROY: ()
      SOAP::SOM::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      SOAP::Parser::DESTROY: ()

      Call result is "AECSpiDr Web Service received the following raw
      transaction data:".


      end of posting.
    Your message has been successfully submitted and would be delivered to recipients shortly.