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

Perl SOAP::Lite Server and a C# client

Expand Messages
  • Darren Young
    I m trying to place a SOAP::Lite service up that needs to service C# clients and it s just not working. What I have so far... The SOAP::Lite server:
    Message 1 of 1 , Aug 29 3:59 PM
    • 0 Attachment
      I'm trying to place a SOAP::Lite service up that needs to service C#
      clients and it's just not working. What I have so far...

      The SOAP::Lite server:

      [root@gsbsfn1 cgi-bin]# cat test.cgi
      #!/usr/bin/perl -w

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Demo')
      -> handle;

      package Demo;

      sub new {
      bless {}, shift;
      };

      sub hi {
      my ($self) = @_;
      return "hello, world";
      }

      1;

      The C# code (using Visual Studio 2005):

      // s.cs
      using System;

      class TestApp
      {
      [STAThread]
      static void Main()
      {
      SSim ssim = new SSim();
      Console.WriteLine("SSim.hi: "+ssim.hi());
      }
      }

      //ssim.cs
      using System.Diagnostics;
      using System.Xml.Serialization;
      using System;
      using System.Web.Services.Protocols;
      using System.ComponentModel;
      using System.Web.Services;


      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.ComponentModel.DesignerCategoryAttribute("code")]
      [System.Web.Services.WebServiceBindingAttribute(Name="SSimSoap",Namespace="Demo"
      )]

      public class SSim : System.Web.Services.Protocols.SoapHttpClientProtocol {

      public SSim() {
      this.Url = "http://128.135.211.10/cgi-bin/test.cgi";
      }

      [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
      "Demo#hi",
      RequestNamespace="Demo",
      ResponseNamespace="Demo",
      Use=System.Web.Services.Description.SoapBindingUse.Literal,
      ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]


      public string hi() {
      object[] results = this.Invoke("hi", new object[0]);
      return ((string)(results[0]));
      }
      }

      a working perl client:

      #!/usr/bin/perl -w

      use SOAP::Lite +debug;
      # use SOAP::Lite;

      print SOAP::Lite
      -> uri('Demo')
      -> proxy('http://128.135.211.10/cgi-bin/test.cgi')
      -> hi()
      -> result . "\n";

      debug output from that client:

      SOAP::Transport::new: ()
      SOAP::Serializer::new: ()
      SOAP::Deserializer::new: ()
      SOAP::Parser::new: ()
      SOAP::Lite::new: ()
      SOAP::Transport::HTTP::Client::new: ()
      SOAP::Lite::call: ()
      SOAP::Serializer::envelope: ()
      SOAP::Serializer::envelope: hi
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Data::new: ()
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Request=HASH(0x8072aac)
      SOAP::Transport::HTTP::Client::send_receive: POST
      http://128.135.211.10/cgi-bin/test.cgi HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Accept: application/soap
      Content-Length: 401
      Content-Type: text/xml; charset=utf-8
      SOAPAction: "Demo#hi"

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soapenc="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><hi
      xmlns="Demo" xsi:nil="true" /></soap:Body></soap:Envelope>
      SOAP::Transport::HTTP::Client::send_receive:
      HTTP::Response=HASH(0x8545294)
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
      Connection: close
      Date: Wed, 29 Aug 2007 22:51:52 GMT
      Server: Apache/2.0.52 (Red Hat)
      Content-Length: 462
      Content-Type: text/xml; charset=utf-8
      Client-Date: Wed, 29 Aug 2007 22:51:52 GMT
      Client-Peer: 128.135.211.10:80
      Client-Response-Num: 1
      SOAPServer: SOAP::Lite/Perl/0.69

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:soapenc="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><hiResponse
      xmlns="Demo"><s-gensym3 xsi:type="xsd:string">hello,
      world</s-gensym3></hiResponse></soap:Body></soap:Envelope>
      SOAP::Deserializer::deserialize: ()
      SOAP::Parser::decode: ()
      SOAP::SOM::new: ()
      hello, world
      SOAP::Lite::DESTROY: ()
      SOAP::Deserializer::DESTROY: ()
      SOAP::Parser::DESTROY: ()
      SOAP::Transport::DESTROY: ()
      SOAP::Transport::HTTP::Client::DESTROY: ()
      SOAP::SOM::DESTROY: ()
      SOAP::Serializer::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()
      SOAP::Data::DESTROY: ()

      What the C# command line client does (basically nothing):

      SSim.hi:

      The apache access log shows the inbound request to the test.cgi script:

      128.135.211.176 - - [29/Aug/2007:17:55:15 -0500] "POST
      /cgi-bin/test.cgi HTTP/1.1" 200 462 "-" "Mozilla/4.0 (compatible; MSIE
      6.0; MS Web Services Client Protocol 2.0.50727.832)"


      I know VERY little about C#, I'm writing the Perl SOAP service to sit
      on top of a bunch of existing Perl code so I can expose that
      functionality to the C# coders/consumers here. I need to verify that
      this in fact can be done and give them a sample of some working C#
      code that they can use to start with.

      Any help would be most appreciated.
    Your message has been successfully submitted and would be delivered to recipients shortly.