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

Expand Messages
  • kvclarkusa
    Hello, I am connecting a Perl client to a .NET web service. I have succesfully tested calling methods and passing simple parameters such as strings, integers,
    Message 1 of 1 , Feb 19, 2004
    View Source
    • 0 Attachment
      Hello,

      I am connecting a Perl client to a .NET web service. I have
      succesfully
      tested calling methods and passing simple parameters such as
      strings, integers, etc to the server.

      However, one method in the .NET web service declares an input
      parameter as an object of a
      complex data type. I am having problems passing this data type from
      my
      perl client. I believe what I want to do is referenced in section 3
      of this article
      (http://www.perl.com/pub/a/2003/03/26/perlanddotnet.html), but it is
      not working. If anyone has any experience, I would appreciate some
      help.

      Here is the example of the code from the .NET web service:

      public class Car
      {
      public string color;
      public string size;
      }


      [WebMethod]
      public string GetCar(Car NewCar)
      {
      return "Your car will be colored " +
      NewCar.color + " and have a size of " + NewCar.size;
      }

      Here is the perl client:

      my $uri = "...";
      my $proxy = "...";

      my $soap = SOAP::Lite
      ->uri($uri)
      ->on_action( sub { join '/', $uri, $_[1]} )
      ->proxy($proxy)
      ->ClientLogin2(SOAP::Data->name('NewCar')
      ->uri($uri)
      ->value(bless { color => 'red',
      size => 'large'},
      'Car')
      );

      Thanks in advance. Here's what I get in response when I turn on
      debugging:

      POST http://.../test_3.asmx
      Accept: text/xml
      Accept: multipart/*
      Content-Length: 757
      Content-Type: text/xml; charset=utf-8
      SOAPAction: http://.../GetCar

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-
      ENC="http://
      schemas.xmlsoap.org/soap/encoding/"
      xmlns:namesp3="http://namespaces.soaplite.co
      m/perl" SOAP-
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns
      :SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.o
      rg/1999/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"><SOAP-E
      NV:Body><namesp1:GetCar
      xmlns:namesp1="http://onwardhealthcare.com"><names
      p2:NewCar xmlns:namesp2="http://onwardhealthcare.com"
      xsi:type="namesp3:Car"><color xsi:type="xsd:string">red</color><size
      xsi
      :type="xsd:string">large</size></namesp2:NewCar></namesp1:GetCar
      ></SOAP-ENV:Body></SOAP-ENV:Envelope>
      HTTP/1.1 500 (Internal Server Error) Internal Server Error.
      Cache-Control: private
      Connection: close
      Date: Thu, 19 Feb 2004 14:57:27 GMT
      Server: Microsoft-IIS/5.0
      Content-Length: 771
      Content-Type: text/xml; charset=utf-8
      Client-Date: Thu, 19 Feb 2004 14:57:26 GMT
      Client-Peer: xx.xx.xx.xx:80
      Client-Response-Num: 1
      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/XM
      LSchema">
      <soap:Body>
      <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>System.Web.Services.Protocols.SoapException:
      Server was unabl
      e to process request. ---> System.NullReferenceException: Object
      reference no
      t set to an instance of an object.
      at OH_User_Interface.web_service.test_3.GetCar(ClientLoginInfo
      ClientIn
      fo) in \\...\test_3.asmx.cs:line 37
      --- End of inner exception stack trace ---</faultstring>
      <detail />
      </soap:Fault>
      </soap:Body>
      </soap:Envelope>
    Your message has been successfully submitted and would be delivered to recipients shortly.