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 set the soap_version on a request-by-request basis in 1.2 #320

Closed
jeffdeville opened this issue Sep 17, 2012 · 12 comments
Closed

Can't set the soap_version on a request-by-request basis in 1.2 #320

jeffdeville opened this issue Sep 17, 2012 · 12 comments

Comments

@jeffdeville
Copy link

The docs suggest you can override the soap_version, but w/ 1.2, that doesn't seem to work.

Before, I could:

c = Savon.client ...
c.config.soap_version = 2

In 1.2, it lets you set the soap version, but it doesn't impact the XML that is generated. I think they must be set in a constructor or something.

@timabdulla
Copy link
Member

looking into this...

@jeffdeville
Copy link
Author

Thanks Tim.

@timabdulla
Copy link
Member

interesting bug. if you call Savon::Client#request with an options hash that contains the body attribute, Savon::SOAP::RequestBuilder will call the body= method on its soap object. calling soap in RequestBuilder causes the object to be initialized for the first time. Savon::SOAP::XML (soap creates an instance of this class) requires a config object to be passed to its constructor. because RequestBuilder#config= has not yet been called by Savon::Client#request, RequestBuilder just clones Savon::Client.config, which will not have the soap_version set, and passes it to Savon::SOAP::XML::new.

@timabdulla
Copy link
Member

i'm thinking of a simple way to fix this. sorry this slipped through the cracks!

@timabdulla
Copy link
Member

@jeffdeville - just to confirm, were you calling Savon::Client#request with an options hash that has a body key?

@jeffdeville
Copy link
Author

I believe I tried both:

response = client.request :get_user do
soap.body = HASH_OF_STUFF
soap.version = 2
end

as well as:

response = client.request :get_user, :body => HASH_OF_STUFF do
soap.version = 2
end

Thanks for taking a loot Tim. Appreciate it!

@jeffdeville
Copy link
Author

That said, even:

client = Savon.client(WSDLPATH)
client.config.soap_version = 2

did not work either.

@timabdulla
Copy link
Member

hm, ok. directly modifying soap by calling soap.version= seems to work in my tests. if you could demonstrate some tests that show this not working, that would be really helpful :-) thanks!

@timabdulla
Copy link
Member

@rubiii - I think the best solution to this is for RequestBuilder to take a Savon::Config object in its constructor. I had some other solutions, but this seems to be the safest. thoughts?

@rubiii
Copy link
Contributor

rubiii commented Sep 18, 2012

@timabdulla sounds good

@GeoffTidey
Copy link
Contributor

Hi, I've fixed this (I think), in my pull request here: #329

ccd4b07

@rubiii
Copy link
Contributor

rubiii commented Jan 3, 2013

this should be fixed with savon 2.0. please give it a try and let me know in case you have any problems.

@rubiii rubiii closed this as completed Jan 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

4 participants