Forum: Ruby on Rails Invoke .Net WebService error in RoR

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Li Jie (Guest)
on 2006-05-14 15:57
(Received via mailing list)
I have written a webservice:

----------- Service.cs ----------------
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    [WebMethod]
    public string HelloWorld(string name) {
        return "Hello, " + name;
    }

}
--------------- END of Servcie.cs --------------------

In test_api.rb:
api_method :HelloWorld, :expects => [{:name => :string}], :returns =>
[:string]

In test_controller:
  web_client_api :test, :soap, "http://localhost/test/Service.asmx",
                 :namespace => "http://tempuri.org/",
                 :soap_action_base => "http://tempuri.org",
                 :driver_options=>{:default_encodingstyle =>
SOAP::EncodingStyle::ASPDotNetHandler::Namespace }

  def hello
    render_text test.HelloWorld("Li Jie")
  end

It works, but parameters is wrong, the name is null.

I have added some code in rubylib/soap/rpc/proxy.rb:

  def route(req_header, req_body, reqopt, resopt)
    #......
    conn_data.send_string.gsub!(/:n1/, '')   #ADD
    conn_data.send_string.gsub!(/n1:/, '')   #ADD

    conn_data = @streamhandler.send(@endpoint_url, conn_data,
    #.....

It removes the namespace 'n1', and it works find. But I think this is
wrong way, can anyone fix it?
This topic is locked and can not be replied to.