2008-09-28 36 views
3

是否有人成功使用CJ Web服務?即使我的應用程序是.net(顯然是他們的錯誤),我仍然得到java.lang.NullPointerException。 CJ的支持甚至不知道Web服務是什麼。我搜索了一下,發現很多人得到這個或其他錯誤。問題是:這是一個暫時的問題還是我註定要解析手動下載的永久報告?任何成功使用Commission Junction API的人?

我試圖使用的具體API是daily publisher commission serviceHere是WSDL。

鏈接:

+0

您可以鏈接到該API(文檔等)? – Till 2008-09-29 13:23:40

+0

我添加了API參考和WSDL的鏈接 – 2008-09-29 13:59:12

回答

0

我可以爲您解除您的詛咒的用戶界面!

要使用每日出版商委員會報告服務!

如果您仍然需要幫助,請告訴我。

+0

謝謝,但我需要編程訪問他們的API,而不是用戶界面......無論如何,我目前正在通過手動導出他們的報告爲xml來解決此問題,然後將其導入我的應用程序。這不是一個重要的功能,所以我只需要每月一次或兩次這樣做。 – 2009-04-08 01:57:40

2

我已經成功地使用CJ的API與PHP,但不是這個特定的WSDL。我很擔心缺乏文檔,甚至找不到任何使用它的嚴肅程序員(所有業餘愛好者基本上都試圖複製粘貼)。如果你有更多的經驗,我們可以互相幫助。

0

編輯:首先,如果沒有任何佣金報告,您將不會得到任何結果。

我正在使用這些API,我對任何REST API都沒有問題,但每日發佈商佣金服務的SOAP API似乎沒有工作。結果來自:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="https://pubcommission.api.cj.com"> 
     <soapenv:Header/> 
     <soapenv:Body> 
      <api:findPublisherCommissions> 
      <api:developerKey>*DEVKEY*</api:developerKey> 
      <api:date>01/19/2007</api:date> 
      <api:dateType>event</api:dateType> 
      <api:advertiserIds></api:advertiserIds> 
      <api:websiteIds>123456</api:websiteIds> 
      <api:actionStatus>all</api:actionStatus> 
      <api:actionTypes></api:actionTypes> 
      <api:adIds></api:adIds> 
      <api:countries></api:countries> 
      <api:correctionStatus></api:correctionStatus> 
      <api:sortBy>commissionAmount</api:sortBy> 
      <api:sortOrder>desc</api:sortOrder> 
      </api:findPublisherCommissions> 
     </soapenv:Body> 
    </soapenv:Envelope> 

這是完全有效和正確的,給我一個HTML頁面。您的錯誤可能與將頁面解析爲XML有關。

的結果是:

<html> 
<head> 
<title>Web Services</title> 
</head> 

<body vlink="#333333" alink="#FFCC33" bgcolor="#FFFFFF" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0"> 
    <table cellpadding="0" cellspacing="0" border="0" width="100%"> 
     <tr> 
      <td background="images/header_bg.gif"> 
       <a href="http://webservices.cj.com"><img src="images/header.gif" width="600" height="63" border="0" alt="webservices.cj.com" /></a> 
      </td> 
     </tr> 
    </table> 



<h3>Latest WSDLs</h3> 
<table width=70%><tr><td> 
<ul> 
    <li>ProductSearchServiceV2.0<a href="wsdl/version2/productSearchServiceV2.wsdl">[wsdl]</a><img src="images/new11.gif" width="40" height="15"/></li> 
    <li>LinkSearchServiceV2.0<a href="wsdl/version2/linkSearchServiceV2.wsdl">[wsdl]</a><img src="images/new11.gif" width="40" height="15"/></</li> 
    <li>PublisherCommissionService and ItemDetails V2.0<a href="wsdl/version2/publisherCommissionServiceV2.wsdl">[wsdl]</a><img src="images/new11.gif" width="40" height="15"/></</li> 
    <li>RealTimeCommissionServiceV2.0<a href="wsdl/version2/realtimeCommissionServiceV2.wsdl">[wsdl]</a><img src="images/new11.gif" width="40" height="15"/></</li> 
    <li>AdvertiserSearchService<a href="wsdl/version2/advertiserSearchServiceV2.wsdl">[wsdl]</a></li> 
    <li>FieldTypesSupportService<a href="wsdl/version2/supportServiceV2.wsdl">[wsdl]</a></li> 
</ul> 
</td></tr></table> 

<h3>Previously Released WSDLs</h3> 
For previous versions of the wsdls <a href="old_versions.jsp">click here.</a><p> 

<h3>Sign Up</h3> 
<ul> 
    <li><a href="sign_up.cj">Sign Up</a></li> 
</ul> 

</body> 
</html> 

我發出一封電子郵件,並期望今天的迴應。我會向你確認這個API仍然可用,它可能已被完全取代實時發佈者佣金API。

3

花了很多天之後,這段代碼正在爲我工​​作。

$client = new SoapClient($cjCommissionUrl, 

    array('trace' => 1, 
    'soap_version' => SOAP_1_1, 
    'style' => SOAP_DOCUMENT, 
    'encoding' => SOAP_LITERAL 
    )); 


$date = '06/23/2010'; 
    $results = $client->findPublisherCommissions(array(
    "developerKey" => $cjDeveloperKey, 
    "date" => $date, 
    "dateType" => 'posting', 
    "countries" => 'all', 
)); 
1

創建一個頁面cjcall.php forexample

粘貼此代碼,做根據您的要求,即關鍵字,機號,每頁

include('../../../../wp-load.php'); 

$stringkeyw=urlencode(get_option('cj_keyword')); 
if(get_option('rm_num_products')==''){ 
$pperkeyword=50; 
}else{ 
$pperkeyword= get_option('rm_num_products'); 
}//number of products against keyword 

$ch = curl_init(); 

curl_setopt($ch, CURLOPT_URL, "https://product-search.api.cj.com/v2/product-search?website-id=".get_option('cj_siteid')."&keywords=".$stringkeyw."&records-per-page=".$pperkeyword."&serviceable-area=US"); 

curl_setopt($ch, CURLOPT_HEADER,false); 

curl_setopt($ch, CURLOPT_HTTPGET, true); 

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 

curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/xml", "Authorization:".get_option('cj_devid')."")); 

$result = curl_exec($ch); 

記錄創建另一個頁面,下面的代碼粘貼在此頁面帶來的xml:

$hurl= home_url(); 
$homepage = file_get_contents(''.$hurl.'/wp-content/plugins/rapid_monetizer/cronjob/cjcall.php'); 
$object = simplexml_load_string($homepage); 

    foreach($object->products->product as $cjres) 
    { 
     //do your code with products coming in $cjres 
     } 
相關問題