Created
June 3, 2010 15:16
-
-
Save til/423998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'soap/wsdlDriver' | |
host = "developer-api.affili.net" | |
factory = SOAP::WSDLDriverFactory.new("https://#{host}/V2.0/Logon.svc?wsdl") | |
driver = factory.create_rpc_driver | |
driver.generate_explicit_type = true | |
driver.wiredump_dev = STDOUT | |
token = driver.logon({ | |
'Username' => "Users.1.1234", | |
'Password' => "secretpassword", | |
'WebServiceType' => 'Product', | |
'DeveloperSettings' => { 'SandboxPublisherID' => 403233 }, | |
'ApplicationSettings' => { 'ApplicationID' => 0, 'DeveloperID' => "Users.1.1234" } | |
}) | |
factory = SOAP::WSDLDriverFactory.new("https://#{host}/V2.0/ProductServices.svc?wsdl") | |
driver = factory.create_rpc_driver | |
driver.generate_explicit_type = true | |
driver.wiredump_dev = STDOUT | |
driver.SearchProducts({ | |
'CredentialToken' => token, | |
'ShopIds' => [0], | |
'Query' => 'jeans', | |
'WithImageOnly' => false, | |
'Details' => false, | |
'ImageSize' => 'NoImage', | |
'CurrentPage' => 0, | |
'PageSize' => 50, | |
'MinimumPrice' => 0, | |
'MaximumPrice' => 0, | |
'SortOrder' => 'Ascending' | |
}) | |
(username and pwd changed) | |
=========== | |
Output: | |
$ ruby affilinet.rb | |
ignored element: {http://schemas.xmlsoap.org/ws/2004/09/policy}Policy | |
ignored element: {http://www.w3.org/2001/XMLSchema}minInclusive | |
ignored element: {http://www.w3.org/2001/XMLSchema}maxInclusive | |
ignored attr: {http://www.w3.org/2006/05/addressing/wsdl}Action | |
ignored element: {http://schemas.xmlsoap.org/ws/2004/09/policy}PolicyReference | |
Wire dump: | |
= Request | |
! CONNECT TO developer-api.affili.net:443 | |
! CONNECTION ESTABLISHED | |
POST /V2.0/Logon.svc HTTP/1.1 | |
SOAPAction: "http://affilinet.framework.webservices/Svc/ServiceContract1/Logon" | |
Content-Type: text/xml; charset=utf-8 | |
User-Agent: SOAP4R/1.5.5 (httpclient.rb/280, ruby 1.8.7 (2009-06-12) [i686-linux]) | |
Date: Thu, 03 Jun 2010 15:03:44 GMT | |
Content-Length: 853 | |
Host: developer-api.affili.net | |
<?xml version="1.0" encoding="utf-8" ?> | |
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> | |
<env:Body> | |
<n1:LogonRequestMsg xmlns:n1="http://affilinet.framework.webservices/Svc" | |
xmlns:n2="http://affilinet.framework.webservices/types"> | |
<n2:Username>Users.1.1234</n2:Username> | |
<n2:Password>secretpassword</n2:Password> | |
<n2:WebServiceType>Product</n2:WebServiceType> | |
<n2:DeveloperSettings> | |
<n2:SandboxPublisherID>403233</n2:SandboxPublisherID> | |
</n2:DeveloperSettings> | |
<n2:ApplicationSettings> | |
<n2:ApplicationID>0</n2:ApplicationID> | |
<n2:DeveloperID>Users.1.1234</n2:DeveloperID> | |
</n2:ApplicationSettings> | |
</n1:LogonRequestMsg> | |
</env:Body> | |
</env:Envelope> | |
= Response | |
HTTP/1.1 200 OK | |
Date: Thu, 03 Jun 2010 15:03:21 GMT | |
Server: Microsoft-IIS/6.0 | |
X-Powered-By: ASP.NET | |
X-AspNet-Version: 2.0.50727 | |
Cache-Control: private | |
Content-Type: text/xml; charset=utf-8 | |
Content-Length: 216 | |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><CredentialToken xmlns="http://affilinet.framework.webservices/Svc">6e186f3e-66d0-443b-b9dc-ae4a70d06d9e</CredentialToken></s:Body></s:Envelope> | |
ignored element: {http://schemas.xmlsoap.org/ws/2004/09/policy}Policy | |
ignored element: {http://www.w3.org/2001/XMLSchema}minInclusive | |
ignored element: {http://www.w3.org/2001/XMLSchema}maxInclusive | |
ignored attr: {http://www.w3.org/2006/05/addressing/wsdl}Action | |
ignored element: {http://schemas.xmlsoap.org/ws/2004/09/policy}PolicyReference | |
/opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:133:in `complexobj2soap': nil not allowed: WithImageOnly (SOAP::Mapping::MappingError) | |
from /opt/ruby1.8/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:56:in `each_element' | |
from /opt/ruby1.8/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:52:in `each' | |
from /opt/ruby1.8/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:52:in `each_element' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:122:in `complexobj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:108:in `obj2typesoap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:86:in `obj2elesoap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:128:in `complexobj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:56:in `each_element' | |
from /opt/ruby1.8/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:52:in `each' | |
from /opt/ruby1.8/lib/ruby/1.8/wsdl/xmlSchema/complexType.rb:52:in `each_element' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:122:in `complexobj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:108:in `obj2typesoap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:93:in `obj2elesoap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/wsdlliteralregistry.rb:39:in `obj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/mapping.rb:127:in `_obj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/mapping.rb:47:in `obj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/mapping.rb:360:in `protect_threadvars' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/mapping/mapping.rb:43:in `obj2soap' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:422:in `request_doc_lit' | |
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `collect' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:421:in `each' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:421:in `collect' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:421:in `request_doc_lit' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:386:in `request_doc' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:340:in `request_body' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/proxy.rb:123:in `call' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/rpc/driver.rb:232:in `searchProducts' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/wsdlDriver.rb:117:in `__send__' | |
from /opt/ruby1.8/lib/ruby/1.8/soap/wsdlDriver.rb:117:in `SearchProducts' | |
from affilinet.rb:24 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment