当使用savon 2.3.3调用https SOAP服务时,我收到'无法获取本地颁发者证书'错误消息。
网址:https://igeneration.irishvoip.com/a2billing/webservice/SOAP/soap-a2billing-server.php?wsdl
我使用openssl生成了本地证书,步骤如下: 1.openssl genrsa -out privkey.pem 1024 2.openssl req -new -key privkey.pem -out certreq.csr 3.openssl x509 -req -days 3650 -in certreq.csr -signkey privkey.pem -out newcert.pem 4.password:'test' 5.将两个证书本地复制到/ Users / will / code / igen-service / lib /文件夹(项目在/ Users / will / code / igen-service /下)。
module IGenSoapService
API_KEY = '2345sef9034WE51mFGzc42354'
def self.md5
Digest::MD5.hexdigest(API_KEY)
end
def self.service
# create a client for the service
client = Savon.client(wsdl: 'https://igeneration.irishvoip.com/a2billing/webservice/SOAP/soap-a2billing-server.php?wsdl',
ssl_cert_file: "/Users/will/code/igen-service/lib/newcert.pem",
ssl_cert_key_file: "/Users/will/code/igen-service/lib/privkey.pem",
ssl_cert_key_password: "test",
log_level: :debug,
log: true,
)
#ap -> awesome_print gem
ap client.operations
md5_api = md5()
response = client.call(:get_calls_history_igen) do
message security_key: md5_api, did:6796008000, secret:598859, starttime_begin:'2014/03/01', starttime_end:'2014/09/01', offset:0 ,items_number:100
end
ap response
end
端
Rake spec results
'awesome_print' /Users/will/.rbenv/versions/1.9.3-p448/bin/ruby -S rspec ./spec/example_spec.rb --color --format progress
D, [2014-09-22T00:39:03.986248 #74682] DEBUG -- : HTTPI GET request to igeneration.irishvoip.com (httpclient)
at depth 0 - 20: unable to get local issuer certificate
[
[ 0] :update_currencies_list,
[ 1] :reload_asterisk_sip_iax,
[ 2] :authenticate_admin,
[ 3] :set_admin_pwd,
[ 4] :write_notification,
[ 5] :create_instance,
[ 6] :set_instance_description,
[ 7] :set_instance_provisioning,
[ 8] :get_customer_groups,
[ 9] :get_currencies,
[10] :get_currencies_value,
[11] :get_countries,
[12] :get_setting,
[13] :set_setting,
[14] :get_account_attribute,
[15] :set_account_attribute,
[16] :get_languages,
[17] :create_did_group,
[18] :create_provider,
[19] :create_ratecard,
[20] :create_callplan,
[21] :create_voucher,
[22] :create_customer,
[23] :validate_did_prefix,
[24] :create_did,
[25] :get_provisioning_list,
[26] :create_trunk_config,
[27] :get_rates,
[28] :create_rates,
[29] :update_rates,
[30] :get_subscription_signup,
[31] :add_caller_id,
[32] :get_calls_history,
[33] :get_log_refill,
[34] :add_credit,
[35] :get_calls_history_igen,
[36] :check_did_igen,
[37] :check_mailbox_igen,
[38] :get_country_code_igen,
[39] :get_country_codes_all_igen,
[40] :get_account_attribute_igen,
[41] :get_balance_igen,
[42] :add_credit_igen,
[43] :get_rate_igen,
[44] :create_did_igen_single,
[45] :create_customer_igen_single,
[46] :update_customer_igen_single,
[47] :delete_customer_igen_single,
[48] :change_customer_did_igen,
[49] :get_voicemail_pin_igen,
[50] :set_voicemail_pin_igen,
[51] :get_sip_secret_igen,
[52] :set_sip_secret_igen
]
I, [2014-09-22T00:39:06.939992 #74682] INFO -- : SOAP request: https://igeneration.irishvoip.com/a2billing/webservice/SOAP/soap-a2billing-server.php
I, [2014-09-22T00:39:06.940070 #74682] INFO -- : SOAPAction: "http://schemas.xmlsoap.org/soap/envelope/#IGEN_SOAP_A2Billing#Get_Calls_History_IGEN", Content-Type: text/xml;charset=UTF-8, Content-Length: 555
D, [2014-09-22T00:39:06.940113 #74682] DEBUG -- : <?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:tns="urn:Billing" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:Get_Calls_History_IGEN><securityKey>c86c39b9b5ca5bce7441f7a7e8d864a7</securityKey><did>6796008000</did><secret>598859</secret><starttimeBegin>2014/03/01</starttimeBegin><starttimeEnd>2014/09/01</starttimeEnd><offset>0</offset><itemsNumber>100</itemsNumber></tns:Get_Calls_History_IGEN></env:Body></env:Envelope>
D, [2014-09-22T00:39:06.940669 #74682] DEBUG -- : HTTPI POST request to igeneration.irishvoip.com (httpclient)
at depth 0 - 20: unable to get local issuer certificate
I, [2014-09-22T00:39:08.567002 #74682] INFO -- : SOAP response (status 500)
D, [2014-09-22T00:39:08.567111 #74682] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:QName">SOAP-ENV:Server</faultcode>
<faultstring xsi:type="xsd:string">method "urn:BillingGet_Calls_History_IGEN" not defined in service</faultstring>
<faultactor xsi:type="xsd:anyURI"></faultactor>
<detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
F
Failures:
1) IGenApiService IGenSOAPService#call API
Failure/Error: response = Service::IGenSoapService.service()
Savon::SOAPFault:
(SOAP-ENV:Server) method "urn:BillingGet_Calls_History_IGEN" not defined in service
# ./lib/igen_service.rb:86:in `service'
# ./spec/example_spec.rb:24:in `block (2 levels) in <top (required)>'
有人可以帮忙吗?