Google Groups Home
Help | Sign in
Message from discussion soap4r and basic_auth over ssl
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
rekabutt  
View profile
 More options May 1, 9:52 am
From: rekabutt <rekab...@gmail.com>
Date: Thu, 1 May 2008 06:52:43 -0700 (PDT)
Local: Thurs, May 1 2008 9:52 am
Subject: Re: soap4r and basic_auth over ssl
I was having similar problems recently and got it resolved.  I ended
up using the wsdl2ruby to create a driver.  Then in the client file
adding the ssl and basic auth support.

    obj = ServicesPortType.new(wsdl_url)
    obj.options["protocol.http.ssl_config.verify_mode"] = nil
    obj.options["protocol.http.basic_auth"] << [wsdl_url, username,
password]

I'm aware of the security loss in this case by turning off the ssl
verification, but it got it working for now.  If you do want the ssl
to be on though, you have to do the verification.  I saw some samples
for this on the soap4r site, but never worked on it myself.

I'm not sure what you are trying to connect to, but I ran into an
instance where it wouldn't connect to a php4 service, just php5.  I
never investigated why that was.

Good luck.

On Apr 20, 12:04 pm, "oleg.khaba...@gmail.com"

<oleg.khaba...@gmail.com> wrote:
> Yes, I needed to append my message. I tried the soap/property file
> route as well. It does apply user/pass from what s.options.to_yaml
> tells me. However it still doesn't send them over.

> This is what i have in my soap/property:

> client.protocol.http.ssl_config.ciphers = DEFAULT
> client.protocol.http.basic_auth.1.url =https://somesite.com/Webservice
> client.protocol.http.basic_auth.1.userid = username
> client.protocol.http.basic_auth.1.password = password

> Had to pass the ciphers option as well because WSDLDriverFactory.new
> would crap out on https:// url. Hopefully that doesn't affect
> basic_auth.

> On Apr 20, 10:36 am, Artem <Artem.Tambovs...@gmail.com> wrote:

> > Hi Oleg,

> > If I remember there was a discussion in this group abous this matter
> > (try to google int this group about 'property' to find it).
> > The general idea that you have to specify basic_auth credentials
> > before SOAP::WSDLDriverFactory object creation.
> > This could be done by specifying credentials in soap/property file.

> > client.protocol.http.basic_auth.1.url =https://your.soap.app/url
> > client.protocol.http.basic_auth.1.userid = xxxxxxxx
> > client.protocol.http.basic_auth.1.password = yyyyyyyyy

> > Regards,
> > Artem

> > On Apr 19, 12:41 am, "oleg.khaba...@gmail.com"

> > <oleg.khaba...@gmail.com> wrote:
> > > Hello there,

> > > I'm having some problems with getting basic_auth working. Here's some
> > > stats:

> > > Ruby 1.8.6
> > > Soap4r 1.5.8
> > > httpclient 2.1.2

> > > This is the application flow:

> > > >> s = SOAP::WSDLDriverFactory.new("https://somesite.com/Service?wsdl").create_rpc_driver

> > > => #<SOAP::RPC::Driver:#<SOAP::RPC::Proxy:https://somesite.com/
> > > Service>>>> s.options["protocol.http.basic_auth"] << ["https://somesite.com/Service?wsdl", "user", "pass"]

> > > => ["https://somesite.com/Service?wsdl", "user", "pass"]

> > > >> s.wiredump_dev = STDOUT
> > > => #<IO:0x2e7d4>
> > > >> s.getUser('bob')

> > > And this is the result. Notice that authentication stuff doesn't get
> > > sent. I'm not sure what kind of format they should be as, but it's
> > > just not there.

> > > Wire dump:

> > > = Request

> > > ! CONNECT TO somesite.com:443
> > > ! CONNECTION ESTABLISHED
> > > POST /services/EndUser HTTP/1.1
> > > SOAPAction: ""
> > > Content-Type: text/xml; charset=utf-8
> > > User-Agent: SOAP4R/1.5.8 (/187, ruby 1.8.6 (2007-09-23) [i686-
> > > darwin9.0.0])
> > > Date: Fri, 18 Apr 2008 20:31:29 GMT
> > > Content-Length: 468
> > > Host: somesite.com

> > > <?xml version="1.0" encoding="utf-8" ?>
> > > <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > >     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
> > >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > >   <env:Body>
> > >     <n1:getUser xmlns:n1="http://enduser.webservice.quotemedia.com"
> > >         env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
> > >       <userName xsi:type="xsd:string">bob</userName>
> > >     </n1:getUser>
> > >   </env:Body>
> > > </env:Envelope>

> > > = Response

> > > HTTP/1.1 500 Internal Server Error
> > > Server: Resin/2.1.14
> > > Cache-Control: private
> > > Set-Cookie: JSESSIONID=a8a2hMpDf-rf; path=/
> > > Content-Type: text/xml; charset=utf-8
> > > Connection: close
> > > Transfer-Encoding: chunked
> > > Date: Fri, 18 Apr 2008 20:31:29 GMT

> > > 1a5
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
> > > envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > >  <soapenv:Body>
> > >   <soapenv:Fault>
> > >    <faultcode>soapenv:Server.generalException</faultcode>
> > >    <faultstring>bad credentials</faultstring>
> > >    <detail/>
> > >   </soapenv:Fault>
> > >  </soapenv:Body>
> > > </soapenv:Envelope>
> > > 0

> > > ! CONNECTION CLOSED

> > > SOAP::FaultError: bad credentials
> > >         from #<SOAP::Mapping::Object:0x3a343fc>

> > > Help please?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google