{"id":7051,"date":"2014-05-17T00:25:15","date_gmt":"2014-05-17T00:25:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/17\/problem-about-savon-collection-of-common-programming-errors\/"},"modified":"2014-05-17T00:25:15","modified_gmt":"2014-05-17T00:25:15","slug":"problem-about-savon-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/17\/problem-about-savon-collection-of-common-programming-errors\/","title":{"rendered":"problem about savon-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e10338b149dd02f6b974b61b0869905c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBoris<br \/>\nruby web-services savon<br \/>\nI am trying to call a web service using Savon. The request I am trying to generate is this (this is a valid request that is working, generated with wizdler):&lt;Envelope xmlns=&#8221;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&#8221;&gt;&lt;Body&gt;&lt;FraudValidationRequest xmlns=&#8221;http:\/\/schemas.gid.gap.com\/fraudvalidation\/v3&#8243;&gt;&lt;OrderHeader xmlns=&#8221;&#8221;&gt;&lt;EntryType&gt;1&lt;\/EntryType&gt; &#8230;. more attributesBut I get something like this:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt; &lt;env:Envelope xmln<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/716521667807b542d722f51281f97e72?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlex Peattie<br \/>\nruby soap savon<br \/>\nHow can I add an encoding attribute to the body tag using Savon?Some background: I am trying to use savon to connect to a SOAP resource. I can get the WSDL file and browse through the methods.@client = Savon::Client.new(&#8220;http:\/\/some.domain.com\/v2messaging\/service?WSDL&#8221;)when I try to use the login methodresponse = @client.request :service, :login dosoap.body = { &#8220;String_1&#8221; =&gt; &#8220;username&#8221;,&#8221;String_2&#8243; =&gt; &#8220;password&#8221;} endI get this error:Failure\/Error: response = @client.request :service, :login<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/43d5cf22e70037c997683ffb88790e7f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nArtem Zankovich<br \/>\nruby-on-rails-3 soap soapui savon<br \/>\nI always use SoapUI before moving on with Savon to see if my URL is correct. Now this time I was given a URL that (probably from a project developed and hosted on a Windows machine), let&#8217;s say it is this one:www.myservice.com\/login\/eeu.aspx?WSDLNow when I try this, I get this:Error loading [www.myservice.com\/login\/eeu.aspx?WSDL]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected character encountered (lex state 3): &#8216;&amp;&#8217;SoapUI will also do HTTP requests righ<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3bb66f4f89b425291b93a1c51a43e1ee?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAmin Y<br \/>\nruby-on-rails soap wsdl savon<br \/>\nI want to use a webservice with a method &#8220;verifyTransaction&#8221; that get two strings as input and return a double as output. I used the code below for that:client = Savon::Client.new do |wsdl|wsdl.document = &#8220;https:\/\/www.myserver.com\/ReferencePayment?WSDL&#8221; endresponse = client.request :wsdl, &#8220;verifyTransaction&#8221; dosoap.body ={&#8220;RefNum&#8221; =&gt; &#8220;121312&#8221;, &#8220;MerchantID&#8221; =&gt; &#8220;02233763&#8221;} endbut the I got this error:Savon::SOAP::Fault ((env:Client) caught exception while handling request: unexpected encodin<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/66c8adf41fc6fb57841f39443f3c0043?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nfranklin stine<br \/>\nruby-on-rails-3.2 axis2 savon<br \/>\nI&#8217;m trying to call a simple operation with Savon, but it keeps throwingSavon::SOAPFault ((soapenv:Server) org.apache.axis2.databinding.ADBException: Unexpected subelement OperationRequest):Here&#8217;s my two lines that are throwing this:client = Savon.client(wsdl: &#8216;http:\/\/wsdl_location&#8217;) response = client.call(:operation, message: { id: id })<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d0e95abdd0aed671ebd0920c16d393d4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEnvek<br \/>\nruby web-services soap bing-api savon<br \/>\nI&#8217;m trying to use Bing Translator SOAP API (due to in HTTP API I&#8217;m getting 414 &#8220;Request too long&#8221; for not so big requests due to UTF-8 serialization).So, I&#8217;m playing with bing_translator gem source trying to switch it from HTTP inerface to SOAP one using Savon SOAP toolkit.My workflow as follows (access token getting function not shown):WSDL_URI = &#8216;http:\/\/api.microsofttranslator.com\/V2\/soap.svc?wsdl&#8217;get_access_token client = Savon.client(wsdl: WSDL_URI, headers: {&#8216;Authorization&#8217; =&gt; &#8220;Bearer #{<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2024054e404233ed97b7d9287aff103d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPhrogz<br \/>\nruby block instance-variables savon<br \/>\nForgive me, guys. I am at best a novice when it comes to Ruby. I&#8217;m just curious to know the explanation for what seems like pretty odd behavior to me.I&#8217;m using the Savon library to interact with a SOAP service in my Ruby app. What I noticed is that the following code (in a class I&#8217;ve written to handle this interaction) seems to pass empty values where I expect the values of member fields to go:create_session_response = client.request &#8220;createSession&#8221; dosoap.body = {:user =&gt; @user, # This ends<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a4f066a226a95add85ebe152928b9704?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPravin Mali<br \/>\nruby soap savon<br \/>\nI currently working on new project and I am pretty much new to savon. I am currently using ruby-1.8.7 and savon-1.0.0 and I have below SOAP XML request&lt;soapenv:Envelope xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221; xmlns:xsd=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema&#8221; xmlns:soapenv=&#8221;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&#8221; xmlns:web=&#8221;http:\/\/webservices&#8221;&gt; &lt;soapenv:Header\/&gt; &lt;soapenv:Body&gt; &lt;web:InvokeComponent1 soapenv:encodingStyle=&#8221;http:\/\/schemas.xmlsoap.org\/soap\/encoding\/&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/34d2ae3f7fdcec853ec24cf85715da96?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nrubiii<br \/>\nruby soap savon<br \/>\nI am having trouble parsing a SOAP response.Here is my code:require &#8216;rubygems&#8217; require &#8216;savon&#8217;client = Savon::Client.new &#8220;http:\/\/1.2.3.4\/xyz\/abcd\/fsds.wsdl&#8221;res = client.query_unpaid_assesments do |soap,wsse|soap.namespaces[&#8220;xmlns:SOAP-ENV&#8221;] = &#8220;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&#8221;soap.namespaces[&#8220;xmlns:xsi&#8221;] = &#8220;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221;soap.namespaces[&#8220;xmlns:xsd&#8221;] = &#8220;http:\/\/www.w3.org\/2001\/XMLSchema&#8221;wsse.username=&#8221;xyz&#8221;wsse.password=&#8221;123&#8243;soap.body = {:orderNumber =&gt; 11122<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0f34b873b5e6a72ec73d2e9d776cec71?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nYa.<br \/>\nruby-on-rails soap savon<br \/>\nI&#8217;m using savon 2.2 for making SOAP calls.Initialize:client = Savon.client(wsdl: SOAP_WSDL,endpoint: SOAP_URL)I can make a SOAP call like this and it works fine:resp = client.call(:login, message: { username: SOAP_USER, password: SOAP_PASSWORD })Now I need to make another call which requires setting some parameters in the SOAP header. From the documentation on savorb.com I found I should use the request method:response = client.request :get_user_info dosoap.header = { :session_id =&gt; sid }end<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c84986cba3a65208de336a63354e1f91?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nErik Landerholm<br \/>\nruby soap wsdl savon<br \/>\nI admit I&#8217;m new to both SOAP and Savon, but I got it working with another service, but this one is stumping me.The WSDL is here: http:\/\/stg-wholesale.carsdirect.com\/ws\/services\/Ping?WSDLThe Document when done should look like this:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;soap:Envelope xmlns:xsi=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema-instance&#8221;xmlns:xsd=&#8221;http:\/\/www.w3.org\/2001\/XMLSchema&#8221;xmlns:soap=&#8221;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&#8221;&gt;&lt;soap:Body&gt;&lt;dealerPing xmlns=&#8221;http:\/\/whole<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/51a224bc83750d654f6d102c2055449b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ncoreyward<br \/>\nruby-on-rails ruby-on-rails-3 soap savon<br \/>\nI created a data model, I am using mysql database. I use savon for handling SOAP requests. On the console I can see SOAP controller debug creating data. Most of the part of part of is working, expect saving the created information.How do I bring in the save method? I want to save the successfully received response from a soap request. The actual code is big, so trying skip posting it here. I will post if required. rails g model ticket ticket_num:string t_status:string priority:string solution:s<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/15fcd4523e04bea6b3510bdf5af6549f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDetlef<br \/>\nruby-on-rails rspec savon<br \/>\nFor automated tests I try to mock a savon-created soap request (to JIRA API).@client = Savon::Client.new(JIRA_URL) @client.http.auth.ssl.verify_mode = :nonesavon.expects(:login).with(&#8220;in0&#8243; =&gt; JIRA_USER,&#8221;in1&#8221; =&gt; JIRA_PW)login = @client.request :soap, :login dosoap.body = {&#8220;in0&#8221; =&gt; JIRA_USER, &#8220;in1&#8221; =&gt; JIRA_PW}The Soap request itself works fine, but using savon.expects&#8230; always leads to this not really explaining error message:Failures:1) issues.all should be successful to return a<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/ylFlJ.jpg?s=32&amp;g=1\" \/><br \/>\nrorra<br \/>\nruby savon<br \/>\nI&#8217;m having an exception when trying to build custom headers with Savon 2.1.0 for Authentication, here is the sample code to reproduce the issue, I&#8217;ll appreciate any help on this subject.require &#8216;open-uri&#8217; require &#8216;savon&#8217;headers = {&#8216;IvansWSAuthentication&#8217; =&gt; {&#8216;User&#8217; =&gt; &#8216;my_user&#8217;,&#8217;Password&#8217; =&gt; &#8216;my_pass&#8217;,&#8217;ClientId&#8217; =&gt; &#8216;my_client_id&#8217;} }x12 = &#8216;test&#8217;client = Savon.client(wsdl: &#8216;https:\/\/limeservices.ivans.com\/EligibilityOne.asmx?WSDL&#8217;,headers: headers )request_params = {form270: x12 }respon<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6b9c2a98b118fc2c56c67b4d01c81e0b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEric Hu<br \/>\nruby gem savon<br \/>\nI&#8217;m getting the above error in a gem with this code snippetSavon.configure do |config|config.log = falseconfig.log_level = :errorHTTPI.log = false endThis code used to pass in past runs on Travis, so I&#8217;m not sure why this changed when I altered the Readme.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/24cf35b5a084f9dc5f485d98def1b176?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBobby B<br \/>\nruby web-services soap savon<br \/>\nI&#8217;m attempting to utilize the ruby gem Savon to connect to a web service provided by propertyware (http:\/\/propertyware.com\/apidocs\/Getting-Started). I&#8217;ve successfully connected to the service via SoapUI and executed an echoString request. When I try to do the same via Ruby I get a null user authentication error.Here&#8217;s what I&#8217;ve tried in Ruby&#8230;require &#8216;rubygems&#8217; require &#8216;savon&#8217;client = Savon::Client.new dowsdl.document = &#8216;http:\/\/propertyware.com\/pw\/services\/PWServices?wsdl&#8217;wsse.credentials &#8216;us<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a9c38b2bc0722991f0486e48c00ed37b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nhso<br \/>\nsoap ruby-on-rails-3.1 savon<br \/>\nI am trying to configure my rails app to talk to a soap webservice using this code:client = Savon::Client.new dowsdl.document = &#8220;http:\/\/services.carsolize.com\/BookingServices\/dynamicdataservice.svc?wsdl&#8221; endresponse = client.request &#8220;ServiceRequest&#8221;, &#8220;xmlns&#8221; =&gt; &#8220;http:\/\/tempuri.org\/&#8221; do |soap, wsdl|client.http.headers[&#8220;SOAPAction&#8221;] = &#8216;&#8221;http:\/\/tempuri.org\/IDynamicDataService\/ServiceRequest&#8221;&#8216;soap.body = {&#8220;rqst&#8221; =&gt; {&#8220;Credentials&#8221; =&gt; {&#8220;UserName&#8221; =&gt; &#8216;user&#8217;,&#8221;Password&#8221; =&gt; &#8216;pass&#8217;},&#8221;Reques<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n<p>I discovery a place to host code\u3001demo\u3001 blog and websites.<br \/>\nSite access is fast but not money<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.m5zn.com\/newuploads\/2014\/01\/30\/jpg\/e7da807964b1fff.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Boris ruby web-services savon I am trying to call a web service using Savon. The request I am trying to generate is this (this is a valid request that is working, generated with wizdler):&lt;Envelope xmlns=&#8221;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&#8221;&gt;&lt;Body&gt;&lt;FraudValidationRequest xmlns=&#8221;http:\/\/schemas.gid.gap.com\/fraudvalidation\/v3&#8243;&gt;&lt;OrderHeader xmlns=&#8221;&#8221;&gt;&lt;EntryType&gt;1&lt;\/EntryType&gt; &#8230;. more attributesBut I get something like this:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt; &lt;env:Envelope xmln Alex Peattie ruby soap savon How [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7051","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7051"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7051\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}