我正在使用BlueHornet API发送电子邮件,具体为legacy.send_campaign方法。我更新客户现有的API调用,并已指示通过POST发送的PHP未通过PHP发送
"POST the XML message using the arguments specified below. Be sure to include the <send> element and set its value to 'Y'. The POST response message will include a <message_id> element and a <message_key> element.
这是所提供的格式:
<api>
<authentication>
<api_key>ClientAPIKey</api_key>
<shared_secret>ClientSharedSecret</shared_secret>
<response_type>xml</response_type>
</authentication>
<data>
<methodCall>
<methodName>legacy.send_campaign</methodName>
<grp>ClientEmailGroupCode</grp>
<rich_mbody><![CDATA[<html...LONG HTML BLOCK...</html>]]></rich_mbody>
<text_mbody><![CDATA[...LONG TEXT BODY...]]></text_mbody>
<reply_email>ClientReplyEmail</reply_email>
<from_email>ClientFromEmail</from_email>
<fromdesc>ClientFromName</fromdesc>
<msubject>ClientEmailSubject</msubject>
<send>Y</send>
<track_links>1</track_links>
</methodCall>
</data>
</api>
的API是密码保护的,但我可以根据要求博士后的。
我已经证实了ClientAPIKey,ClientSharedSecret,并ClientEmailGroupCode是有效的,但我的测试一直未果。发送以下内容(使用的fsockopen() FWIW):
POST /api/xmlrpc/index.php HTTP/1.0
Host: echoN.bluehornet.com
Content-Type: text/xml;charset=utf-8
Content-Length: 21551
<?xml version="1.0"?>
<api>
<authentication>...as above...</authentication>
<data>...as above...</data>
</api>
导致第三方服务器发送回这个XML响应指示错误:增加了可读性
HTTP/1.1 200 OK
Date: Thu, 13 Oct 2011 13:18:50 GMT
Server: Apache/1.3.41 (Unix)
Cache-Control: max-age=18000
Expires: Thu, 13 Oct 2011 18:18:50 GMT
Connection: close
Content-Type: text/xml;charset=utf-8
Set-Cookie: BIGipServerBH-gen-80=387268618.20480.0000; path=/
<!--?xml version="1.0" encoding="utf-8"?-->
<methodresponse><item><error><!--[CDATA[1]]--></error>
<responsetext><!--[CDATA[No XML Data Passed.]]--></responsetext>
<responsedata><responsenum><!--[CDATA[1]]--></responsenum>
<totalrequests><!--[CDATA[0]]--></totalrequests>
<totalcompleted><!--[CDATA[0]]--></totalcompleted>
</responsedata></item></methodresponse>
换行符。
“没有XML数据通过”的responseText。关注我,所以我联系了供应商,并被告知要仔细检查我的URL(http与https,正确的N在echo * N * .bluehornet ...等),并确保我发布了“数据“参数。建议是放置“数据=?”在查询URL的HTTP报头的末尾:
POST /api/xmlrpc/index.php?data= HTTP/1.0
或前面加上“数据=”到XML块在请求体:
data=<?xml version="1.0"?>
这似乎是由一个.NET姊妹项目编写的代码暗示:
private void ConstructData()
{
data.Append("data=");
data.Append("<api>");
data.Append("<authentication>");
data.Append(authenticationData.ToString());
data.Append("</authentication>");
data.Append("<data><methodCall>");
data.Append(methodCallData.ToString());
data.Append("</methodCall></data>");
data.Append("</api>");
}
修改查询网址没有效果,而XML块前面放置“数据=”引起了长时间的加载时间之后没有服务器respo NSE。
此时,供应商正试图挖掘一位开发人员,他之前曾使用API来权衡这个问题。与此同时,我想我会分享上述内容,看看是否有人可以指出任何问题–细微的疏忽或明显遗漏,因为他们可能是–这可能会导致我的XML数据不能发送。
第三方供应商终于找回了他们现有代码的修订版本,它使用一个完全不同的方法(基于cURL)。看起来,即使供应商在上述技术方面也存在问题。 –