How to auth apache before soap request

Discussion in 'Ruby' started by Alejandro Michelin salomon, Feb 12, 2009.

  1. hi :
    I am new to ruby.

    I am doing some work wiht soap.
    I create a webservice server with php and a client with ruby.
    The problem is that wdsl file is place in a subfolder that the parent is
    protected by apache authentication.

    This is the client code:

    <code>
    require 'net/http'
    require 'rubygems'
    require 'soap/wsdlDriver'

    #This is folder is authenticated by apache : http://localhost/homeinf

    wsdl_url = "http://localhost/homeinf/wbs/teste.wsdl"; # note that is
    under authenticated folder

    user = "peter";
    pass = "peter123";

    soap = SOAP::WSDLDriverFactory.new(wsdl_url); # this fail.
    soap.options["protocol.http.basic_auth"] << [wsdl_url,user,pass];
    driver = soap.create_rpc_driver;
    </code>

    This give this error :
    "
    D:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.3.1/lib/httpclient.rb:829:in
    `follow_redirect': unexpected response: #<HTTP::M
    essage::Headers:0x309b070 @body_date=nil, @status_code=401,
    @dumped=false, @request_method=nil, @body_charset=nil, @request_
    via_proxy=nil, @chunked=false, @http_version="1.1",
    @header_item=[["Date", "Thu, 12 Feb 2009 17:06:39 GMT"], ["Server", "Apa
    che/2.2.11 (Win32) PHP/5.2.8"], ["WWW-Authenticate", "Basic
    realm=\"teee\""], ["Content-Length", "401"], ["Content-Type", "t
    ext/html; charset=iso-8859-1"]], @body_size=0, @body_type=nil,
    @request_query=nil, @is_request=false, @reason_phrase="Author
    ization Required", @request_uri=nil> (HTTPClient::BadResponseError)
    from
    D:/ruby/lib/ruby/gems/1.8/gems/httpclient-2.1.3.1/lib/httpclient.rb:514:in
    `get_content'
    from D:/ruby/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:64:in
    `fetch'
    from D:/ruby/lib/ruby/1.8/wsdl/xmlSchema/importer.rb:30:in
    `import'
    from D:/ruby/lib/ruby/1.8/wsdl/importer.rb:18:in `import'
    from D:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:124:in `import'
    from D:/ruby/lib/ruby/1.8/soap/wsdlDriver.rb:28:in `initialize'
    from D:/projetos-ruby/soap/soap_cliente1.rb:10:in `new'
    from D:/projetos-ruby/soap/soap_cliente1.rb:10
    "

    soap = SOAP::WSDLDriverFactory.new(wsdl_url) can not read the wsdl file,
    becouse apache block it due authtentication fail.

    How to do the apache auth before i call soap?

    Thanks in advance
    --
    Posted via http://www.ruby-forum.com/.
    Alejandro Michelin salomon, Feb 12, 2009
    #1
    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. =?Utf-8?B?Q2hyaXMgTW9oYW4=?=

    Configuring Windows Auth & Forms Auth in Asp.Net

    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=, Apr 28, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    685
    =?Utf-8?B?Q2hyaXMgTW9oYW4=?=
    Apr 28, 2004
  2. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Windows Auth, but Forms Auth for one page?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Jan 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    542
    Elton Wang
    Jan 8, 2005
  3. Mark Chai
    Replies:
    1
    Views:
    738
    Christophe Vanfleteren
    Oct 1, 2003
  4. Chris Mohan

    Configuring Windows Auth & Forms Auth in Asp.Net

    Chris Mohan, Apr 28, 2004, in forum: ASP .Net Security
    Replies:
    2
    Views:
    405
    Chris Mohan
    Apr 29, 2004
  5. Forms Auth Info passed to Windows Auth?

    , Apr 28, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    213
    Hernan de Lahitte
    May 3, 2005
Loading...

Share This Page