1

我正在使用http://help.exacttarget.com/en/technical_library/web_service_guide/api_starter_kits/上的 Exact Target PHP API 入门工具包,并尝试使用示例代码进行连接。作为参考,这里是提供的示例代码:

<?php 
echo '<pre>';
require('../../00 Includes/exacttarget_soap_client.php');

<?php 
echo '<pre>';
require('../../00 Includes/exacttarget_soap_client.php');

$wsdl = 'https://webservice.s6.exacttarget.com/Service.asmx';

try{

         /* Create the Soap Client */
        $client = new ExactTargetSoapClient($wsdl, array('trace'=>1));

        /* Set username and password here */
        $client->username = '<ommitted>';
        $client->password = '<omitted>';

        $request = new ExactTarget_RetrieveRequest();
        $objectType= "Subscriber"; 
        $request->ObjectType= $objectType;

        $request->Properties = array("ID","PartnerKey","CreatedDate","Client.ID","Client.PartnerClientKey","EmailAddress","SubscriberKey","UnsubscribedDate","StatusSubscriberStatus");  

        // Filter retrieve on a particular email address
        $filter1 = new ExactTarget_SimpleFilterPart() ;
        $filter1->Property= "EmailAddress";
        $filter1->SimpleOperator=ExactTarget_SimpleOperators::equals;
        $filter1->Value=array("info@exacttarget.com");   //email address to filter on

        $request->Filter = new SoapVar($filter1, SOAP_ENC_OBJECT, 'SimpleFilterPart', "http://exacttarget.com/wsdl/partnerAPI"); 

        $requestMsg = new ExactTarget_RetrieveRequestMsg();
        $requestMsg->RetrieveRequest=$request;
        $results = $client->Retrieve($requestMsg);          

        /* Output the results */
        echo 'Results:';
        var_dump($results);


  } catch (SoapFault $e) {
    /* output the resulting SoapFault upon an error */
    var_dump($e);
}

/* Output the request and response */
print "Request: \n".   $client->__getLastRequestHeaders() ."\n";
print "Request: \n".
$client->__getLastRequest() ."\n";
print "Response: \n".
$client->__getLastResponseHeaders()."\n";
print "Response: \n".
$client->__getLastResponse()."\n";

echo '</pre>';
?>

当我运行此代码时,我收到一条异常消息:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://webservice.s6.exacttarget.com/Service.asmx' : Entity 'nbsp' not defined

我以前使用过精确目标的 API,但有两个奇怪的地方:

  1. 错误发生在第 10 行,它在 SoapClient 构造函数中触发,该构造函数由 exacttarget_soap_client 类继承。
  2. 我被分配了一个用户名,其中有一个空格。
  3. 原始 API 工具包使用 wsdl url https://webservice.exacttarget.com/etframework.wsdl,它提供了“不正确的端点”错误。因此,我已经使用https://salesforce.stackexchange.com/questions/44614/request-was-made-to-the-incorrect-endpoint中列出的每个端点进行了尝试。使用这些端点中的任何一个,我都会收到实体未定义错误。

有没有其他人遇到过这个问题?

4

1 回答 1

0

对于 s6 实例,我需要将 url 更改为https://webservice.s6.exacttarget.com/etframework.wsdl。此外,入门工具包似乎还有一些其他过时的代码。我提到了这个精确的目标,他们取消了 php(非燃料)版本。

于 2015-09-24T15:44:45.617 回答