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

Calling .Net Web Service using a PERL client

Expand Messages
  • vinit samel
    Hello I am trying to send an object as a parameter to a .NET web service from a perl client with soap::lite.It works fine with integers, strings as arguments
    Message 1 of 3 , Sep 8, 2005
    View Source
    • 0 Attachment
      Hello

      I am trying to send an object as a parameter to a .NET
      web service from a perl client with soap::lite.It
      works fine with integers, strings as arguments but has
      trouble with Objects.
      Please find my code below and let me know of how this
      can be done.

      Thanks for all your help,
      Vinit


      ---------------------------------
      Perl Client:
      ---------------------------------
      use MySoapObject;

      my $test = MySoapObject->new(
      proxy =>
      "http://localhost/TestWebService/Service1.asmx",
      uri =>
      "http://www.xxx.com/xxx/xxxSystems",
      #on_debug => sub {
      print "@_\n" }
      );

      my $name = "GetVersionInfo";
      my $params = {};
      my $xpath = "";
      my @ret = $test->ExecSoapMethod($name, $params,
      $xpath);
      print Dumper($ret[1]), "\n";

      $name = "SayHello3";
      $params = { person=> { FirstName => 'Vinit', LastName
      => 'Samel' } };
      $xpath = "";
      @ret = $test->ExecSoapMethod($name, $params, $xpath);
      print Dumper($ret[1]), "\n";

      -----------------------------------------
      .NET WebService
      -----------------------------------------

      namespace TestWebService
      {

      [WebService(Namespace="http://www.xxx.com/xxx/xxxSystems")]
      public class Service1 :
      System.Web.Services.WebService
      {
      public Service1()
      {
      InitializeComponent();
      }

      [WebMethod]
      public string GetVersionInfo()
      {
      return "1.0.0";
      }

      [WebMethod]

      public string SayHello3(Person person)
      {
      if (person != null)
      return "Hello " + person.FirstName + " " +
      person.LastName;
      else
      return "Hello Nobody";

      }

      }

      public class Person
      {
      public Person()
      {
      }

      public Person(string fn, string ln)
      {
      FirstName = fn;
      LastName = ln;
      }

      public string FirstName
      {
      get { return _firstName; }
      set { _firstName = value; }
      }

      public string LastName
      {
      get { return _lastName; }
      set { _lastName = value; }
      }

      private string _firstName;
      private string _lastName;
      }
      }

      -------------------------------------------
      Fault code:
      $VAR1 = 'Fault Code: [soap:Client], Fault String:
      [Server was unable to read request. --> There is an

      error in XML document (1, 467). --> The specifie
      d type was not recognized: name=\'SOAPStruct\',
      namespace=\'http://xml.apache.org/xml-soap\', at

      <person
      xmlns=\'http://www.xxx.com/xxx/xxxSystems\'>.]';
      -------------------------------------------

      Request and response for Method SayHello3

      POST /TestWebService/Service1.asmx HTTP/1.1
      Host: localhost
      Content-Type: text/xml; charset=utf-8
      Content-Length: length
      SOAPAction:
      "http://www.xxx.com/xxx/xxxSystems/SayHello3"

      <?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>
      <SayHello3
      xmlns="http://www.xxx.com/xxx/xxxSystems">
      <person>
      <FirstName>string</FirstName>
      <LastName>string</LastName>
      </person>
      </SayHello3>
      </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>
      <SayHello3Response
      xmlns="http://www.xxx.com/xxx/xxxSystems">
      <SayHello3Result>string</SayHello3Result>
      </SayHello3Response>
      </soap:Body>
      </soap:Envelope>
      -----------------------------------------------





      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam
      protection around
      http://mail.yahoo.com

      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    • Nick Sutterer
      hi vinit, ... i had the same issue, but unfortunately couldn t get any help from the list. i decided not to exchange objects via soap. it sucks, but i tried
      Message 2 of 3 , Sep 8, 2005
      View Source
      • 0 Attachment
        hi vinit,

        > I am trying to send an object as a parameter to a .NET
        > web service from a perl client with soap::lite.It
        > works fine with integers, strings as arguments but has
        > trouble with Objects.
        >
        i had the same issue, but unfortunately couldn't get any help from the list. i
        decided not to exchange objects via soap. it sucks, but i tried everything i
        could think of but it didn't work between different programming languages.
        let me know if you found a way,


        cheers,


        nick
      • parcelstring
        Hi Guys Im having similar problems but i have a .NET client and a SOAP::Lite server. I have finally got the .NET request halfway looking right but the response
        Message 3 of 3 , Oct 24, 2005
        View Source
        • 0 Attachment
          Hi Guys

          Im having similar problems but i have a .NET client and a SOAP::Lite
          server. I have finally got the .NET request halfway looking right but
          the response from SOAP::Lite is not quite there yet.

          It seems to me that my SOAP::Lite server is returning the correct data
          elements but the type attribute in does not have the correct namespace.

          When i work out why this isnt working ill let you know and it might
          help you. If anyone else works it out before me .... you know what to
          do. Tell me!!!

          Cheers
          Ben

          --- In soaplite@yahoogroups.com, Nick Sutterer <nick@t...> wrote:
          >
          > hi vinit,
          >
          > > I am trying to send an object as a parameter to a .NET
          > > web service from a perl client with soap::lite.It
          > > works fine with integers, strings as arguments but has
          > > trouble with Objects.
          > >
          > i had the same issue, but unfortunately couldn't get any help from
          the list. i
          > decided not to exchange objects via soap. it sucks, but i tried
          everything i
          > could think of but it didn't work between different programming
          languages.
          > let me know if you found a way,
          >
          >
          > cheers,
          >
          >
          > nick
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.