我正在嘗試訪問Google Adwords Sandbox API,但對於我的生活,我無法弄清楚發生了什麼。使用SOAP和Javascript發送GET請求(Google Adwords Sandbox API)
這裏是我的代碼:
var wsUrl = "https://adwords-sandbox.google.com/api/adwords/cm/v201008/CampaignService";
var soapRequest =
'<soapenv:Envelope \
xmlns:soapenv="http://schemax.xmlsoap.org/soap/envelope/" \
xmlns="https://adwords.google.com/api/adwords/cm/v200906"> \
<soapenv:Header> \
<service>adwords</service> \
<email>***@gmail.com</email> \
<password>***</password> \
<developerToken>***@gmail.com++USD</developerToken> \
<useragent>MyApplication</useragent> \
</soapenv:Header> \
<soapenv:Body> \
<getClientAccounts/> \
</soapenv:Body> \
</soapenv:Envelope>';
$.ajax({
type: "GET",
url: wsUrl,
contentType: document.body,
crossDomain: true,
dataType: "jsonp",
data: soapRequest,
success: processSuccess,
error: processError
});
});
function processSuccess(data, status, req) {
if (status == "success")
console.log("success");
}
function processError(data, status, req) {
console.log("status = " + status + " data= " + data);
}
我不斷收到500內部服務器錯誤。我究竟做錯了什麼?!在谷歌的Adwords沙盒網站,他們列出簡單的指令:
要創建一個沙盒帳戶,發送GET請求的CampaignService沙箱 版本,使用下面描述的WSDL位置和沙箱標頭, 。對沙箱的初始呼叫會爲您指定的電子郵件地址 地址創建一個MCC 沙盒帳戶以及五個客戶帳戶。您的沙盒帳戶及其客戶帳戶 開始爲空。 http://code.google.com/apis/adwords/docs/sandbox.html
幫助!
報頭的放內容接受爲application /肥皂+ xml的?? – Kris
你的意思是把''加到頭體上嗎?它不幸的是沒有任何區別 – jnfr