Forum: Ruby on Rails Problem with web services

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dd71173eb0a0c8c382a81350021174ef?d=identicon&s=25 Sal00m geckko (Guest)
on 2006-02-09 17:35
(Received via mailing list)
Hi all:

First of all i apologize for my poor english, if don't understand
something
please tell me, and i will try to explain again.

Hi have a litlle problem with web services. I explain, i a have a web
service in php that return a structure seems to this:

Array
(
    [url] =>
    [crm] => Array
        (
            [0] => Array
                (
                    [surname] => AAAA
                    [category] => Client

                    [email] => prueba@mail.com
                    [nifCif] => 000000000-Q
                    [name] => PRUEBA
                    [phone] =>

                    [phone] =>
                    [clientype] => 1
                    [doctype] =>
                    [clientStatus] => CLIENT
                    [id] => 0000001

                    [version] =>
                )

        )

    [tipoDoc] => NIF
)

This is a print_r in php of the response of web service.

Well, the problem is how to map the SOAP OBJECT that uses ruby, in a
hash or
array, for simple access to the values that the web service return. hope
i
explain correctly :S

My code now is this:
@proxy =
SOAP::RPC::Driver.new("http://172.16.11.12:8888/server.php",nil<http://17...)
@proxy.add_method("GetbyDocument", "id","contract","action")
@result = @proxy.GetbyDocument(@documento,@contrato,"")


 - "GetByDocument" is the name of the web service and id, contract and
action are the params of the method.

In the next line i invoke the web service method and in the result
variable
i obtain the response of the web service, the SOAP OBJECT, and i dont
know
how to access the values like i do in PHP

I need something like this.

Eg:

@arrayAux = Hash.new()
@arrayAux = @resultado.valores //the values of the response of web
service

To obtein doctype ---> @arrayAux[2] ---> NIF
To obtain clientstatus ---> @arrayAux[1][0][9] ---> CLIENT

Hope you will understand me, Thanks in advance.
This topic is locked and can not be replied to.