From: Brian Candler Date: 2010-03-15T18:46:53+09:00 Subject: Re: Wsdl - Webservice Client Axel Fuchs wrote: > Hi, I am learning how to use WSDL but none of the Ruby Cookbook book > samples work any longer. So I created this example: > > #!/usr/bin/ruby > > require 'soap/wsdlDriver' > wsdl='http://www.abundanttech.com/webservices/deadoralive/deadoralive.wsdl' > driver=SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver > > XSD::Charset.encoding = 'UTF8' > result = driver.getTodaysBirthdays(nil) > > The question is: How do I access the elements of result in this example > and print them out? When I use MAC wsdl client, it look like result is a > XML structure. I'm afraid I can't answer your question directly, but the soap4r which comes bundled with ruby (1.8 at least) is very old. It's better if you install the latest soap4r from rubygems: sudo gem install soap4r then you get a bunch of useful stuff, including wsdl2ruby.rb. Create an empty directory, cd into it, then run this: wget http://www.abundanttech.com/webservices/deadoralive/deadoralive.wsdl wsdl2ruby.rb --wsdl deadoralive.wsdl --type client This creates a bunch of interface code including sample client, DeadOrAliveClient.rb Add the following two lines to the top of DeadOrAliveClient.rb (to make it use the rubygems version of soap4r, not the old bundled one) require 'rubygems' gem 'soap4r' Then run it using: ruby DeadOrAliveClient.rb ruby -d DeadOrAliveClient.rb # to get wiredumps Note that the DeadOrAliveHttpGet port/binding isn't implemented (and the client barfs when it gets to that point). Just use the DeadOrAliveSoap interface. HTH, Brian. -- Posted via http://www.ruby-forum.com/.