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 = "InterFax Web Service; # 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="Error; 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