# Accessing SOAP::Mapping::Object

**URL:** <https://rubytalk.org/t/accessing-soap-mapping-object/39870>\
**Category:** ruby-talk\
**Created:** [13 August 2007 20:15 UTC](https://rubytalk.org/t/accessing-soap-mapping-object/39870 "2007-08-13T20:15:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruby\_Rookie](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ruby\_Rookie](https://rubytalk.org/u/Ruby_Rookie)\
**Post date:** [13 August 2007 20:15 UTC](https://rubytalk.org/t/accessing-soap-mapping-object/39870/1 "2007-08-13T20:15:03Z")

</div>

Hi,

I just started with SOAP and Ruby and after one day trying to get it  
working I'am now stuck at getting the response into useable variables  
i.e. accessing the SOAP::Mapping::Object.  
I used soap4r and wdsl2ruby for generating the client code

The bare SOAP XML result is:  
\<?xml version="1.0" encoding="utf-8"?\>  
\<soap:Envelope xmlns:soap="[Error](http://schemas.xmlsoap.org/soap/envelope/&quot);  
xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance&quot](http://www.w3.org/2001/XMLSchema-instance&quot);  
xmlns:xsd="[http://www.w3.org/2001/XMLSchema&quot;&gt](http://www.w3.org/2001/XMLSchema&quot;&gt);  
\<soap:Body\>\<FetchKnownUnitsResponse xmlns="[http://support.somehost.com](http://support.somehost.com):  
2332/"\>  
\<FetchKnownUnitsResult\>  
\<Units xmlns=""\>  
\<Unit\>  
\<Id\>EF000000AC023F28\</Id\>\<LastConnect\>2007-07-24 19:08:58\</

> 

\<LastClear\>2007-07-23 10:34:48\</LastClear\>  
\<LastDisconnect\>2007-07-24 15:51:34\</LastDisconnect\>  
\<LastRTCValue\>2007-07-24 20:31:31\</LastRTCValue\>  
\<LastLogStart\>2007-07-23 10:05:14\</LastLogStart\>  
\<LastLocalTime\>2007-07-24 19:09:03\</LastLocalTime\>  
\<LastRecordCount\>27\</LastRecordCount\>  
\<LastVersion\>0\</LastVersion\>  
\<LastRevision\>23\</LastRevision\>  
\<LastErrorStatus\>0\</LastErrorStatus\>  
\</Unit\>  
\</Units\>  
\</FetchKnownUnitsResult\>  
\</FetchKnownUnitsResponse\>  
\</soap:Body\>  
\</soap:Envelope\>

In ruby  
--- begin ruby code ------  
#!/usr/bin/env ruby -d  
# issue the command to the server  
endpoint\_url = ARGV.shift  
obj = DefaultSoap.new(endpoint\_url)

# run ruby with -d to see SOAP wiredumps.  
obj.wiredump\_dev = STDERR if $DEBUG

> **···**
>
> #  
> SoapResponse = obj.fetchKnownUnits(:username =\> 'Me', :challenge =\>  
> 'Secret')
> 
> pp SoapResponse
> 
> ----- end ruby code ----
> 
> The result on screen is:
> 
> #\<FetchKnownUnitsResponse:0x102389c  
> @fetchKnownUnitsResult=  
> &nbsp;&nbsp;#\<SOAP::Mapping::Object:0x8119ce {}Units=#\<SOAP::Mapping::Object:  
> 0x81191a {}Unit=#\<SOAP::Mapping::Object:0x811802  
> {}Id="EF000000AC023F28" {}LastConnect="2007-07-24  
> 19:08:58" {}LastClear="2007-07-23  
> 10:34:48" {}LastDisconnect="2007-07-24  
> 15:51:34" {}LastRTCValue="2007-07-24  
> 20:31:31" {}LastLogStart="2007-07-23  
> 10:05:14" {}LastLocalTime="2007-07-24  
> 19:09:03" {}LastRecordCount="27" {}LastVersion="0" {}LastRevision="23" {}LastErrorStatus="0"\>\>\>\>
> 
> Can someone please give the code to capture the value foe the unit Id  
> into a variable.
> 
> I expected it to be something like:  
> my\_unit\_id = SoapResponse['fetchKnownUnitsResult']['Units'][0]['Id']
> 
> Thanx
> 
> Patrick

---

<div class="post-metadata">

**Author:** ![Dejan\_Dimic](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@Dejan\_Dimic](https://rubytalk.org/u/Dejan_Dimic)\
**Post date:** [13 August 2007 20:34 UTC](https://rubytalk.org/t/accessing-soap-mapping-object/39870/2 "2007-08-13T20:34:57Z")

</div>

You should send your question to [http://groups.google.com/group/soap4r](http://groups.google.com/group/soap4r)

> **···**
>
> On Aug 13, 10:14 pm, Ruby Rookie \<patrick.hoogend...@gmail.com\> wrote:
> 
> > Hi,
> > 
> > I just started with SOAP and Ruby and after one day trying to get it  
> > working I'am now stuck at getting the response into useable variables  
> > i.e. accessing the SOAP::Mapping::Object.  
> > I used soap4r and wdsl2ruby for generating the client code
> > 
> > The bare SOAP XML result is:  
> > \<?xml version="1.0" encoding="utf-8"?\>  
> > \<soap:Envelope xmlns:soap="[http://schemas.xmlsoap.org/soap/envelope/&quot](http://schemas.xmlsoap.org/soap/envelope/&quot);  
> > xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance&quot](http://www.w3.org/2001/XMLSchema-instance&quot);  
> > xmlns:xsd="[http://www.w3.org/2001/XMLSchema&quot;&gt](http://www.w3.org/2001/XMLSchema&quot;&gt);  
> > \<soap:Body\>\<FetchKnownUnitsResponse xmlns="[http://support.somehost.com](http://support.somehost.com):  
> > 2332/"\>  
> > \<FetchKnownUnitsResult\>  
> > \<Units xmlns=""\>  
> > \<Unit\>  
> > \<Id\>EF000000AC023F28\</Id\>\<LastConnect\>2007-07-24 19:08:58\</  
> > \>  
> > \<LastClear\>2007-07-23 10:34:48\</LastClear\>  
> > \<LastDisconnect\>2007-07-24 15:51:34\</LastDisconnect\>  
> > \<LastRTCValue\>2007-07-24 20:31:31\</LastRTCValue\>  
> > \<LastLogStart\>2007-07-23 10:05:14\</LastLogStart\>  
> > \<LastLocalTime\>2007-07-24 19:09:03\</LastLocalTime\>  
> > \<LastRecordCount\>27\</LastRecordCount\>  
> > \<LastVersion\>0\</LastVersion\>  
> > \<LastRevision\>23\</LastRevision\>  
> > \<LastErrorStatus\>0\</LastErrorStatus\>  
> > \</Unit\>  
> > \</Units\>  
> > \</FetchKnownUnitsResult\>  
> > \</FetchKnownUnitsResponse\>  
> > \</soap:Body\>  
> > \</soap:Envelope\>
> > 
> > In ruby  
> > --- begin ruby code ------  
> > #!/usr/bin/env ruby -d  
> > # issue the command to the server  
> > endpoint\_url = ARGV.shift  
> > obj = DefaultSoap.new(endpoint\_url)
> > 
> > # run ruby with -d to see SOAP wiredumps.  
> > obj.wiredump\_dev = STDERR if $DEBUG  
> > #  
> > SoapResponse = obj.fetchKnownUnits(:username =\> 'Me', :challenge =\>  
> > 'Secret')
> > 
> > pp SoapResponse
> > 
> > ----- end ruby code ----
> > 
> > The result on screen is:
> > 
> > #\<FetchKnownUnitsResponse:0x102389c  
> > @fetchKnownUnitsResult=  
> > &nbsp;&nbsp;#\<SOAP::Mapping::Object:0x8119ce {}Units=#\<SOAP::Mapping::Object:  
> > 0x81191a {}Unit=#\<SOAP::Mapping::Object:0x811802  
> > {}Id="EF000000AC023F28" {}LastConnect="2007-07-24  
> > 19:08:58" {}LastClear="2007-07-23  
> > 10:34:48" {}LastDisconnect="2007-07-24  
> > 15:51:34" {}LastRTCValue="2007-07-24  
> > 20:31:31" {}LastLogStart="2007-07-23  
> > 10:05:14" {}LastLocalTime="2007-07-24  
> > 19:09:03" {}LastRecordCount="27" {}LastVersion="0" {}LastRevision="23" {}LastErrorStatus="0"\>\>\>\>
> > 
> > Can someone please give the code to capture the value foe the unit Id  
> > into a variable.
> > 
> > I expected it to be something like:  
> > my\_unit\_id = SoapResponse['fetchKnownUnitsResult']['Units'][0]['Id']
> > 
> > Thanx
> > 
> > Patrick

---

<div class="post-metadata">

**Author:** ![Ruby\_Rookie](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ruby\_Rookie](https://rubytalk.org/u/Ruby_Rookie)\
**Post date:** [14 August 2007 08:20 UTC](https://rubytalk.org/t/accessing-soap-mapping-object/39870/3 "2007-08-14T08:20:02Z")

</div>

I just did, thank you

> **···**
>
> On 13 aug, 22:30, dima \<dejan.di...@gmail.com\> wrote:
> 
> > On Aug 13, 10:14 pm, Ruby Rookie \<patrick.hoogend...@gmail.com\> wrote:
> > 
> > \> Hi,
> > 
> > \> I just started with SOAP and Ruby and after one day trying to get it  
> > \> working I'am now stuck at getting the response into useable variables  
> > \> i.e. accessing the SOAP::Mapping::Object.  
> > \> I used soap4r and wdsl2ruby for generating the client code
> > 
> > \> The bare SOAP XML result is:  
> > \> \<?xml version="1.0" encoding="utf-8"?\>  
> > \> \<soap:Envelope xmlns:soap="[Error](http://schemas.xmlsoap.org/soap/envelope/&quot);  
> > \> xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance&quot](http://www.w3.org/2001/XMLSchema-instance&quot);  
> > \> xmlns:xsd="[http://www.w3.org/2001/XMLSchema&quot;&gt](http://www.w3.org/2001/XMLSchema&quot;&gt);  
> > \> \<soap:Body\>\<FetchKnownUnitsResponse xmlns="[http://support.somehost.com](http://support.somehost.com):  
> > \> 2332/"\>  
> > \> \<FetchKnownUnitsResult\>  
> > \> \<Units xmlns=""\>  
> > \> \<Unit\>  
> > \> \<Id\>EF000000AC023F28\</Id\>\<LastConnect\>2007-07-24 19:08:58\</  
> > \> \>  
> > \> \<LastClear\>2007-07-23 10:34:48\</LastClear\>  
> > \> \<LastDisconnect\>2007-07-24 15:51:34\</LastDisconnect\>  
> > \> \<LastRTCValue\>2007-07-24 20:31:31\</LastRTCValue\>  
> > \> \<LastLogStart\>2007-07-23 10:05:14\</LastLogStart\>  
> > \> \<LastLocalTime\>2007-07-24 19:09:03\</LastLocalTime\>  
> > \> \<LastRecordCount\>27\</LastRecordCount\>  
> > \> \<LastVersion\>0\</LastVersion\>  
> > \> \<LastRevision\>23\</LastRevision\>  
> > \> \<LastErrorStatus\>0\</LastErrorStatus\>  
> > \> \</Unit\>  
> > \> \</Units\>  
> > \> \</FetchKnownUnitsResult\>  
> > \> \</FetchKnownUnitsResponse\>  
> > \> \</soap:Body\>  
> > \> \</soap:Envelope\>
> > 
> > \> In ruby  
> > \> --- begin ruby code ------  
> > \> #!/usr/bin/env ruby -d  
> > \> # issue the command to the server  
> > \> endpoint\_url = ARGV.shift  
> > \> obj = DefaultSoap.new(endpoint\_url)
> > 
> > \> # run ruby with -d to see SOAP wiredumps.  
> > \> obj.wiredump\_dev = STDERR if $DEBUG  
> > \> #  
> > \> SoapResponse = obj.fetchKnownUnits(:username =\> 'Me', :challenge =\>  
> > \> 'Secret')
> > 
> > \> pp SoapResponse
> > 
> > \> ----- end ruby code ----
> > 
> > \> The result on screen is:
> > 
> > \> #\<FetchKnownUnitsResponse:0x102389c  
> > \> @fetchKnownUnitsResult=  
> > \> #\<SOAP::Mapping::Object:0x8119ce {}Units=#\<SOAP::Mapping::Object:  
> > \> 0x81191a {}Unit=#\<SOAP::Mapping::Object:0x811802  
> > \> {}Id="EF000000AC023F28" {}LastConnect="2007-07-24  
> > \> 19:08:58" {}LastClear="2007-07-23  
> > \> 10:34:48" {}LastDisconnect="2007-07-24  
> > \> 15:51:34" {}LastRTCValue="2007-07-24  
> > \> 20:31:31" {}LastLogStart="2007-07-23  
> > \> 10:05:14" {}LastLocalTime="2007-07-24  
> > \> 19:09:03" {}LastRecordCount="27" {}LastVersion="0" {}LastRevision="23" {}LastErrorStatus="0"\>\>\>\>
> > 
> > \> Can someone please give the code to capture the value foe the unit Id  
> > \> into a variable.
> > 
> > \> I expected it to be something like:  
> > \> my\_unit\_id = SoapResponse['fetchKnownUnitsResult']['Units'][0]['Id']
> > 
> > \> Thanx
> > 
> > \> Patrick
> > 
> > You should send your question tohttp://groups.google.com/group/soap4r
