savon

How to pass Array as parameter to SOAP in Ruby

笑着哭i 提交于 2019-12-03 08:58:18
Currently I'm using Savon to work with WebService in ruby. It works pretty well but I have difficulty to pass parameter for argument of SOAP array type. Following code doesn't work properly: ids = [0,1,2] client.do_get_items { |soap| soap.body = { 'item-list' => ids } I would appreciate if you can solve my problem or propose an alternative library for ruby&soap I just stumbled on the same problem and the temporary workaround that worked for me is as follows: ids = [0,1,2] client.do_get_items { |soap| soap.body = { 'item-list' => { 'item1' => 0, 'item2' => 1, 'item3' => 2 } } The names "item1",

Adding a product using Savon to connect to Magento API

空扰寡人 提交于 2019-12-03 00:10:59
问题 I have got the code working for listing products in Ruby but am struggling to add a product, here is my code, I’m using the savon gem for HTTP/SOAP requests, based on the code here http://www.polyvision.org/2011/10/02/using-magento-soap-api-with-ruby-and-savon/ # Insert some products ... newproductdata = [ ["name" , “test product"], ["websites" , [1]], ["short_description" , ‘short description’], ["description" , ‘description’], ["status" , 1], ["weight" , 0], ["tax_class_id" , 1], [

Convert this XML request to a proper Savon request

狂风中的少年 提交于 2019-12-02 17:36:53
问题 Can somebody convert this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://test.org/" xmlns:hon="http://schemas.datacontract.org/2004/07/TEST.RVU.Entity"> <soapenv:Header/> <soapenv:Body> <tem:Authenticate> <!--Optional:--> <tem:authenticationDet> <!--Optional:--> <hon:AccountType>0</hon:AccountType> <!--Optional:--> <hon:Password>bacon</hon:Password> <!--Optional:--> <hon:UserName>smith</hon:UserName> </tem:authenticationDet> </tem:Authenticate>

Adding a product using Savon to connect to Magento API

我的梦境 提交于 2019-12-02 13:21:14
I have got the code working for listing products in Ruby but am struggling to add a product, here is my code, I’m using the savon gem for HTTP/SOAP requests, based on the code here http://www.polyvision.org/2011/10/02/using-magento-soap-api-with-ruby-and-savon/ # Insert some products ... newproductdata = [ ["name" , “test product"], ["websites" , [1]], ["short_description" , ‘short description’], ["description" , ‘description’], ["status" , 1], ["weight" , 0], ["tax_class_id" , 1], ["categories" , [3]], ["price" , 12.05] ] begin response = client.request :call do soap.body = {:session =>

Convert this XML request to a proper Savon request

纵饮孤独 提交于 2019-12-02 09:41:34
Can somebody convert this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://test.org/" xmlns:hon="http://schemas.datacontract.org/2004/07/TEST.RVU.Entity"> <soapenv:Header/> <soapenv:Body> <tem:Authenticate> <!--Optional:--> <tem:authenticationDet> <!--Optional:--> <hon:AccountType>0</hon:AccountType> <!--Optional:--> <hon:Password>bacon</hon:Password> <!--Optional:--> <hon:UserName>smith</hon:UserName> </tem:authenticationDet> </tem:Authenticate> </soapenv:Body> </soapenv:Envelope> now using Soap gem SAVON, how can I write this in a correct syntax

Replicating XML Request with Savon/Ruby

拟墨画扇 提交于 2019-12-02 06:09:05
I am trying to avoid using Nokogiri/Builder to build my XML and would like to instead use the Savon gem with Ruby 2.0.0. I have the following request I need to replicate: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetList xmlns="http://tempuri.org/"> <listRequest xmlns:a="http://schemas.datacontract.org/2004/07/Services.List" i:type="b:NpsListRequest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.datacontract.org/2004/07/Services.List.Strategies"> <a:id>1</a:id> </listRequest> </GetList> </s:Body> </s:Envelope> So far I have this:

Sending raw XML using Savon 2

南楼画角 提交于 2019-11-29 10:51:24
I'm trying to use Savon to send requests to a webservice. The service I'm consuming requires nested namespaces, and I haven't figured out yet how to provide them on a request. I've tried to craft the request by hand (with nokogiri, actually) and send the resulting xml: client.call(:some_op, :message=>{:"op"=>"<elem/>"}) But savon escapes the string and sends <elem/> How can I send raw xml without escaping? The call should look like this: client.call(:some_op, xml: "<elem />") Or if you just want to set one or multiple namespaces then create a client as follows (without WSDL): client = Savon

Why is “wsdl” namespace interjected into action name when using savon for ruby soap communication?

江枫思渺然 提交于 2019-11-29 02:11:18
I'm trying to access a SOAP service I don't control. One of the actions is called ProcessMessage . I followed the example and generated a SOAP request, but I got an error back saying that the action doesn't exist. I traced the problem to the way the body of the envelope is generated. <env:Envelope ... "> <env:Header> <wsse:Security ... "> <wsse:UsernameToken ..."> <wsse:Username>USER</wsse:Username> <wsse:Nonce>658e702d5feff1777a6c741847239eb5d6d86e48</wsse:Nonce> <wsu:Created>2010-02-18T02:05:25Z</wsu:Created> <wsse:Password ... >password</wsse:Password> </wsse:UsernameToken> </wsse:Security>

Read response with Nokogiri from a SOAP call with Savon

耗尽温柔 提交于 2019-11-28 04:18:41
问题 I have make a soap-call with Savon. This works fine and give the following response: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http:// schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetTop10Response xmlns="http://www.kirupafx.com"> <GetTop10Result> <string>string</string> <string>string</string> </GetTop10Result> </GetTop10Response> </soap:Body> </soap:Envelope> Now I

Sending raw XML using Savon 2

爷,独闯天下 提交于 2019-11-28 04:04:39
问题 I'm trying to use Savon to send requests to a webservice. The service I'm consuming requires nested namespaces, and I haven't figured out yet how to provide them on a request. I've tried to craft the request by hand (with nokogiri, actually) and send the resulting xml: client.call(:some_op, :message=>{:"op"=>"<elem/>"}) But savon escapes the string and sends <elem/> How can I send raw xml without escaping? 回答1: The call should look like this: client.call(:some_op, xml: "<elem />") Or if you