tags:

views:

939

answers:

1

Hi I starting to work with ruby and soap and had some questions :

  1. how do I generate a WSDL file for the service I created ? will it be compatible with an .NET client ?

Thanks, Gady


begin
   class MyServer < SOAP::RPC::StandaloneServer
         # Handler methods
      def add(a, b)
         return a + b
      end
      def div(a, b)
         return a / b
      end

      # Expose our services
      def initialize(*args)
         add_method(self, 'add', 'a', 'b')
         add_method(self, 'div', 'a', 'b')
      end


  end
  server = MyServer.new("MyServer",
            'urn:ruby:calculation', 'localhost', 8080)
  trap('INT'){
     server.shutdown
  }
  server.start
rescue => err
  puts err.message
end
+1  A: 

ActionWebService (previously in Rails core, now a gem) has tools to generate WSDL files. You can use the tools even if you're not running your service within Rails.

http://www.datanoise.com/articles/2008/7/2/actionwebservice-is-back

As for whether it will work with a .NET client, the answer is maybe. Many .NET clients seem to expect Microsoft's "extended" SOAP info, which .NET webservices provide by default. If the client is also able to consume a service without that extra stuff, then sure.

Sarah Mei