ruby-uVecrDnOqVGaMJb+Lgu22Q@public.gmane.org
2007-Jun-17 16:45 UTC
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 ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
bmunat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-17 18:31 UTC
Re: Problems with SOAP: duplicate XML declarations
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 On Jun 17, 6:45 am, "r...-uVecrDnOqVGaMJb+Lgu22Q@public.gmane.org" <m...-uVecrDnOqVGaMJb+Lgu22Q@public.gmane.org> wrote:> 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 ;)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ruby-uVecrDnOqVGaMJb+Lgu22Q@public.gmane.org
2007-Jun-17 22:54 UTC
Re: Problems with SOAP: duplicate XML declarations
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 On Jun 17, 8:31 pm, "bmu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <bmu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > On Jun 17, 6:45 am, "r...-uVecrDnOqVGaMJb+Lgu22Q@public.gmane.org" <m...-uVecrDnOqVGaMJb+Lgu22Q@public.gmane.org> wrote: > > > 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 ;)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---