我尽可能深入地挖掘,但找不到解决问题的方法:
我想向 ExactTarget API 发送 SOAP 请求。我正在尝试使用 Savon,但它创建的请求与使用 ExactTarget 的 API 的请求不同(我以前使用过 Java),最后在运行 Ruby 脚本时出现错误。
下面是我要在 Ruby 中创建的工作请求的正文:
<S:Body>
<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RetrieveRequest>
<ObjectType>BounceEvent</ObjectType>
<Properties>SendID</Properties>
<Properties>SubscriberKey</Properties>
<Properties>EventDate</Properties>
<Properties>SMTPCode</Properties>
<Properties>BounceCategory</Properties>
<Properties>SMTPReason</Properties>
<Properties>BounceType</Properties>
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="SimpleFilterPart">
<Property>SendID</Property>
<SimpleOperator>equals</SimpleOperator>
<Value>421939</Value>
</Filter>
</RetrieveRequest>
</RetrieveRequestMsg>
</S:Body>
现在这是我在 Ruby 中创建的代码:
client = Savon.client do
wsdl 'https://webservice.s4.exacttarget.com/etframework.wsdl'
wsse_auth("user", "pass")
end
builder = Builder::XmlMarkup.new
builder.instruct!(:xml, encoding: "UTF-8")
#builder.RetrieveRequestMsg('xmlns'=>'http://exacttarget.com/wsdl/partnerAPI') do
builder.RetrieveRequest do
builder.ObjectType "BounceEvent"
builder.Properties "SendID"
builder.Properties "SubscriberKey"
end
#end
theBody = builder.target!
theBody.slice! '<?xml version="1.0" encoding="UTF-8"?>'
client.call(:retrieve, message: theBody)
..这是生成的请求正文:
<env:Body>
<tns:RetrieveRequestMsg>
<RetrieveRequest>
<ObjectType>BounceEvent</ObjectType>
<Properties>SendID</Properties>
<Properties>SubscriberKey</Properties>
</RetrieveRequest></tns:RetrieveRequestMsg>
</env:Body>
...这是我得到的结果错误:
<soap:Body>
<RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<OverallStatus>Error</OverallStatus>
<RequestID>5ce5cfae-85b4-4e76-b9dd-299e9a9ca871</RequestID>
</RetrieveResponseMsg>
</soap:Body>
任何帮助是极大的赞赏!