Problems with SOAP: duplicate XML declarations


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

wsdlfile = “” # WSDL
driver = # Create

and set up


 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=“

<?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?


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

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:

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


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.