确切的目标"实体' nbsp'未定义"错误

时间:2015-09-24 14:30:00

标签: php exacttarget

我正在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,它提供了一个&#34;不正确的端点&#34;错误。所以,我已经使用https://salesforce.stackexchange.com/questions/44614/request-was-made-to-the-incorrect-endpoint中列出的每个端点尝试了它。使用这些端点中的任何一个,我得到实体未定义错误。
  4. 还有其他人遇到过这个问题吗?

1 个答案:

答案 0 :(得分:0)

对于s6实例,我需要将网址更改为https://webservice.s6.exacttarget.com/etframework.wsdl。此外,它看起来像入门套件有一些其他过时的代码。我提到了这个确切的目标,他们取下了php(非燃料)版本。