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

Adding attributes to the SOAP Body's root element #30

Closed
andrewmbenton opened this issue Jan 27, 2010 · 5 comments
Closed

Adding attributes to the SOAP Body's root element #30

andrewmbenton opened this issue Jan 27, 2010 · 5 comments

Comments

@andrewmbenton
Copy link
Contributor

My problem is that i need to put some attributes on the "root" element within the SOAP body, so I need something that looks like:
env:Body
<wsdl:someRequest attr1="val1" attr2="val2">
...
/wsdl:someRequest
/env:Body
Right now the savon api only allows a single element tag name assigned to the input instance variable of the soap object, as in:
response = @savon_client.some_request! do |req|
req.namespace = @namespace
req.action = "someRequest"
req.input = "someRequest"
end
Seems like the most elegant fix might be to expose a little more of the underlying Builder::XmlMarkup object for those who require more flexibility than a simple hash can provide.

@andrewmbenton
Copy link
Contributor Author

Since this issue was brought up under a different thread (Issue #7) I'm splitting it off here, along with my proposed solution and the link to my fork.

@andrewmbenton
Copy link
Contributor Author

OK here's the commit from my fork (turned out to be a one line edit to the input_array method): http://github.com/stanleydrew/savon/commit/86d06e216f5c9fdde8a33ad0666db1929fe8a8c1
Now you can do the following:
soap.input = "someRequest", {"someAttribute"=>"someValue", ...}
to get:
soap:Body
<wsdl:someRequest someAttribute="someValue" ...>
...
/wsdl:someRequest
/soap:Body
This way the Savon api doesn't change. You can still assign a single string to soap.input. There's just added functionality now.

@rubiii
Copy link
Contributor

rubiii commented Jan 28, 2010

thanks! merged your commit into the dev branch: http://github.com/rubiii/savon/commit/64a78c00760c123b65a0528c4d67772f398d368f - will be included in the next release.

@andrewmbenton
Copy link
Contributor Author

great to hear! looking forward to the new release.

@rubiii
Copy link
Contributor

rubiii commented Jan 31, 2010

released version 0.7.3 including a patch for this issue.

This issue was closed.
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

2 participants