# Problems with SOAP: duplicate XML declarations

**URL:** <https://www.ruby-forum.com/t/problems-with-soap-duplicate-xml-declarations/107072>\
**Category:** Rails\
**Created:** [June 17, 2007, 6:45pm UTC](https://www.ruby-forum.com/t/problems-with-soap-duplicate-xml-declarations/107072 "2007-06-17T18:45:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 17, 2007, 6:45pm UTC](https://www.ruby-forum.com/t/problems-with-soap-duplicate-xml-declarations/107072/1 "2007-06-17T18:45:45Z")

</div>

Hi,

I’m trying to implement a SOAP client using the native Ruby SOAP  
client library. Here’s the relevant bit of code:

```
 XSD::Charset.encoding = 'UTF8' # Set

```

encoding  
wsdlfile = “[http://ws.interfax.net/dfs.asmx?wsdl](http://ws.interfax.net/dfs.asmx?wsdl)” # WSDL  
location  
driver =  
SOAP::WSDLDriverFactory.new(wsdlfile).create\_rpc\_driver # Create  
driver

# and set up

# methods

```
 driver.wiredump_dev = STDERR # output SOAP transactions to STDERR
 @result = driver.SendCharFax({:Username => username, :Password =>

```

password, :FaxNumber =\> destinationfaxnumber, :Data =\>  
‘hello’, :FileType =\> ‘’})

For some reason, this is sending XML with two XML declarations! Here  
is what it is sending:

\<?xml version="1.0" encoding="utf-8" ?\>

\<env:Envelope xmlns:xsd=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)”  
xmlns:env=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)”  
xmlns:xsi=“[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)”\>  
env:Body

\<?xml version="1.0" encoding="UTF-8"?\> pass123 001801751234 hello faxuser 

I’ve tried to figure out what’s going, tried searching Google and also  
asked another Ruby developer, but neither of us have a clue why it’s  
doing this.

Can anybody point me in the right direction?

Cheers,

Jon  
PS: This is the first application I’ve written in Ruby… so don’t  
discount obvious solutions 😉

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 17, 2007, 8:32pm UTC](https://www.ruby-forum.com/t/problems-with-soap-duplicate-xml-declarations/107072/2 "2007-06-17T20:32:56Z")

</div>

I haven’t done too much SOAP, but what I have done, I did pretty much  
exactly the way you did. So, this looks like a bug to me. You might  
want to post this to the Ruby list… Also, the Ruby soap  
implementation is otherwise known as SOAP4r and it has a trac and some  
help here:

[http://dev.ctor.org/soap4r](http://dev.ctor.org/soap4r)

If you figure it out, please do post it here!

Ben

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 18, 2007, 12:54am UTC](https://www.ruby-forum.com/t/problems-with-soap-duplicate-xml-declarations/107072/3 "2007-06-18T00:54:29Z")

</div>

Thanks, I was rather confused about all the different SOAP libraries  
around, so thanks for telling me what soap4r is. It looks like a bug  
to me too, but I didn’t think I was doing anything particularly  
unusual so I suspected my ineptitude more than a bug in a well-used  
piece of code.

I’ll post it to the Ruby list… signing up via Google G. didn’t  
work so I guess I’ll have to do it the old-fashioned way.

Cheers,

Jon
