Cast Iron 连接器接口

Cast Iron 连接器使用三个以编排形式实现的标准接口:TestConnection、ListObjects 和 DescribeObjects。

TestConnection、ListObjects 和 DescribeObjects 接口的编排模板是由向导在添加活动阶段中自动创建的。您必须根据各个连接器需求来完成编排。本部分介绍了 TestConnection、ListObjects 和DescribeObjects 接口。在完成连接器接口编排中,完成每个接口的编排。

TestConnection

TestConnection 接口反映了您添加到“连接信息”窗口的值,并且由连接器用于建立端点连接。 建立连接后,连接状态将作为布尔运算符返回。

ListObjects

ListObjects 接口反映了您添加到“添加活动”窗口的值,并且返回特定连接器活动支持的所有对象的列表。例如,Salesforce 创建操作可能支持诸如 AccountCustomerContactOpportunityUser 之类的对象。返回列表应与ListObjects 答复活动模式相对应。以下是 XML 格式的 ListObjects 响应的示例:
<ListObjectsResponse
xmlns="http://www.approuter.com/schemas/cdk/api/">
<objectType
label="Customer"
xmlns="http://www.approuter.com/schemas/cdk/api/">Account</objectType>
<objectType
label="Account Object"
xmlns="http://www.approuter.com/schemas/cdk/api/">Customer</objectType>
<objectType
label="Customer details"
xmlns="http://www.approuter.com/schemas/cdk/api/">Contact</objectType>
<objectType
label="Opportunity details"
xmlns="http://www.approuter.com/schemas/cdk/api/">Opportunity</objectType>
<objectType
label="User details"
xmlns="http://www.approuter.com/schemas/cdk/api/">User</objectType>
</ListObjectsResponse>

DescribeObjects

DescribeObjects 接口提供了一些输入和输出,这些输入和输出使用户可以成功处理通过连接器活动公开的对象。例如,如果选择了 Salesforce 创建操作,那么将根据从 ListObjects 中选择的对象来动态发现输入模式。 以下是 DescribeObjects 返回的响应的示例:
<DescribeObjectResponse baseType="sObject" 
  baseTypeNS="urn:sobject.partner.soap.sforce.com" 
	name="create" typeNS="http://example.com/stockquote" 
	xmlns="http://www.approuter.com/schemas/cdk/api/"
	xmlns:con="http://www.approuter.com/schemas/cdk/config/" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<object label="createInput" maxCount="1" minCount="1" name="createInput"
		used="true">
		<con:field configurable="true" label="ObjectName" maxCount="1"
			minCount="1" name="ObjectName" used="true">
			<con:type>string</con:type>
		</con:field>
		<con:field configurable="true" label="FirstName" maxCount="1"
			minCount="1" name="FirstName" used="true">
			<con:type>string</con:type>
		</con:field>
		<con:field configurable="true" label="LastName" maxCount="1"
			minCount="1" name="LastName" used="true">
			<con:type>string</con:type>
		</con:field>
		<con:field configurable="true" label="Phone" maxCount="1"
			minCount="1" name="Phone" used="true">
			<con:type>string</con:type>
		</con:field>
	</object>
	<responseObject label="createOutput" maxCount="1"
		minCount="1" name="createOutput" used="true">
		<con:field configurable="true" label="Id" maxCount="1"
			minCount="1" name="Id" used="true">
			<con:type>string</con:type>
		</con:field>
		<con:field configurable="true" label="ObjectName" maxCount="1"
			minCount="1" name="ObjectName" used="true">
			<con:type>string</con:type>
		</con:field>
		<con:field configurable="true" label="Status" maxCount="1"
			minCount="1" name="Status" used="true">
			<con:type>string</con:type>
		</con:field>
	</responseObject>
</DescribeObjectResponse> 

动态模式发现

DescribeObjects 模式发现功能使您可在运行时动态发现模式。当任何连接器活动使用模式元素作为输入或输出时,将模式导入您的编排。如果需要使用 complexType QName 发现之前导入的模式,并动态替换为输入或输出活动,请在以下模式中所示设置 DescribeObject 响应中的属性:
< xsd:schema   targetNamespace = " urn.sample.stock
 " xmlns:xsd = "http://www.w3.org/2001/XMLSchema" >
 < xsd:element   name = "TradePriceRequest" >
 < xsd:complexType >
 < xsd:all >
 < xsd:element   name = "tickerSymbol"   type = "xsd:string"   />
 </ xsd:all >
 </ xsd:complexType >
 </ xsd:element >
 < xsd:complexType   name = "ciObject" ></ xsd:complexType >
 < xsd:complexType   name = " tradingPartner " >
 < xsd:sequence >
 < xsd:element   name = "partnerName"   type = "xsd:string"   />
 </ xsd:sequence >
 </ xsd:complexType >  

例如,要替换先前模式中的 complexType tradingPartner,请设置信息以发现模式并动态替换,如以下示例所示:

DescribeObject Response value to 
@name   -> tradingPartner [complexType name to be discovered]
@typeNS  ->  url.sample.stock [complexType namespace ]
@baseType -> http://www.approuter.com/schemas/cdk/api/    [CDK default]
@baseType -> cObject [CDK default]
描述对象菜单的示例