1

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

声明示例:

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

3 回答 3

4

这个有可能。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

于 2011-04-20T16:48:56.493 回答
1

我们使用 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 控制台上,并且可以在必要时由管理员进行更改。

于 2010-09-15T18:48:17.020 回答
0

经过一些谷歌搜索,阅读规范和示例......我认为在声明中初始化 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>
...
于 2009-12-27T14:27:34.837 回答