“编写 OData”活动
此活动采用“读取 OData”活动的输出以及其他诸如有效内容、HTTP 状态码等详细信息作为输入,并生成需要作为响应传回的输出。
“编写 OData”活动的配置属性
字段名 | 描述 |
---|---|
OData 版本 | 此活动使用的 OData 版本。在单个编排中,需要在所有活动上使用相同版本。当前唯一支持的版本为 4.0。 |
选择输入数据 | 选择有关如何向“读取 OData”活动提供业务数据结构的一个选项。将基于提供的此业务结构创建 OData API。
|
给定包含帐户和产品对象的样本 XML 模式示例。
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
xmlns:ras="http://www.sample.com/xmlns/prod/sample"
targetNamespace="http://www.sample.com/xmlns/prod/sample">
<element name="account" type="ras:AccountObject"/>
<element name="product" type="ras:ProductObject"/>
<complexType name="AccountObject">
<sequence maxOccurs="1" minOccurs="1">
<element maxOccurs="1" minOccurs="0" name="accountId" type="int"/>
<element maxOccurs="1" minOccurs="0" name="accountName" type="string"/>
<element maxOccurs="1" minOccurs="0" name="valid" type="boolean"/>
</sequence>
</complexType>
<complexType name="ProductObject">
<sequence maxOccurs="1" minOccurs="1">
<element maxOccurs="1" minOccurs="1" name="pid" type="int"/>
<element maxOccurs="1" minOccurs="0" name="productName" type="string"/>
<element maxOccurs="1" minOccurs="0" name="description" type="string"/>
<element maxOccurs="1" minOccurs="0" name="stock" type="int"/>
</sequence>
</complexType>
</schema>
字段名 | 描述 |
---|---|
serviceName | 这是 OData ReST API 的名称并且将作为 URL 的一部分。此属性的值必须与 HTTP“接收请求”活动的“配置”面板中的“URL(主机名之后的路径)”属性的值相同。在点击具有此名称的 URL(例如:http://host/serviceName)时,将在响应中提供服务文档。 |
protocol | OData ReST API 支持的协议。该值需要缺省为两个受支持的值(HTTP 或 HTTPS)之一。 |
host | API 运行所在的主机。必须从 HTTP“接收请求”活动的输出映射此属性的值。 |
method | 请求的 http 方法。必须从 HTTP“接收请求”活动的输出映射此属性的值。 |
Accept | Accept 头值。此属性的值可设置为缺省值或者从 HTTP“接收请求”活动的输出进行映射。受支持的值为 application/json 和 application/xml。 |
Content-Type | Content-Type 头值。此属性的值可设置为缺省值或者从 HTTP“接收请求”活动的输出进行映射。受支持的值为 application/json 和 application/xml。 |
resourcePath | 此属性包含调用的 url 路径,并且从“读取 OData”活动的输出映射。 |
entities | 此属性是字符串数组类型,包含在 url 中请求的实体集名称,并从“读取 OData”活动的输出映射。例如,如果 serviceName 为 /test 并且选中的业务数据结构为 account(来自于以上模式),那么用于获取所有 帐户详细信息的 URL 为 http://hostname/test/accounts。在此示例中,实体集名称为 accounts。 |
fieldName | 如果在业务数据结构中提供字段名称请求,那么将在此属性中提供字段的名称。从“读取 OData”活动的输出映射此属性的值。例如,如果请求的 URL 为 http://hostname/test/accounts(5)/accountName,那么 fieldName 的值将为 accountName。 |
additionalpath | 如果请求 url 中存在任何其他诸如 $value 或 $count 之类的标记,那么此值将存在于此属性中,并从“读取 OData”活动的输出映射。 |
primaryKeys | 如果请求 url 包含主键,那么该信息存在于此字段中,并且从“读取 OData”活动的输出映射值。 URL 示例: http://hostname/test/accounts(5) http://hostname/test/salesorder(orderid='so1',name='ask') primaryKeys 结构将包含主键的字段名称、值和数据类型。 |
status | 包含在 DELETE 操作的响应中返回的 HTTP 状态码。 |
writeODataInput | 必须进行序列化并在响应中返回的业务对象结构。 |
writeODataQueryParametersInput | 必须在响应数据上应用的查询参数。将从“读取 OData”输出映射值。 |
writeODataHttpHeadersInput | 必须在响应数据上应用的 HTTP 头。将从“读取 OData”输出映射值。 |
字段名 | 描述 |
---|---|
writeODataOutput | 必须作为响应发送的数据。包含 HTTP 状态码、HTTP 消息和响应有效内容。 |
writeODataHttpHeadersOutput | 此属性包含必须作为响应发送的 HTTP 头。 |