Axel Fuchs wrote:
I
can see all the data in the wire dump. But how can I get to it using one
of these methods? There must be a way to extract the information.
It's simply the result from the method call, which is an object of class
GetTodaysBirthdaysResponse.
Unfortunately, soap4r can't break it down further for you, because the
stupid WSDL doesn't say any more than that it contains a
getTodaysBirthdaysResult which is simply a collection of any XML
elements (note <s:any />)
<s:element name="getTodaysBirthdaysResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="getTodaysBirthdaysResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
So this is essentially untyped XML. soap4r can't build you an OO
interface into this; you just have to dig down into the returned XML for
yourself, like this.
$ irb --simple-prompt
require 'rubygems'
=> true
gem 'soap4r'
=> true
require 'defaultDriver'
=> true
obj = DeadOrAliveSoap.new
=>
#<DeadOrAliveSoap:#<SOAP::RPC::Proxy:http://www.abundanttech.com/WebServices/DeadOrAlive/DeadOrAlive.asmx>>
obj.wiredump_dev = STDERR
=> #<IO:0xb7c56f54>
result = obj.getTodaysBirthdays(nil)
Wire dump:
...
=> #<GetTodaysBirthdaysResponse:0xb7620900 @getTodaysBirthdaysResult=...
result.methods - methods
=> ["getTodaysBirthdaysResult", "getTodaysBirthdaysResult="]
br = result.getTodaysBirthdaysResult
=> #<GetTodaysBirthdaysResponse::GetTodaysBirthdaysResult:0xb76207fc
@schema=...
@diffgram=...
br.methods - methods
=> ["diffgram", "diffgram=", "__xmlele_any", "set_any", "schema",
"schema="]
br.diffgram
=> #<SOAP::Mapping::Object:0x..fdbb0aecc
{}NewDataSet=#<SOAP::Mapping::Object:0x..fdbb0abac
{}Table=[#<SOAP::Mapping::Object:0x..fdbb0ab34 {}FullName="Cunningham,
Walter"...
br.diffgram['NewDataSet']
=> #<SOAP::Mapping::Object:0x..fdbb0abac {}Table=[...
br.diffgram['NewDataSet']['Table'][0]
=> #<SOAP::Mapping::Object:0x..fdbb0ab34 {}FullName="Cunningham, Walter"
{}BirthDate="03/16/1932" {}DeathDate="" {}Age="78"
{}KnownFor="Astronauts - Other" {}DeadOrAlive="Alive">
br.diffgram['NewDataSet']['Table'][0]['FullName']
=> "Cunningham, Walter"
So despite all the complexity of SOAP and WSDL, it doesn't help you at
all. Why don't you suggest that they change to JSON instead
HTH,
Brian.
···
--
Posted via http://www.ruby-forum.com/\.