From: ParappaYo Date: 2006-12-07T09:10:08+09:00 Subject: Using Ruby Web Service from a C# .NET Client I'm trying to set up a sample project of a Ruby web service consumed by a C# .NET client. I know that lots of people have managed to use an ASP .NET service from a Ruby client, but I am trying to do it the other way around. To keep things super simple, I'm just trying to get the following web service to work: require 'soap/rpc/standaloneServer' NS = 'http://bushidoburrito.com/WebServiceTest' class TestStuff def test_string() "blah blah" end end class TestServer < SOAP::RPC::StandaloneServer def on_init test_stuff = TestStuff.new add_method(test_stuff, 'test_string') end end serv = TestServer.new('WebServiceTest', NS, '0.0.0.0', 8080) trap('INT') { serv.shutdown } serv.start So far as I know, RPC::StandaloneServer doesn't support WSDL (at least, I couldn't figure out how to get it), so I built my own proxy class in C#: using System; using System.Diagnostics; using System.Xml.Serialization; using System.Web.Services; using System.Web.Services.Protocols; namespace WebServiceTestClient { [System.Web.Services.WebServiceBindingAttribute(Name="WebServiceTestSoap", Namespace="http://bushidoburrito.com/WebServiceTest")] public class WebServiceTestServer : System.Web.Services.Protocols.SoapHttpClientProtocol { public WebServiceTestServer() { this.Url = "http://localhost:8080/"; } [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://bushidoburrito.com/WebServiceTest/test_string", RequestNamespace="http://bushidoburrito.com/WebServiceTest", ResponseNamespace="http://bushidoburrito.com/WebServiceTest", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string test_string() { object[] results = this.Invoke("test_string", new object[0]); return (string) results[0]; } } } When I call the web service on the client side, the results array has a length of 1 but results[0] is always null. I ran TcpTrace on localhost with both the web service and the client running locally to capture the traffic between them. The request: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2032) Content-Type: text/xml; charset=utf-8 SOAPAction: "http://bushidoburrito.com/WebServiceTest/test_string" Content-Length: 310 Expect: 100-continue Connection: Keep-Alive Host: localhost:8081 --- And now the response: HTTP/1.1 200 OK Connection: Keep-Alive Date: Wed, 06 Dec 2006 20:41:11 GMT Content-Type: text/xml; charset="utf-8" Server: WEBrick/1.3.1 (Ruby/1.8.2/2004-12-25) Content-Length: 494 blah blah --- I don't know much about SOAP, but it seems to me that the Ruby web service part is working just fine. Is the problem entirely with the .NET client, then? And either way, is there anything that I can do to fix it?