Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Savon 2.0.2 basic auth problem #367

Closed
mcmlxxxiii opened this issue Jan 18, 2013 · 19 comments
Closed

Savon 2.0.2 basic auth problem #367

mcmlxxxiii opened this issue Jan 18, 2013 · 19 comments
Milestone

Comments

@mcmlxxxiii
Copy link

(Savon.client :wsdl => "http://some.valid.wsdl.url?wsdl",
:basic_auth => ["login", "pass"]).operations

Below is the HTTPI response produced by the above Savon request. I've printed it having added require 'pp'; pp response line to Wasabi::Resolver#load_from_remote method.

I swear I do get a wsdl document in a browser having reached the wsdl url and having provided same basic auth credentials.

#<HTTPI::Response:0x0000000620c6e0
 @code=401,
 @headers=
  {"date"=>"Fri, 18 Jan 2013 09:38:07 GMT",
   "server"=>"Apache/2.2.14 (Win32) PHP/5.3.1",
   "www-authenticate"=>"Basic realm=\"Redacted\"",
   "content-length"=>"8",
   "set-cookie"=>"vrs_rc=;Version=1",
   "content-type"=>"text/plain"},
 @raw_body="redacted">
@rubiii
Copy link
Contributor

rubiii commented Jan 18, 2013

that's pretty hard to debug without access to the server.
you could start with using httpi to get the wsdl in order to isolate the problem.

request = HTTPI::Request.new
request.url = "http://some.valid.wsdl.url?wsdl"
request.auth.basic("login", "pass")

response = HTTPI.get(request)

@mcmlxxxiii
Copy link
Author

Thank you for such a quick response. Your above code is working and I confirm I get a wsdl document having substituted string for my valid ones. But my (Savon.client).operations request is not working.

@mcmlxxxiii
Copy link
Author

(Savon.client :wsdl => "http://login:pass@some.valid.wsdl.url?wsdl").operations works though.

@seanmil
Copy link
Contributor

seanmil commented Jan 18, 2013

I have encountered this as well. It seems that the HTTP authentication credentials are not being passed into the WSDLRequest methods. If your WSDL requires HTTP authentication in order to retrieve it then it will fail. I have a small patch which seems to fix it for me. I'm opening a pull request now.

@DrXyzzy
Copy link

DrXyzzy commented Jan 18, 2013

+1. Thank you. I was on the trail of the same problem. Have access working with savon 1 but can't fetch wsdl in savon 2 because it's behind basic auth.

@mcmlxxxiii
Copy link
Author

Thank you, @seanmil ! I hope @rubiii wouldn't mind merging your commit.

@DrXyzzy
Copy link

DrXyzzy commented Jan 19, 2013

Hmm. You might want a separate global for wsdl authorization e.g. :wsdl_basic_auth, than for request authorization :basic_auth, so that users who need basic auth for requests but not for wsdl aren't sending credentials during the wsdl fetch. Or just keep code as is in savon-2.0.2 and document that :basic auth is ignored by wsdl fetch, and the way to do it is :wsdl => "http://login:pass@some.valid.wsdl.url?wsdl" as noted by @mcmlxxxiii above.

@javinto
Copy link

javinto commented Jan 25, 2013

I would vote for this issue to be solved. Having the same problem, luckilly I have a local WDSL as well to keep working with, but I prefer using the remote one. Credentials in my case are the same but I can imagine they differ in some situations.

@rubiii
Copy link
Contributor

rubiii commented Jan 25, 2013

i would like to get this resolved as well, but i'm not sure about the best solution.

is it save to apply basic auth for all wsdl requests or does this need to be another option like @DrXyzzy suggested?
and if we're introducing a new option for this, what about cookies, timeouts, ssl auth, etc.? do these options apply to both requests or do we need separate options for everything?

i'm really missing some kind of concept for this and i'm open for suggestions!

@rubiii
Copy link
Contributor

rubiii commented Jan 25, 2013

related: #378

@larskanis
Copy link
Contributor

I'm not too experienced with SOAP nor savon, but in case my opinion is interesting for someone: For the two services I use in production, the same auth schema applies to WSDL and calls. So you could merge this patch and should there be a demand to run a different scheme for WSDL, you still can introduce new :wsdl_* style options that overwrite the other options for the WSDL request.

@DrXyzzy
Copy link

DrXyzzy commented Jan 25, 2013

+1 what @larskanis suggests. Try it and see. Maybe we don't need the complication of separate wsdl_ settings after all. My use case uses the same basic auth for wsdl and SOAP requests.

@seanmil
Copy link
Contributor

seanmil commented Jan 25, 2013

I'll admit to being partial to the patch as-is, but I think it would be highly unusual to require different auth credentials between the WSDL and SOAP requests. I vote proceed with this as it solves a real problem a number of us are really experiencing. If an actual use-case for more independent settings for the WSDL arise then at that time it will hopefully be clearer what the implementation should look like (as far as which options need to be duplicated and supported, etc.)

@schir1964
Copy link

Ditto

Christopher Mullins

@rubiii
Copy link
Contributor

rubiii commented Jan 26, 2013

thanks for sharing your use cases. i just merged #369 and pushed to master. let me know if this works for you.

@javinto
Copy link

javinto commented Jan 27, 2013

I just tested with the master and a remote wdsl, and the merge is working for me! Thanks

@rubiii
Copy link
Contributor

rubiii commented Feb 3, 2013

released v2.1.0. please refer to the updated changelog and documentation for details. let me know how it works!

@rubiii rubiii closed this as completed Feb 3, 2013
@javinto
Copy link

javinto commented Feb 4, 2013

Hi Daniel,

For me release 2.1 works fine!

Thanks for all the work.

Javinto

Op 3 feb 2013, om 13:38 heeft Daniel Harrington het volgende geschreven:

released v2.1.0. please refer to the updated changelog and documentation for details. let me know how it works!


Reply to this email directly or view it on GitHub.

@rubiii
Copy link
Contributor

rubiii commented Feb 4, 2013

thanks @javinto. you're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants