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

message :Symbols are case mangled when generated as XML #357

Closed
jasonm23 opened this issue Jan 7, 2013 · 13 comments
Closed

message :Symbols are case mangled when generated as XML #357

jasonm23 opened this issue Jan 7, 2013 · 13 comments

Comments

@jasonm23
Copy link

jasonm23 commented Jan 7, 2013

for example, if we have the following message.

 message = { :IPAddress => "10.0.0.1" }

And we use it to call...

 client.call :get_geo_ip, message: message

The generated XML has the argument node for IPAddress improperly cased as iPAddress

Not sure why we would want to even touch the case of a parameter, but there you go, if we really wanted to correct the case of an argument, and we have the wsdl we should be matching those, otherwise leaving them alone.

I was about to hack the code to fix this, but I can work around it by using a string key instead of a symbol, i.e.

 message = { "IPAddress" => "10.0.0.1" }

a bug nonetheless.

@rubiii
Copy link
Contributor

rubiii commented Jan 7, 2013

this is not really a bug. it's all documented and it's just how gyoku works right now.
the problem here is that currently, savon's parser does not always know about all types. see #346 and #340.
when those problems are solved, we should definitely think about improving this.

@jasonm23
Copy link
Author

jasonm23 commented Jan 8, 2013

Users won't forgive your bugs because of your choice of framework any more than you'd forgive your housepainters sloppy work because he chose a bad brush. While I appreciate you're not directly responsible for the errors in gyoku, it's a bug wether you inherit it or code it yourself.

XML is case sensitive, so mangling case is a bug, who's responsible is irrelevant.

-Edit: Pretty surprised gyoku does this as a default, but it's contrary to the basic XML spec, and with Soap, we have to deal with a lot of .Net generated crap-ola which uses CapitalisedNodeNames as a matter of course.

@rubiii
Copy link
Contributor

rubiii commented Jan 8, 2013

whether you see this is a bug or not is not the point. savon exists for more than three years now
and i'm certainly not trying to make an excuse. use symbols for default camelCase or change the
default to CamelCase or whatever you need: http://savonrb.com/version2.html#globals-request

as i mentioned earlier, it's currently just not possible to get this right, because it needs time to
improve the parser. if that's done, i completely agree that this should work out of the box!

you know this is open source, right? feel free to help out here.

@ashrocket
Copy link
Contributor

\ What, no? I demand that it work the way I expect it too! \ - sartalics

But Seriously, it's a good gem. I wasn't able to use it for my purposed because of the lack of import following in wsdl. My work around was to use jax-ws , build a jar file containing the primary service endpoints I needed, and then to switch to jruby so I can parse the results with Nokogiri.
Looking forward to seeing that wsdl parser be able to follow imported schemas!

Are you modeling the lower layers on jax-ws and jax-b? Or just winging it?

@jasonm23
Copy link
Author

jasonm23 commented Jan 8, 2013

@rubiii Ok, hang on, I'm reporting a bug, not asking for a fix, assumed you'd want faults to be logged. If I have time, I'm more than happy to fix it, but it's up the chain in gyoku, and I've got a reasonable workaround, that's fine for me.

All that really needs to be done with Savon is to have the issue logged and flagged.

@rubiii
Copy link
Contributor

rubiii commented Jan 8, 2013

@ashrocket yes i demand that too :) just saying that someone needs to do it and that takes time.
@jasonm23 agreed. thank you!

@rubiii
Copy link
Contributor

rubiii commented Jan 8, 2013

@ashrocket there's some code up at https://github.com/savonrb/wasabi/tree/sax-parser already.
it's not modelled on jax, but that might be something to look out for. parsing the wsdl is not a problem,
but unfortunately there is no decent xss-parser in ruby and that part needs quite some work.

@ashrocket
Copy link
Contributor

Ah, @jasonm23 - "Users won't forgive your bugs because of your choice of framework any more than you'd forgive your housepainters sloppy work because he chose a bad brush." That's where it turned into something more than a bug report.

And while I actaully agree with @jasonm23 , that It should probably just follow whatever the CASE in the WSDL/SCHEMA docs have, he's made it possible to override any element names using quoted names instead of symbols along with several options.

So this is actually a feature request, and I'd agree with it, enable a mode for gyoku that uses STRICT case matching of the paramters from Schema. I don't think the feature request belongs in gyoku (which is ALSO an open source @rubiii project authored several years ago).

All Gyoku does is convert Ruby Hashed to XML. So, I'm not sure if it could handle being mapped to a schema file set of elements, but it's not really my area.

The feature should be that for SAVON, there ought to be a way to not 'care' about case in Ruby, and still have the XML tags casing come out exactly as the schema defined it should.

Those are my two pretty pennies.

@ashrocket
Copy link
Contributor

@rubiii "there is no decent xss-parser in ruby and that part needs quite some work."
understood, I'd offer to help, but I'm not in a position to put in the time (as expected).

@rubiii
Copy link
Contributor

rubiii commented Jan 8, 2013

@ashrocket i understand. i have a day job as well and i'm investing spare time whenever i can.

@jasonm23
Copy link
Author

jasonm23 commented Jan 9, 2013

@ashrocket @rubiii - oh, I didn't mean to imply I was one of those users who won't forgive a bug. I was simply trying to illustrate how it's generally seen at the end-user level. OpenSource or commercial, we don't want bugs, reason 1, well, we just don't 2. a strong second is, users are demanding, and we all know that's sometimes annoying.

I have a blob of SOAP work to do this month, and if I can get some re-usable stuff out of if that fits into this problem (ie. message parameter parsing / class/ method generation. etc.) I'll try to make it fit into Savon.

@rubiii
Copy link
Contributor

rubiii commented Jan 9, 2013

@jasonm23 that would be awesome.

@rubiii
Copy link
Contributor

rubiii commented Jul 1, 2013

@jasonm23 savon version 2 is mostly based on conventions and only benefits from a few information from the wsdl.
version 3 (under development) is based on a decent wsdl parser and a type system to resolve issues like this.
still a lot of work though. thanks for reporting.

@rubiii rubiii closed this as completed Jul 1, 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

3 participants