Adobe Campaign应用服务器设计为开放性,与日益多样化和复杂的公司信息系统轻松集成。
Adobe CampaignAPI在应用程序内的JavaScript中以及应用程序外的SOAP中使用。 它们构成一个通用函数库,可以丰富这些函数。 有关详细信息,请参阅实现SOAP方法。
在使用Adobe CampaignAPI之前,您需要熟悉以下主题:
Adobe Campaign使用两种类型的API:
为了开发API并与Adobe Campaign交互,您需要熟悉数据模型。 Adobe Campaign允许您生成基本的完整说明。 请参阅型号说明。
SOAP协议允许您通过富客户端、使用web服务的第三方应用程序或本机使用这些方法的JSP调用API方法。
SOAP消息的结构如下:
以下模式显示了使用Adobe CampaignAPI时涉及的各种资源:
在此示例中,SOAP查询调用“ExecuteQuery”方法,该方法将字符串作为身份验证(会话令牌)的参数,并将XML内容用于描述要执行的查询。
有关详细信息,请参阅ExecuteQuery(xtk:queryDef)。
此服务的WSDL描述已完成,如下所示:Web服务说明:WSDL。
<?xml version='1.0' encoding='ISO-8859-1'?>
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='http://xml.apache.org/xml-soap' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP-ENV:Body>
<ExecuteQuery xmlns='urn:xtk:queryDef' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<__sessiontoken xsi:type='xsd:string'/>
<entity xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
<queryDef firstRows="true" lineCount="200" operation="select" schema="nms:rcpGrpRel" startLine="0" startPath="/" xtkschema="xtk:queryDef">
...
</queryDef>
</entity>
</ExecuteQuery>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<soap-env:envelope>
元素是消息中表示SOAP封套的第一个元素。
<soap-env:body>
元素是封套的第一个子元素。 它包含消息的描述,即查询或响应的内容。
要调用的方法输入SOAP消息正文的<executequery>
元素中。
在SOAP中,参数是按外观顺序识别的。 第一个参数<__sessiontoken>
采用身份验证链,第二个参数是<querydef>
元素中查询的XML描述。
<?xml version='1.0' encoding='ISO-8859-1'?>
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='http://xml.apache.org/xml-soap' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP-ENV:Body>
<ExecuteQueryResponse xmlns='urn:xtk:queryDef' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<pdomOutput xsi:type='ns:Element' SOAP-ENV:encodingStyle='http://xml.apache.org/xml-soap/literalxml'>
<rcpGrpRel-collection><rcpGrpRel group-id="1872" recipient-id="1362"></rcpGrpRel></rcpGrpRel-collection>
</pdomOutput>
</ExecuteQueryResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
查询结果从<pdomoutput>
元素输入。
SOAP错误响应示例:
<?xml version='1.0' encoding='ISO-8859-1'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Error while executing 'Write' of the 'xtk:persist'.</faultstring> service
<detail>ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert duplicate key row in object 'XtkOption' with unique index 'XtkOption_name'. SQLSTate: 23000
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. SQLSTate: 01000 Cannot save the 'Options (xtk:option)' document </detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP消息正文中的<soap-env:fault>
元素用于传输在Web服务处理过程中产生的错误信号。 它由以下子元素组成:
<faultcode>
:指示错误的类型。错误类型包括:
<faultstring>
:描述错误的消息
<detail>
:长错误消息
验证<faultcode>
元素时,将确定服务调用的成功或失败。
所有Adobe CampaignWeb服务都处理错误。 因此强烈建议测试每个调用以处理返回的错误。
C#中的错误处理示例:
try
{
// Invocation of method
...
}
catch (SoapException e)
{
System.Console.WriteLine("Soap exception: " + e.Message);
if (e.Detail != null)
System.Console.WriteLine(e.Detail.InnerText);
}
要提交Web服务,必须联系实现相应服务方法的Adobe Campaign服务器。
服务器URL如下所示:
https://serverName/nl/jsp/soaprouter.jsp
使用<server>
Adobe Campaign应用服务器(nlserver web)。