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

XML Header encoding in UTF-16 #202

Closed
hechegoyen opened this issue Jun 14, 2011 · 1 comment
Closed

XML Header encoding in UTF-16 #202

hechegoyen opened this issue Jun 14, 2011 · 1 comment
Milestone

Comments

@hechegoyen
Copy link

I'm trying to use your Savon Gem 0.9.2 to interact with a Web Service. The Web Service expects an envelope with an XML header stating a UTF-16 enconding as follows:

<?xml version="1.0" encoding="UTF-16"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

The following link recommends setting the ["Content-Type"] header to a value specifying UTF-16 but the request envelope always comes out as UTF-8:

http://stackoverflow.com/questions/5734961/soap-custom-xml-in-ruby-with-savon

I've been debugging the Gem Code in Request.rb and XML.rb but I cannot find the line that sets the XML header info to UTF-8.

There is a line in Request.rb that has hardcoded values for UTF-8, however, even when I change those to UTF-16 the request still comes out as UTF-8:

# Content-Types by SOAP version.
ContentType = { 1 => "text/xml;charset=UTF-8", 2 => "application/soap+xml;charset=UTF-8" }

This might be the HTTP header instead of the XML header.

You've also recommended calling "instruct!" with arguments to change the contents of the XML Header Line, however, that did not work correctly for me when I tried it. The line had formatting issues.

Further investigation on my part goes down as deep as the "Builder" gem since it seems to be the place where this Header line is being generated.

So, I'm hoping you can provide a fix for this since it could affect other gems.

Thanks for your help,
Hector Echegoyen

@rubiii
Copy link
Contributor

rubiii commented Aug 25, 2011

merged pull request 211 which is supposed to fix your problem and released savon v0.9.7. now that i think about it, i'm not sure if you want to make the change to the xml instruct tag and construct the complete xml (including the envelope) manually.

so, please let me know if this works for you!

cheers,
daniel

@rubiii rubiii closed this as completed Aug 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants