# NewB question on data structure ruby

**URL:** <https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319>\
**Category:** Ruby\
**Created:** [June 14, 2006, 6:45am UTC](https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319 "2006-06-14T06:45:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![psethi2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b3f665/32.png) [@psethi2000](https://www.ruby-forum.com/u/psethi2000)\
**Post date:** [June 14, 2006, 6:45am UTC](https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319/1 "2006-06-14T06:45:40Z")

</div>

Hi,

I am trying to parse variables from a simple data structure/class… I am  
using a web service and it returns a data structure. Here is the code:

@result = ws.HelloWorld(nil)  
puts @result.inspect # line 15  
puts @result.HelloWorldResult # line 16

#\<SOAP::Mapping::Object:0x174c2b4  
{[http://tempuri.org/](http://tempuri.org/)}HelloWorldResult=“Hello World”\> # line 15  
rms\_wsdl.rb:16: undefined method `HelloWorldResult’ for  
#SOAP::Mapping::Object:0x2e98448 (NoMethodError)

I am sure, I am missing something very basic. Any help would be greatly  
appreciated.

Thanks in advance.

Prad

---

<div class="post-metadata">

**Author:** ![psethi2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b3f665/32.png) [@psethi2000](https://www.ruby-forum.com/u/psethi2000)\
**Post date:** [June 14, 2006, 8:19am UTC](https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319/2 "2006-06-14T08:19:11Z")

</div>

To Clarify more, How would I get the data “Hello World” out from the  
data structure:

> #\<SOAP::Mapping::Object:0x174c2b4  
> {[http://tempuri.org/](http://tempuri.org/)}HelloWorldResult=“Hello World”\>

Thanks,

Pradeep S. wrote:

> Hi,
> 
> I am trying to parse variables from a simple data structure/class… I am  
> using a web service and it returns a data structure. Here is the code:
> 
> @result = ws.HelloWorld(nil)  
> puts @result.inspect # line 15  
> puts @result.HelloWorldResult # line 16
> 
> #\<SOAP::Mapping::Object:0x174c2b4  
> {[http://tempuri.org/](http://tempuri.org/)}HelloWorldResult=“Hello World”\> # line 15  
> rms\_wsdl.rb:16: undefined method `HelloWorldResult’ for  
> #SOAP::Mapping::Object:0x2e98448 (NoMethodError)
> 
> I am sure, I am missing something very basic. Any help would be greatly  
> appreciated.
> 
> Thanks in advance.
> 
> Prad

---

<div class="post-metadata">

**Author:** ![psethi2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b3f665/32.png) [@psethi2000](https://www.ruby-forum.com/u/psethi2000)\
**Post date:** [June 14, 2006, 8:44am UTC](https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319/3 "2006-06-14T08:44:04Z")

</div>

On Jun 14, 2006, at 2:19 AM, Pradeep S. wrote:

> To Clarify more, How would I get the data “Hello World” out from the  
> data structure:
> 
> > #\<SOAP::Mapping::Object:0x174c2b4  
> > {[http://tempuri.org/](http://tempuri.org/)}HelloWorldResult=“Hello World”\>
> 
> Thanks,

Try using p @result.methods to figure out what the method is called.  
Either that or show some more code (where the object gets created).

---

<div class="post-metadata">

**Author:** ![psethi2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b3f665/32.png) [@psethi2000](https://www.ruby-forum.com/u/psethi2000)\
**Post date:** [June 14, 2006, 9:58am UTC](https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319/4 "2006-06-14T09:58:55Z")

</div>

On Jun 14, 2006, at 3:19 AM, Pradeep S. wrote:

> > >
> 
> @result = ws.HelloWorld(nil)

After reading the source for SOAP::Mapping::Object my guess is  
@result[“HelloWorldResult”] will give you what you want

---

<div class="post-metadata">

**Author:** ![psethi2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b3f665/32.png) [@psethi2000](https://www.ruby-forum.com/u/psethi2000)\
**Post date:** [June 14, 2006, 9:19am UTC](https://www.ruby-forum.com/t/newb-question-on-data-structure-ruby/63319/5 "2006-06-14T09:19:40Z")

</div>

Logan C. wrote:

> On Jun 14, 2006, at 2:19 AM, Pradeep S. wrote:
> 
> > To Clarify more, How would I get the data “Hello World” out from the  
> > data structure:
> > 
> > > #\<SOAP::Mapping::Object:0x174c2b4  
> > > {[http://tempuri.org/](http://tempuri.org/)}HelloWorldResult=“Hello World”\>
> > 
> > Thanks,
> 
> Try using p @result.methods to figure out what the method is called.  
> Either that or show some more code (where the object gets created).

Here is the code. I want to get the value returned by the web service,  
in this case text “Hello World”. see below HelloWorldResult=“Hello  
World”

Thanks a lot,

* * *

require ‘soap/wsdlDriver’

RMS\_WSDL =  
‘[http://host.com/webservice1/trackermapper/service1.asmx?WSDL](http://host.com/webservice1/trackermapper/service1.asmx?WSDL)’  
ws = SOAP::WSDLDriverFactory.new(RMS\_WSDL).create\_rpc\_driver

puts ws.inspect

@result = ws.HelloWorld(nil)  
puts @result.inspect  
puts @result.HelloWorldResult

* * *

and the output is

#\<SOAP::Mapping::Object:0x174c2b4  
{[http://tempuri.org/](http://tempuri.org/)}HelloWorldResult=“Hello World”\>  
rms\_wsdl.rb:16: undefined method `HelloWorldResult’ for  
#SOAP::Mapping::Object:0x2e98448 (NoMethodError)
