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 first element of the Body #61

Closed
jlecour opened this issue May 19, 2010 · 13 comments
Closed

Adding attributes to the first element of the Body #61

jlecour opened this issue May 19, 2010 · 13 comments

Comments

@jlecour
Copy link

jlecour commented May 19, 2010

Hi,

I'm trying to make something like this
env:Body/env:Body

With a soap.body = {:attributes! => ...} I can add some attributes on elements inside the first element of the Body, but on the first element itself.

Am I missing something or it is impossible ?

After reading the source, I guess it's impossible because in Savon::SOAP#xml_body I can see that there is an enclosing tag with the wsdl namespace.

Thanks for any help

@elcuervo
Copy link
Contributor

When you define the body you can actually put any xml in the body, just use Builder and define any markup you want.

@jlecour
Copy link
Author

jlecour commented May 21, 2010

That's right, but there is still an enclosing tag I can't remove.
Let's say my SOAP action is Hello, it will be
<env:Body><wsdl:Hello><MyCustomXML /></wsdl:Hello></env:Body>

@elcuervo
Copy link
Contributor

So you want to add attributes on the Body?

@jlecour
Copy link
Author

jlecour commented May 21, 2010

No ;-)

In the previous example, it would be on <wsdl:Hello>

@elcuervo
Copy link
Contributor

I'm pretty confused, can you paste the final xml you want? :S

@jlecour
Copy link
Author

jlecour commented May 21, 2010

Pardon me if I'm not clear.

<env:Body><wsdl:Hello attr1='value1' attr2='value2'></wsdl:Hello></env:Body>

@elcuervo
Copy link
Contributor

In a block doing the call, you can do something like this:

webservice = Savon::Client.new 'http://url...'
webservice.hello do |soap|
    soap.input = [soap.input, { :attr1 => 'value1', :attr2 => 'value2' }]
    soap.body = 'whatever xml'
end

@jlecour
Copy link
Author

jlecour commented May 21, 2010

great, I'll try that, thanks.

@jlecour
Copy link
Author

jlecour commented May 21, 2010

Yes it is working as I expected . Thanks.

@shreya
Copy link

shreya commented Sep 14, 2010

Could I produce something like this -


<env:Body>
<wsdl:hello>
<subtag attr1='value1'></subtag>
</wsdl:hello>
</env:Body>


@rubiii
Copy link
Contributor

rubiii commented Oct 4, 2010

fixed in dev branch. will be released asap.

@rubiii
Copy link
Contributor

rubiii commented Oct 29, 2010

please try savon 0.8.0.beta.1

@rubiii
Copy link
Contributor

rubiii commented Dec 20, 2010

released v0.8.0 which should solve this problem.

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

4 participants