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

2541Passing parameter from SOAP::Lite client to .Net server.

Expand Messages
  • mkovalchuk
    Apr 22, 2003
      I'm writing a perl client connecting to a .Net web service. It seems
      that I can successfully get to the correct web service api, but, the
      problem is that the parameters are not initialized to correct values
      (the ones i'm passing), they are 0 for numbers, nulls for strings etc.
      Was just wondering if anyone can share the experties.
      ---------------------
      Here's my test .Net API api:
      [WebService(Namespace="http://xyz.com/")]
      public class Y : System.Web.Services.WebService
      {
      ...
      [WebMethod]
      public string Test(int x)
      {
      string result = "123 " + x.ToString() ;
      return result ;
      }
      ...
      }
      -------------------
      the perl code:
      #!perl -w

      #use SOAP::Lite;
      use SOAP::Lite
      (+trace=>"all",soapversion=>'1.1',envprefix=>'soap',xmlschema=>'2001',
      autotype=>0);

      my $soap = SOAP::Lite
      -> uri('http://xyz.com')
      -> proxy('http://xyz/x.asmx')
      -> on_action(sub{sprintf '%s/%s', @_ });

      my $param = SOAP::Data ->name('x' => 25);

      my $result = $soap->Test($param);

      unless ($result->fault) {
      print $result->result;
      } else {
      print join ', ',
      $result->faultcode,
      $result->faultstring;
      }
      -----------------------------------------
      This executes (I can catch it on a breakpoint in my .Net function
      (but x is not initialized). - 123 0 is returned.
      ------------------------------------
      Trace results:
      Req:
      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><nam
      esp1:Test
      xmlns:namesp1="http://xyz.com"><x>25</x></namesp1:Test></soap:Body></s
      oap:Envelope>
      --------------------------------
      Resp:
      <?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><TestResponse
      xmlns="http://xyz.com/"><TestResult>123
      0</TestResult></TestResponse></soap:Body></soap:Envelope>
      --------------------------------
      Sorry for the long message, would appreciate any help I can get.
    • Show all 5 messages in this topic