Problems with SOAP: duplicate XML declarations

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 :wink:

Hi,

ruby@orangejon.com wrote:

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

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

What version of soap4r are you using? The versions from
soap4r-1.5.5.20070519 to soap4r-1.5.5.20070605 try to call 'to_xml'
method of parameters. Later versions try to call 'to_xmlpart' instead
of 'to_xml'. Just updating soap4r should solve the problem.

Regards,
// NaHi

Yay! I updated all my gems ("gem update") including soap4r, restarted
the server and voila! Correct XML and it's all working again :slight_smile:

Thanks for your help!

Cheers,

Jon

···

On Jun 18, 3:34 pm, "NAKAMURA, Hiroshi" <nakah...@sarion.co.jp> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

r...@orangejon.com wrote:
> I'm trying to implement a SOAP client using the native Ruby SOAP
> client library. Here's the relevant bit of code:
> For some reason, this is sending XML with two XML declarations! Here
> is what it is sending:

What version of soap4r are you using? The versions from
soap4r-1.5.5.20070519 to soap4r-1.5.5.20070605 try to call 'to_xml'
method of parameters. Later versions try to call 'to_xmlpart' instead
of 'to_xml'. Just updating soap4r should solve the problem.

Regards,
// NaHi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRnaJuh9L2jg5EEGlAQIQVAf/TsfXyi1xyjjkr+4E+j3FVBW46nRNbbxu
HktnHj3OQMIotpv9FAGv0jGJq+C87ca9fCQSg+4xV8fauSVWEkZXJHotRkZ+gTQS
3lOtU8+IAvSuxzlMGIWjUgwFXkSTSeN/SvWrbt0cdk/pINIumxl5ATaRQ/WK6gUD
kqf9WMpbwUfvRuiNqnmmMWk5rPpBoLnoLWB3/wnFS+ksodZOcUGFDTRdGs0Ivo9h
mlz+b31JhQoIFaxsWcucMuM0itpuzgfTEe2eYFe7sBbEY1p7W4fF3Lc+238ydu6q
xqfTBUz0+ajIzmMIboLN6otGob5OcnwR7aUNMa97HYLnq81ryWHmNg==
=4hGI
-----END PGP SIGNATURE-----