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

Can't get access to http client instance #383

Closed
ghost opened this issue Jan 30, 2013 · 6 comments
Closed

Can't get access to http client instance #383

ghost opened this issue Jan 30, 2013 · 6 comments

Comments

@ghost
Copy link

ghost commented Jan 30, 2013

Hello,

I'm pretty new to Savon but even after reading thoroughly the documentation, I couldn't
get access to the http request after the client object has been created. It seems it was
possible in version 1 but not in version 2.

I need to modify the headers sent because I'm using the same client object for different
WS methods.

Also, block examples in the doc:

response = client.call(:authenticate) do
message username: "luke", password: "secret"
convert_request_keys_to :camelcase
end

don't work !

Is it a non-existing feature?

Also, is Savon managing the cookies automatically? I mean resending Cookies
is the server send back at Set-Cookie header?

Thanks for any help

@ghost
Copy link
Author

ghost commented Jan 30, 2013

OK this works:

client.globals.headers({"Cookie" => "mycookie"})

if client is my Client instance.

But documentation should be a little more detailed.

@rubiii
Copy link
Contributor

rubiii commented Jan 30, 2013

i'm glad client.globals works for you, but this is really just used internally by Savon::Model and should only be used as a workaround. for that reason it is not documented. apart from that, there's lots of documentation. if there's anything missing, you're very welcome to help out.

not sure what you mean by "block examples in the doc don't work!".

savon 2.0 only remembers cookies from the last request. this is going to change with 2.1.
see #363 for more information.

@ghost
Copy link
Author

ghost commented Jan 30, 2013

Thanks for your answer.

I couldn't find in the doc how to modify header of the request when an object is already created.
The only examples are setting headers at creation time.

What I want to achieve is to set headers once the client has been created. How do you make this?

@ghost
Copy link
Author

ghost commented Jan 30, 2013

Oups, I'm pretty sure I stumbled upon the same issue than #363.

I'm sending a session cookie (SESSIONID=somevalue) which is sometimes changing (only the value:
SMSESSION=someothervalue) and Savon is not updating the value. That's why I wanted to manage it
manually.

@rubiii
Copy link
Contributor

rubiii commented Jan 30, 2013

for the request headers, i will think about introducing a local/request option. the global headers are used to retrieve the wsdl and for executing soap requests, so this needs to be defined as early as possible. if changing them through client.globals works for you now, you can definitely use it until there's a proper option to do this.

#363 is fixed is fixed on master, so please give it a try. the changes for 2.1 can be found in the changelog.
i'm going to release that version this evening.

@rubiii
Copy link
Contributor

rubiii commented Feb 3, 2013

unfortunately, v2.1.0 was delayed due to the rubygems outage, but it's released now. please give it a try.
could you please open a new issue for "changing the http headers per request" describing your use case?

@rubiii rubiii closed this as completed Feb 3, 2013
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

1 participant