Forum: Ruby on Rails Problems with SOAP: duplicate XML declarations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
29f760bc88a1107e921e64e27966aff5?d=identicon&s=25 ruby@orangejon.com (Guest)
on 2007-06-17 18:45
(Received via mailing list)
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"     # 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"
   xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <env:Body>
<?xml version="1.0" encoding="UTF-8"?>
<hash>
 <Password>pass123</Password>
 <FaxNumber>001801751234</FaxNumber>
 <FileType></FileType>
 <Data>hello</Data>
 <Username>faxuser</Username>
</hash>
 </env:Body>
</env:Envelope>

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 ;)
8310c5a7c769345114597bcdef111488?d=identicon&s=25 bmunat@gmail.com (Guest)
on 2007-06-17 20:32
(Received via mailing list)
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

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

Ben
29f760bc88a1107e921e64e27966aff5?d=identicon&s=25 ruby@orangejon.com (Guest)
on 2007-06-18 00:54
(Received via mailing list)
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 Groups didn't
work so I guess I'll have to do it the old-fashioned way.

Cheers,

Jon
This topic is locked and can not be replied to.