accessing SOAP::Mapping::Object

Discussion in 'Ruby' started by Ruby Rookie, Aug 13, 2007.

  1. Ruby Rookie

    Ruby Rookie Guest

    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/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body><FetchKnownUnitsResponse xmlns="http://support.somehost.com:
    2332/">
    <FetchKnownUnitsResult>
    <Units xmlns="">
    <Unit>
    <Id>EF000000AC023F28</Id><LastConnect>2007-07-24 19:08:58</
    LastConnect>
    <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
     
    Ruby Rookie, Aug 13, 2007
    #1
    1. Advertising

  2. Ruby Rookie

    dima Guest

    On Aug 13, 10:14 pm, Ruby Rookie <> 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/"
    > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > <soap:Body><FetchKnownUnitsResponse xmlns="http://support.somehost.com:
    > 2332/">
    > <FetchKnownUnitsResult>
    > <Units xmlns="">
    > <Unit>
    > <Id>EF000000AC023F28</Id><LastConnect>2007-07-24 19:08:58</
    > LastConnect>
    > <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 to http://groups.google.com/group/soap4r
     
    dima, Aug 13, 2007
    #2
    1. Advertising

  3. Ruby Rookie

    Ruby Rookie Guest

    On 13 aug, 22:30, dima <> wrote:
    > On Aug 13, 10:14 pm, Ruby Rookie <> 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/"
    > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    > > <soap:Body><FetchKnownUnitsResponse xmlns="http://support.somehost.com:
    > > 2332/">
    > > <FetchKnownUnitsResult>
    > > <Units xmlns="">
    > > <Unit>
    > > <Id>EF000000AC023F28</Id><LastConnect>2007-07-24 19:08:58</
    > > LastConnect>
    > > <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


    I just did, thank you
     
    Ruby Rookie, Aug 14, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bashizip
    Replies:
    0
    Views:
    368
    bashizip
    May 19, 2010
  2. Dan Fitzpatrick
    Replies:
    1
    Views:
    388
    NAKAMURA, Hiroshi
    Jul 16, 2005
  3. Graham

    SOAP 'Mapping error'

    Graham, Nov 25, 2005, in forum: Ruby
    Replies:
    1
    Views:
    120
    NAKAMURA, Hiroshi
    Nov 26, 2005
  4. Mason Brown
    Replies:
    1
    Views:
    401
  5. bradrover
    Replies:
    1
    Views:
    172
    NAKAMURA, Hiroshi
    Jun 16, 2007
Loading...

Share This Page