Looked into this myself several years ago. A main issue is that since
Ruby is dynamically typed, method signatures don’t have type metadata
on them to allow automatic generation of WSDL method invocation
signatures.
If you have a class with the following method (silly example):
class Person
def set_name(first, last)
@first = first
@last = last
end
def get_name
@first+" "+@last
end
end
What is the ‘type’ of first and last or the return type of get_name?
These are likely Strings so the type of “xsd:string” but where do you
place this metadata to allow the generation of a WSDL definition from
an instance of Person? In Java, these parameters are typed so (using
reflection) you can get that type and generate the WSDL definition
automagically. In Ruby, you either need to annotate the class or have a
separate object that holds the type metadata for WSDL generation:
class Person
def set_name(first, last)
@first = first
@last = last
nil
end
def_types :set_name, :first=>‘xsd:string’, :last=>‘xsd:string’
def get_name
@first+" "+@last
end
def_types :get_name, :_return=>‘xsd:string’
end
Where def_types is a method that places metadata on the class object
for the defined methods…or something like:
ws = WebService.new(Person)
ws.add_method :set_name, :first=>‘xsd:string’, :last=>‘xsd:string’
ws.add_method :get_name, :_return=>‘xsd:string’
Where you have a WebService class that holds the metadata itself. I
wrote such a class a bit ago but never finished it…if there is
interest I could spend a bit of time on it and release it to NiHi for
(optional) inclusion with SOAP4R…let me know.
-rich
···
On Thursday, May 22, 2003, at 02:43 PM, bbense+comp.lang.ruby.May.22.03@telemark.slac.stanford.edu wrote:
On a slightly different vein, is there any consensus on how to
offer WSDL/SOAP services using Ruby as the programming
environment?
- From my brief examination it seems like there are no good useful
WSDL tools yet, the best automation I’ve seen so far is a tool
to write a Java skeleton from the WSDL… Seem exactly
bass-ackwards to me. I want the WSDL generated from the code.