Soap - connecting applications

Hi,

I made an application in Ruby and want to provide an interface for other (local) applications to use it. I tried to use SOAP for this purpose (a good choice?) and it works great with a ruby server and ruby client. But when i create a C# application to access the ruby server, I can connect and execute the ruby method, but the result returned is an empty string. (instead of, for instance, the 'hello world' the server sent out).
Does anybody know whether this is because of some incompatibility between the message sent and expected by the c# client, or because I made an error in my c# code? (which I shamelessly copied and slightly adapted from an online tutorial)

I attached the code of a simple ruby soap server offering a method 'hello(name)', a (working) ruby client, accessing this method, and a c# app that sends out a request hello("Robert"), but gets an empty string as result.

Any help is very much appreciated.

Regards,

Maarten

HelloService.cs (1.08 KB)

client.rb (234 Bytes)

server.rb (455 Bytes)

Hi,

Maarten Boonen schrieb:

Hi,

I made an application in Ruby and want to provide an interface for other (local) applications to use it. I tried to use SOAP for this purpose (a good choice?) and it works great with a ruby server and ruby client. But when i create a C# application to access the ruby server, I can connect and execute the ruby method, but the result returned is an empty string. (instead of, for instance, the 'hello world' the server sent out).
Does anybody know whether this is because of some incompatibility between the message sent and expected by the c# client, or because I made an error in my c# code? (which I shamelessly copied and slightly adapted from an online tutorial)

Maarten

------------------------------------------------------------------------

namespace HelloService
{
  using System.Diagnostics;
  using System.Xml.Serialization;
  using System;
  using System.Web.Services;
  using System.Web.Services.Protocols;

  [System.Web.Services.WebServiceBindingAttribute(
     Name="SuperDuperTest",
     Namespace="www.superdupertest.com")]

  public class HelloProxy: System.Web.Services.Protocols.SoapHttpClientProtocol
  {
    public HelloProxy()
    {
      this.Url = "http://localhost:9999/";
    }

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
      "www.superdupertest.com/hello",
       RequestNamespace="www.superdupertest.com",
       ResponseNamespace="www.superdupertest.com",
       Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public string hello(string name)
    {
      object results = this.Invoke("hello",new object { name });
      return ((string)(results[0]));
    }

    [STAThread]
    static void Main() {
      HelloProxy service = new HelloProxy();
      Console.WriteLine("--->" + service.hello("Robert") + "<---");
    }
  }
}//End of HelloService Namespace

------------------------------------------------------------------------

you must provide the
    [System.Web.Services.Protocols.SoapRpcMethod()]
Attribute to your methods like in the example attached.

Hope in helps.

Regards,
Roland

PingService.asmx.cs (2.78 KB)

Roland Schmitt schreef:

you must provide the
        [System.Web.Services.Protocols.SoapRpcMethod()]
Attribute to your methods like in the example attached.

Thanks! Works like a charm.

Regards,

Maarten