[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: SOAP how to make a request
From:       Mark Thomas <mark () thomaszone ! com>
Date:       2009-04-30 17:40:04
Message-ID: cd77270c-9fb6-4203-89af-a0db38ea5e38 () j18g2000prm ! googlegroups ! com
[Download RAW message or body]

On Apr 30, 11:27 am, Mario Ruiz <ma...@betware.com> wrote:
> Hi, I'm newbie sorry
> I'm testing a web service, loginCustomer but I don't know why always
> returns... failed to login user. This is my code:
>
> require "soap/wsdlDriver"
> WSDL_URL = "http://myserver/WS/services/Access?wsdl"
> service = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
>
> service.generate_explicit_type = true
> service.wiredump_dev = STDOUT if $DEBUG
>
> query="
> <soapenv:Envelope
> xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
> xmlns:ser='http://myserver.com/WS/services'>
>    <soapenv:Header/>
>    <soapenv:Body>
>       <ser:loginCustomer>
>          <ser:loginMethodDTO>
>             <ser:loginName>myUser</ser:loginName>
>             <ser:password>myPwd</ser:password>
>          </ser:loginMethodDTO>
>       </ser:loginCustomer>
>    </soapenv:Body>
> </soapenv:Envelope>
> "
> result = service.loginCustomer(query)
>
> The xml is working on another client I'm using so this is not the
> problem.
>
> Thanks in advance. :)

This doesn't look right. Usually, you don't hand-code a string
containing SOAP XML and call SOAP4R methods with it. The purpose of
SOAP4R is to shield you from all that.

It's hard to tell exactly without the WSDL, but my guess is that what
you really want is something like
result = service.loginCustomer('user','pass').

Have you tried generating a sample client? See
http://markthomas.org/2007/09/12/getting-started-with-soap4r/

-- Mark.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic