savon

How to use objects with xsi:types in Savon

岁酱吖の 提交于 2019-12-19 02:55:50
问题 I'm trying to use Savon to make some SOAP requests, but I'm afraid I need to go beyond the basics somewhat. I need to send something along the lines of: <env:Body> <wsdl:methodName> <parameter xsi:type='ValueClass'>value</parameter> </wsdl:methodName> </env:Body> Now, if I didn't have to specify that xsi:type, it would be a simple matter of: client.method_name { |soap| soap.body = {:parameter => 'value'} } The problem is the xsi:type in the parameter; due to the way the web service I'm using

How do I use savon nested attributes! hash?

只谈情不闲聊 提交于 2019-12-17 20:35:46
问题 I'm looking at using Ruby savon for SOAP. For purely masochistic reasons I have to deal with SOAP elements having attributes. So, no problem, there is an example on the savon docs site which highlights this ability: { :person => "Eve", :attributes! => { :person => { :id => 666 } } }.to_soap_xml "<person id=\"666\">Eve</person>" My problem is how do I set attributes on child elements, for example, say I add an address child element to person: { :person => {:address => ""}, :attributes! => {

Ruby Savon authentication

放肆的年华 提交于 2019-12-13 14:39:36
问题 I'm attempting to connect to a web service using Savon gem. What I know about service: wsdl file url ".../service.svc?wsdl" login "login" password "password" domain "domain" I successfully connected to the service via SoapUI. I entered wsdl url, login, password and domain in the GUI and the document looks like: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:irc="(...url...)"> <soapenv:Header/> <soapenv:Body> <irc:MyService> <irc:request> <irc:Id>1</irc:Id> <

How to generate repeating xml elements in Savon?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 04:30:44
问题 soapUI generates this comment Zero or more repetitions in many places in the request XML that it builds. This is part of the XML request. <v1:Attachments> <!--Zero or more repetitions:--> <v1:Attachment> <v1:FileName>?</v1:FileName> <v1:FileExtension>?</v1:FileExtension> <v1:FileContents>cid:1220950351678</v1:FileContents> </v1:Attachment> </v1:Attachments> I am using Savon 2.2.0 for communicating with the external service. Ruby hashes need unique keys. I tried passing an array of hashes in

Validate XML response against WSDL using Ruby Savon

杀马特。学长 韩版系。学妹 提交于 2019-12-12 14:32:21
问题 I am using Ruby/Cucumber/Savon to automate Soap webservice. I need to validate the response against the wsdl file. Savon docs don't mention validating XML response anywhere. Does anyone know a good solution to doing this? Thanks, Harv Gill 回答1: The excellent Nokogiri library supports XML schema (XSD) validation which is used for SOAP messages (i.e. the "Types" section of the WSDL should contain a reference or inline XSD). xsd = Nokogiri::XML::Schema(File.read(SCHEMA_FILE)) doc = Nokogiri::XML

Savon 2 returns nothing in Rails 4

无人久伴 提交于 2019-12-11 21:09:11
问题 Here is my Savon 2 client = Savon::Client.new(wsdl: "http://www.webservicex.net/uszip.asmx?WSDL") client.operations response = client.call(:get_info_by_zip, :message => { us_zip: "90210" }) response.to_hash And response is: {:get_info_by_zip_response=>{:@xmlns=>"http://www.webserviceX.NET"}} In the SoapUI: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET"> <soapenv:Header/> <soapenv:Body> <web:GetInfoByZIP> <!--Optional:--> <web

Does Heroku change dyno IP during runtime?

坚强是说给别人听的谎言 提交于 2019-12-11 13:56:56
问题 I am currently working on a ruby/heroku app, that needs to query ~40 consecutive SOAP calls from a server, uploads a file to a FTP, then sleeps 15 Minutes and begins anew. Strangely, yesterday everything worked fine (in the evening hours) either locally or via the dyno; now, since morning, I seldomly get through to the 10th query - it always stops on D, [2014-03-20T14:18:49] Debug -- : HTTPI POST request to www.XXXX.de (net_http) with a Connection timed out. Locally, via foreman, everything

How do you specify all the namespaces of a savon client

允我心安 提交于 2019-12-11 11:52:45
问题 I'm trying to setup a Savon's SOAP Envelope and can't figure out how to specify all the namespaces. I know how to add namespaces, but that's not what I'm looking for. I'm using Savon 2. 回答1: In Savon v2 you can add additional namespaces when you create the client. It has to be a Hash. The Documentation is here http://savonrb.com/version2/globals.html. client = Savon.client( :endpoint => 'https://www.example.com', :namespace => 'urn:core.example.com', :namespaces => { "xmlns:v2" => "http://v2

Savon: How can I specify a custom XML in a hash body for a SOAP request?

六眼飞鱼酱① 提交于 2019-12-11 07:17:42
问题 In a SOAP Request, I need to specify repeated keys with different values like this: soap.body = {:query => { :fields => { :string => 'Email', :string => 'FirstName', :string => 'LastName' } } With this hash, the request will be formed with: <query><fields><string>LastName</string></fields></query> The last :string pair. So if I put: soap.body = {:query => { :fields => "<string>Email</string>FirstName<string></string>LastName<string></string>" } This will result in: <fields><string>Email<

Send UTF-16 encoded SOAP request with Ruby and Savon

﹥>﹥吖頭↗ 提交于 2019-12-11 05:01:46
问题 How do I encode the request in UTF-16? Here's what I have: # Create Savon client @client = Savon::Client.new do wsdl.document = File.expand_path("account_list.wsdl", __FILE__) end # Set header encoding @client.http.headers["Content-Type"] = "text/xml;charset=UTF-16" # Setup ssl configuration @client.http.auth.ssl.cert_key_file = "cert_key_file.pem" @client.http.auth.ssl.cert_file = "cert_file.pem" @client.http.auth.ssl.ca_cert_file = "ca_cert_file.pem" @client.http.auth.ssl.verify_mode=:none