对于以下内容,我在形成soap文档时遇到了问题。这也是我第一次使用soap。经过一些研究和建议后,savon似乎是一条可行的道路。
require 'savon'
client = Savon::Client.new("https://webservice.exacttarget.com/etframework.wsdl")
client.wsdl_soap_actions
# [:create, :retrieve, :update, :delete, :query, :describe, :execute, :perform, :configure, :schedule, :version_info, :extract, :get_system_status]
response = client.retrieve do |soap|
soap.input = "Retrieve"
soap.action = "Retrieve"
end我在一个丢失的安全头上得到了以下错误。
Savon::SOAPFault: (q0:Security) Security requirements are not satisfied because the security header is not present in the incoming message.
from /home/kj/.rvm/gems/ruby-1.9.2-p0/gems/savon-0.7.9/lib/savon/response.rb:141:in `handle_soap_fault'
from /home/kj/.rvm/gems/ruby-1.9.2-p0/gems/savon-0.7.9/lib/savon/response.rb:81:in `initialize'
from /home/kj/.rvm/gems/ruby-1.9.2-p0/gems/savon-0.7.9/lib/savon/client.rb:95:in `new'
from /home/kj/.rvm/gems/ruby-1.9.2-p0/gems/savon-0.7.9/lib/savon/client.rb:95:in `method_missing'
from (irb):8
from /home/kj/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'我已经在这里粘贴了完整的回复。http://pastie.org/1349438
有没有仁慈的灵魂能帮我解决这个问题?
发布于 2012-01-26 03:02:17
ExactTarget的SOAP实现相当弱。你根本不能使用Savon的soap_actions。您需要将信封的大部分内容手工编码为散列,并在报头中手动设置SOAPAction。不过,Savon确实消除了信封报头中的大部分猜测。下面是一个拉取过滤器订阅者列表的示例:
client = Savon::Client.new do | wsdl, http, wsse |
wsdl.document = 'https://webservice.s4.exacttarget.com/etframework.wsdl'
wsse.credentials "username", "password"
end
res = client.request :ins0, 'RetrieveRequestMsg' do
soap.body = {
'RetrieveRequest' =>
{
'ObjectType' => 'Subscriber',
'Properties' => ['ID', 'SubscriberKey'],
:attributes! =>
{
'ins0:Filter' => {"xsi:type" => "ins0:SimpleFilterPart"}
},
'Filter' =>
{
'Property' => 'SubscriberKey',
'SimpleOperator' => 'like',
'Value' => 'string_to_filter_by'
}
}
}
http.headers['SOAPAction'] = 'Retrieve'
end根据您的帐户类型,您可能还需要从wsdl url中删除"s4“。
发布于 2012-02-14 23:45:23
发布于 2010-12-09 13:02:58
您可能只需要发送您的API凭据:
Savon::WSSE.username = "USERNAME_HERE"
Savon::WSSE.password = "PASSWORD_HERE"在提出请求之前。
https://stackoverflow.com/questions/4359367
复制相似问题