首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >while循环中的转换- BPEL 10g

while循环中的转换- BPEL 10g
EN

Stack Overflow用户
提问于 2017-06-19 18:40:47
回答 1查看 165关注 0票数 0

需求是从文件中读取数据并调用webservice。目标webservice一次可以处理一个有效负载,但在源代码中将有多个有效负载。因此,我使用while循环逐个处理有效负载。

问题:在目标服务中,EarningTypeInclusion是可选元素,因此在一些源有效负载中,此元素将存在,而在某些有效负载中,此选项元素将不存在。

代码语言:javascript
复制
<thresholdRequestInterface xmlns:xs="http://www.sample.com/ns/LMSReferrals">
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
</thresholdRequest>
</thresholdRequestInterface>

如果我正在使用赋值活动,那么当可选元素不存在于源有效负载中时,选择失败故障就会出现。我们使用BPEL 10g,分配活动中没有选项来抑制选择失败错误。所以决定在while循环中使用转换。

使用的逻辑

从文件读取

分配循环counter=1

有效负载计数(从文件读取)

有效负载的While循环counter<=计数

传递循环计数器参数值以进行转换

将源文件转换为目标文件,即thresholdRequestloopcounter

调用目标web服务

递增循环计数器

结束循环;

问题是同样的数据正在被转换。

在下面的示例中,引用11数据加载了3次。我已经检查了conter值,它正在递增,但在转换中,相同的值正在被转换。

代码语言:javascript
复制
<thresholdRequestInterface xmlns:xs="http://www.sample.com/ns/LMSReferrals">
<thresholdRequest>
<Referral>11</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
<thresholdRequest>
<Referral>12</Referral>
<thresholdValue>100</thresholdValue>
</thresholdRequest>
<thresholdRequest>
<Referral>13</Referral>
<thresholdValue>100</thresholdValue>
<EarningTypeInclusion>
<earningType>positive</earningType>
<ProvisionId>1000</ProvisionId>
</EarningTypeInclusion>
</thresholdRequest>
</thresholdRequestInterface>

来源

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://www.sample.com/ns/LMSReferrals" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.sample.com/ns/LMSReferrals" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="thresholdRequestInterface">
  <xs:complexType>
      <xs:sequence>
  <xs:element name="thresholdRequest" minOccurs="1" maxOccurs="unbounded">
    <xs:complexType>
      <xs:sequence>
        <xs:element  name="Referral" type="xs:string"/>
        <xs:element  name="thresholdValue" type="xs:int"/>
        <xs:element  name="EarningTypeInclusion" minOccurs="0" maxOccurs="1" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="earningType" type="xs:stirng" />
              <xs:element name="ProvisionId">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="20" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
          </xs:element>
          </xs:sequence>
          </xs:complexType>
          </xs:element>
          </xs:sequence>
          </xs:complexType>
          </xs:element>

</xs:schema>

请查找源和目标的架构结构

目标

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns="http://www.sample.com/ns/LMSReferrals" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.sample.com/ns/LMSReferrals" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="thresholdRequest">
    <xs:complexType>
      <xs:sequence>
        <xs:element  name="Referral" type="xs:string"/>
        <xs:element  name="thresholdValue" type="xs:int"/>
        <xs:element  name="EarningTypeInclusion" minOccurs="0" maxOccurs="1" >
          <xs:complexType>
            <xs:sequence>
              <xs:element name="earningType" type="xs:stirng" />
              <xs:element name="ProvisionId">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="20" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
          </xs:element>
          </xs:sequence>
          </xs:complexType>
          </xs:element>
</xs:schema>

请注意,在目标webservice上启用了架构验证。

EN

回答 1

Stack Overflow用户

发布于 2017-09-19 11:58:00

使用ora:getElement(‘/ Transform.Try请求接口/阈值请求’,bpws:getVariable(loopCounter))

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44628368

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档