(in http://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl )
<xs:element name="TransactionID" type="ebl:TransactionId" />
were ebl types are defined at:
http://www.sandbox.paypal.com/wsdl/eBLBaseComponents.xsd
How do I include the xsd file so that SOAP::WDSLDriverFactory will
understand these types?
-James Connell
================================
irb(main):117:0> soap.getTransactionDetails(req)
Wire dump:
opening connection to api.sandbox.paypal.com...
opened
warning: peer certificate won't be verified in this SSL session.
closed
OpenSSL::SSL::SSLError: sslv3 alert handshake failure
from c:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:48:in
`connect'
from c:/ruby/lib/ruby/site_ruby/1.8/net/protocols.rb:48:in
`ssl_connect'
from c:/ruby/lib/ruby/site_ruby/1.8/net/https.rb:175:in
`on_connect'
from c:/ruby/lib/ruby/1.8/net/http.rb:433:in `do_start'
from c:/ruby/lib/ruby/1.8/net/http.rb:419:in `start'
from c:/ruby/lib/ruby/1.8/soap/netHttpClient.rb:115:in `start'
from c:/ruby/lib/ruby/1.8/soap/netHttpClient.rb:92:in `post'
from c:/ruby/lib/ruby/1.8/soap/streamHandler.rb:164:in
`send_post'
from c:/ruby/lib/ruby/1.8/soap/streamHandler.rb:106:in `send'
from c:/ruby/lib/ruby/1.8/soap/rpc/proxy.rb:146:in `route'
from c:/ruby/lib/ruby/1.8/soap/rpc/proxy.rb:121:in `call'
from c:/ruby/lib/ruby/1.8/soap/rpc/driver.rb:159:in `call'
from c:/ruby/lib/ruby/1.8/soap/rpc/driver.rb:212:in
`getTransactionDetai
ls'
from c:/ruby/lib/ruby/1.8/soap/rpc/driver.rb:207:in
`getTransactionDetai
ls'
from (irb):117
irb(main):118:0>
===============================
Also, how do I go about generating the header, which looks like this:
<SOAP-ENV:Header>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI"
xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents"
xsi:type="ebl:UserIdPasswordType">
<Username xsi:type="xs:string">api_username</Username>
<Password xsi:type="xs:string">api_password</Password>
<Subject
xsi:type="xs:string">authorizing_account_emailaddress</Subject>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
I assume I have to override SOAP::Header::Simplehander, but i have no
idea how do use this in a more complex case (i have seen the example
for Google adwords)... any ideas?
code:
WSDL_URL = "http://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl"
@soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
@soap.options["protocol.http.ssl_config.verify_mode"] =
OpenSSL::SSL::VERIFY_NONE
@soap.options["protocol.http.ssl_config.client_cert"] = "keys/crt.txt"
@soap.options["protocol.http.ssl_config.client_key"] = "keys/key.txt"
gives the error:
NoMethodError: undefined method `empty?' for 0:Fixnum
from
c:/ruby/lib/ruby/site_ruby/1.8/soap/httpconfigloader.rb:95:in `ssl_
config_int'
from
c:/ruby/lib/ruby/site_ruby/1.8/soap/httpconfigloader.rb:77:in `set_
ssl_config'
from
c:/ruby/lib/ruby/site_ruby/1.8/soap/httpconfigloader.rb:61:in `each
'
from c:/ruby/lib/ruby/1.8/soap/property.rb:139:in `each'
from c:/ruby/lib/ruby/1.8/soap/property.rb:139:in `each'
from
c:/ruby/lib/ruby/site_ruby/1.8/soap/httpconfigloader.rb:61:in `set_
ssl_config'
from
c:/ruby/lib/ruby/site_ruby/1.8/soap/httpconfigloader.rb:36:in `set_
options'
from
c:/ruby/lib/ruby/site_ruby/1.8/soap/httpconfigloader.rb:35:in `call
'
from c:/ruby/lib/ruby/1.8/soap/property.rb:115:in `[]='
from c:/ruby/lib/ruby/1.8/soap/property.rb:114:in `each'
from c:/ruby/lib/ruby/1.8/soap/property.rb:114:in `[]='
from ./paypal.rb:28
from (irb):2:in `load'
from (irb):2
irb(main):003:0>
the offending code calls empty? on a Fixnum, which i dont think its
supposed to do:
def ssl_config_int(value)
if value.nil? or value.empty?
nil
else
begin
Integer(value)
rescue ArgumentError
::SOAP::Property::Util.const_from_name(value)
end
end
end
class PaypalAPI
WSDL_URL = "http://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl"
def initialize
@soap = SOAP::WSDLDriverFactory.new(WSDL_URL).create_rpc_driver
@soap.options["protocol.http.ssl_config.verify_mode"] =
OpenSSL::SSL::VERIFY_NONE
@soap.options["protocol.http.ssl_config.client_cert"] =
"keys/crt.txt"
@soap.options["protocol.http.ssl_config.client_key"] =
"keys/key.txt"
@soap.headerhandler << RequesterCredentialsHandler.new("username",
"pass", "")
@soap.wiredump_dev = STDOUT
end
def GetTransaction
req = GetTransactionDetailsReq.new("5F744114GD361381K")
result = @soap.getTransactionDetails(req)
end
end
and the result:
irb(main):009:0> result = paypal.GetTransaction
Wire dump:
= Request
! CONNECTION ESTABLISHED
at depth 2 - 19: self signed certificate in certificate chain
= Response
! CONNECTION CLOSED
what paypal gives me is a username/password along with and x509 cert
and RSA key in pem format that they create.