Forum: Ruby on Rails SOAP WSDLFactory

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.
B0f6756b62559d43213636dde11bb785?d=identicon&s=25 BenH (Guest)
on 2009-03-27 00:10
(Received via mailing list)
I've created a method for creating a SOAP WSDL driver.
I've tested this without basic auth and without SSL and it works
great. The sysadmin has enabled SSL and basic auth and now I'm stuck.

The error is:
HTTPClient::BadResponseError: unexpected response:
#<HTTP::Message::Headers:0x2aaaae21cd10 @body_date=nil,
@status_code=401, @dumped=false, @body_size=0, @body_charset=nil,
@request_via_proxy=nil, @chunked=false, @header_item=[["Content-
Length", "1656"], ["Content-Type", "text/html"], ["Server", "Microsoft-
IIS/6.0"], ["WWW-Authenticate", "Negotiate"], ["WWW-Authenticate",
"NTLM"], ["X-Powered-By", "ASP.NET"], ["Date", "Thu, 26 Mar 2009
21:12:23 GMT"]], @body_type=nil, @request_query=nil,
@is_request=false, @reason_phrase="Unauthorized", @request_uri=nil,
@http_version="1.1", @request_method=nil>

Which seems to indicate a failed authentication...

Here's the method:

  def create_record_driver # WS for creating a new record
    username = "username"
    password = "mypassword"
    ws_site = "https://#{BASE_SITE}/ws/CreateRecord.asmx"
    wsdl = "#{ws_site}?WSDL"
    drv = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
    drv.options['protocol.http.ssl_config.verify_mode'] =
OpenSSL::SSL::VERIFY_NONE
    drv.options["protocol.http.basic_auth"] << [ ws_site, username,
password ]
    return drv
  end

Any help would be appreciated.
This topic is locked and can not be replied to.