BPEL 变量初始化

发布于 2024-08-16 06:59:37 字数 222 浏览 3 评论 0 原文

是否可以在声明处初始化 BPEL 变量?如果是这样怎么办?

声明示例:

<variables>
    <variable name="offer" type="xsd:float"/>
    <variable name="response" type="xsd:string"/>
</variables> 

Is it possible to initialize BPEL variables at the declaration ? if so how ?

declaration example :

<variables>
    <variable name="offer" type="xsd:float"/>
    <variable name="response" type="xsd:string"/>
</variables> 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

黄昏下泛黄的笔记 2024-08-23 06:59:37

这是可能的。 BPEL 2.0 允许直接在变量声明中使用 from-spec。然而,并非所有 BPEL 引擎都实现了此功能,例如 Apache ODE 无法处理此类内联初始化。

以下代码片段是有效的 BPEL 2.0:

<variables>
    <variable name="response" type="xsd:string">
        <from>'TocToc'</from>
    </variable>
    <variable name="offer" type="xsd:float">
        <from>100</from>
    </variable>
</variables>

有关示例,请参阅 [1] 中的第 121 页和 [1] 中的第 8.1 节(第 45 页)了解定义。

[1] http://docs.oasis-open.org/ wsbpel/2.0/wsbpel-v2.0.pdf

This is possible. BPEL 2.0 allows a from-spec directly in the variable declaration. However, this feature is not implemented by all BPEL engines, e.g. Apache ODE cannot handle such inline initializations.

The following snippet is valid BPEL 2.0:

<variables>
    <variable name="response" type="xsd:string">
        <from>'TocToc'</from>
    </variable>
    <variable name="offer" type="xsd:float">
        <from>100</from>
    </variable>
</variables>

For an example, please see page 121 in [1] and section 8.1 (page 45) of [1] for the definition.

[1] http://docs.oasis-open.org/wsbpel/2.0/wsbpel-v2.0.pdf

浸婚纱 2024-08-23 06:59:37

我们使用 Oracle BPEL,它允许在 bpel.xml 文件中设置属性,如下所示:

 <preferences>
    <property name="output_file" encryption="plaintext">logging.txt</property>
    <property name="expire_hours" encryption="plaintext">10</property>
    <property name="retry_count" encryption="plaintext">4</property>
 </preferences>

可以使用 ora:getPreference("varname") 在代码中访问

这些属性也会显示在 BPEL 控制台上,并且可以通过如有需要,请管理员。

We use Oracle BPEL and it allows properties to be set in the bpel.xml file like such:

 <preferences>
    <property name="output_file" encryption="plaintext">logging.txt</property>
    <property name="expire_hours" encryption="plaintext">10</property>
    <property name="retry_count" encryption="plaintext">4</property>
 </preferences>

The can be accessed in the code using ora:getPreference("varname")

These also show up on the BPEL console and can be changed by an admin if necessary.

此刻的回忆 2024-08-23 06:59:37

经过一番谷歌搜索后,阅读规范和示例...我认为不可能在声明处初始化 BPEL 变量...如果我们愿意,我们需要在流程序列中执行此操作:

...
    <variables>
        <variable name="response" type="xsd:string"/>
        <variable name="offer" type="xsd:float"/>
    </variables>
...
    <sequence>
        <receive createInstance="yes" .../>
...
        <assign name="init">
            <copy>
                <from>100</from>
                <to variable="offer"/>
            </copy>
            <copy>
                <from>'TocToc'</from>
                <to variable="response"/>
            </copy>
        </assign>
...

After some googling, reading spec and examples ... I think it's not possible to initialize BPEL variables at the declaration ... If we want we need to do it in the process sequence :

...
    <variables>
        <variable name="response" type="xsd:string"/>
        <variable name="offer" type="xsd:float"/>
    </variables>
...
    <sequence>
        <receive createInstance="yes" .../>
...
        <assign name="init">
            <copy>
                <from>100</from>
                <to variable="offer"/>
            </copy>
            <copy>
                <from>'TocToc'</from>
                <to variable="response"/>
            </copy>
        </assign>
...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文