Campaigner(電子メールマーケティングツール)に接続して連絡先をアップロードするためにPHPでSOAPリクエストを作成する際に問題が発生しましたが、私はいくつかの助けをすることができます。私が使用しているAPIは、Nullオブジェクトで応答し続けます。ここでは(私はSOAPUIを使用する場合の動作)私はのオフに働いているXMLれる:PHP SOAPリクエストの問題
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="https://ws.campaigner.com/2013/01">
<soapenv:Header/>
<soapenv:Body>
<ns:ImmediateUpload>
<!--Optional:-->
<ns:authentication>
<!--Optional:-->
<ns:Username>username</ns:Username>
<!--Optional:-->
<ns:Password>password</ns:Password>
</ns:authentication>
<ns:UpdateExistingContacts>true</ns:UpdateExistingContacts>
<ns:TriggerWorkflow>false</ns:TriggerWorkflow>
<!--Optional:-->
<ns:contacts>
<ns:ContactData>
<ns:ContactKey>
<ns:ContactId>0</ns:ContactId>
<ns:ContactUniqueIdentifier>[email protected]</ns:ContactUniqueIdentifier>
</ns:ContactKey>
<ns:EmailAddress>[email protected]</ns:EmailAddress>
<ns:FirstName>Steve</ns:FirstName>
<ns:LastName>Rogers</ns:LastName>
<ns:Status>Subscribed</ns:Status>
<ns:MailFormat>Both</ns:MailFormat>
<ns:IsTestContact>0</ns:IsTestContact>
</ns:ContactData>
</ns:contacts>
</ns:ImmediateUpload>
ここでは私のPHPコードは次のとおりです。ここで
<?php
$wsdl = "https://ws.campaigner.com/2013/01/contactmanagement.asmx?wsdl";
$trace = true;
$exceptions = true;
$Username = "username";
$Password = "password";
$UpdateExistingContacts = true;
$TriggerWorkflow = false;
$ContactId = 0;
$ContactUniqueIdentifier= "[email protected]";
$EmailAddress = "[email protected]";
$FirstName = "Steve";
$LastName = "Rogers";
$Status = "Subscribed";
$MailFormat = "Both";
$IsTestContact = 0;
$params = array (
"Username" => $Username,
"Password" => $Password,
"UpdateExistingContacts" => $UpdateExistingContacts,
"TriggerWorkflow" => $TriggerWorkflow,
"ContactId" => $ContactId,
"ContactUniqueIdentifier" => $ContactUniqueIdentifier,
"EmailAddress" => $EmailAddress,
"FirstName" => $FirstName,
"LastName" => $LastName,
"Status" => $Status,
"MailFormat" => $MailFormat,
"IsTestContact" => $IsTestContact
);
try{
$client = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
$response = $client->__call("ImmediateUpload", array($params));
} catch (Exception $e){
echo "error";
echo $e ->getMessage();
echo 'Last Response: '.$client->__getLastResponse();
}
var_dump($response);
?>
は、私は戻って取得応答であります:
object(stdClass)#2 (0) {}
私は成功した応答を得るため、間違いなく書式設定の問題ですCampaignerに書き込むSoapUIを使用すると、PHPで処理しようとするときにのみこのエラーが発生します。私はあなたが提供できる任意のヘルプに感謝!
、 ローガン
更新ありがとう:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header><ResponseHeader xmlns="https://ws.campaigner.com/2013/01">
<ErrorFlag>true</ErrorFlag>
<ReturnCode>U_4.5.1.3_USERNAME-AND-PASSWORD-REQUIRED</ReturnCode>
<ReturnMessage>Username and Password is required.</ReturnMessage>
</ResponseHeader>
</soap:Header><soap:Body><ImmediateUploadResponse xmlns="https://ws.campaigner.com/2013/01" />
</soap:Body>
</soap:Envelope>