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]
說明物件功能表範例