BPEL例子s

BPEL Samples
 
BPEL 例子
 
As of this writing, there is one sample BPEL process that comes with the ActiveBPEL™ engine. This document comes from the README.txt file included with the sample code.
 
就标题所写 , 这是一个使用 ActiveBPEL™ 引擎的 BPEL 流程样例。本文来自在例子代码中的 README.txt
 
The samples/loan_approval directory contains the files that make up the example loan approval BPEL process, two auxiliary Web services upon which it depends, two command-line test clients, and a BPEL process client JSP page. The loan approval process is the same as the one used in the BPEL spe cification Business Process Execution Language for Web Services Version 1.1.
 
samples/load_approval 目录下包括拼凑借货 BPEL 流程例子的文件,两个依赖的辅助性 Web service ,两个命令行测试客户端,和一个 BPEL 客气端 JSP 网页。这个借货流程和 BPEL 规范中的 Business Process Execution Language for Web Services Version 1.1 是一样的。
 
The values sent to the BPEL process and returned by the assessor and approver are read from a configuration file. See The Config File below.
 
把值传送到 BPEL 流程并返回从配置文件中的assessor和approver,请看下面的配置文件。
 
Dependencies
 
依赖
 
You must have a working ActiveBPEL engine. See Installing and Configuring the ActiveBPEL Engine.
 
你必须有一个正在运行的 ActiveBPEL 引擎。查看《 ActiveBPEL 引擎的安装与配置》。
 
You need Ant in order to run the targets in the build.xml file. You could do everything manually, but the rest of this document assumes you have Ant.
 
你需用到 Ant 来运行 build.xml 文件中的 target 。一切你都可以手动来做,但本文假定你使用 Ant
 
The environment variable CATALINA_HOME must be defined so the Ant script knows where to deploy everything.
 
必须正确定义环境变量 CATALINA_HOME ,以便 Ant 脚本知道要分发到哪。
 
Setup
 
配置
 
If your ActiveBPEL engine installation is not running on "localhost:8080", change that string in the three files containing it:
 
如果你的 ActiveBPEL 引擎不是运行在 ”localhost:8080” ,修改下面三个文件中对应的字串:
 
  • bpel_example_config.xml
  •  
  • bpel_process/wsdl/loanapprover.wsdl
  •  
  • bpel_process/wsdl/loanassessor.wsdl
  •  
Deploying the BPEL Process
 
配置 BPEL 流程
 
From the command line, navigate to the directory <installdir>/activebpel-version/ samples/loan_approval (where "version" is a version number like 0.9.5. All subsequent commands will be run from this directory.
 
在命令行下,转到 <installdir>/activebpel-version/ samples/loan_approval 目录。所有后来的命令都会在这目录运行。
 
To deploy the BPEL process, type
 
要分配置 BPEL 流程,输入
ant deploy
If the ActiveBPEL engine is running, soon after you deploy your BPEL process the ActiveBPEL engine will notice the .bpr file and read it. Your BPEL process is ready to use.
 
如果 ActiveBPEL 在运行,配置 BPEL 流程后不久, ActiveBPEL 引擎会注意到这个 bpr 文件,并读取它。 BPEL 流程准备好使用了。
 
See Starting the ActiveBPEL Engine for instructions on starting and stopping the engine.
 
参阅《开启 ActiveBPEL Engine 》来了解关于开启与关闭引擎。
 
The deploy target calls three other targets: deploy-bpel, deploy-ws, and deploy-jsp. deploy-bpel creates and installs a .bpr archive file that contains the BPEL process information. deploy-ws creates and installs a .bpr file that contains the Web services. deploy-jsp creates and installs a .wsr file that contains the JSP page and supporting classes.
 
deploy 这个 target 调用另外三个 target:deploy-bpel deploy-ws deploy-jsp deploy-bpel 建立与安装一个包括 BPEL 流程信息的 bpr 文件。 deploy-ws 新建与安装包含 Web service BPR 文件。 deploy-jsp 新建与安装一个包含 JSP 网页和所需类的 wsr 文件。
 
The Web services don't need to be in a .bpr file to be deployed, but doing so lets the ActiveBPEL engine find the file and hand the Web services over to Axis (a SOAP implementation). Using a .bpr file is only a convenience that simplifies deployment. The Web services are independent of the ActiveBPEL engine.
 
这个 Web service 并不一定要配置到 BPR 文件中,但这样可让 ActiveBPEL 引擎找到这文件来,并把这个 Web Service 交给 Axis (一个 SOAP 实现)来处理。使用 BPR 文件只是为了简化部署(步骤)。 Web service 是独立于 ActiveBPEL 引擎的。
 
Testing the Web Services
 
测试 Web service
 
There is a simple command line client that tests the "assessor" and "approver" Web services. These services are used by the BPEL loan approval process. The test client calls each Web service and compares the returned result with the expected value found in the config file. To run the test client, type
 
这里有一些测试“ assessor ”和“ approver Web service 的命令。这些服务被 BPEL 借货流程所使用。测试客户端调节器用每个 Web service 和比较返回值与配置文件中预设的值。运行测试客户端,输入:
 
 
ant ws-test-client
(The Web services themselves are deployed by the target deploy-ws as discussed above. However, the target ws-test-client does NOT depend upon the deploy-ws target. Why not? Because things happens too fast: if you deploy the Web services then immediately use the client the server may not have time to notice and (re)initialize the Web services. You must use either the deploy-ws or deploy targets before running the test client.)
 
Web services 他们上面说那样由 deploy-ws 这个 target 配置。然而, ws-test-client 并不依赖于 deploy-ws 。为什么呢,因为事情发生得太快:如果你配置 Web service 就立即使用客户端端,服务端可能没有时间注意到或重初始化 Web service 。你必须在运行 ws-test-client 前,使用 deploy-ws deoloy target
 
The output is similar to JUnit output; if all is well, you will see
 
输出有点象 Junit ;如果一切正常,你会看到:
 
 
  ..
 
OK 2 tests; 0 errors
If one fails you will see something like
 
如果有错误,你会看到象下面的东西:
 
 
E.
 
assessor expected result "low" does not match returned result "foo"
 
ERROR 2 tests; 1 error
Web Services and the ActiveBPEL Engine
 
Web Service ActiveBPEL 引擎
 
The Web services are deployed inside a .bpr file, the archive format used for deploying BPEL processes. This is not necessary; it is only a convenience. The ActiveBPEL engine will "notice" the .bpr file and hand our Web services to the Axis SOAP implementation. The engine does not "know" about the Web services directory and does not use any shortcuts to call the Web services.
 
Web Service 被分发到一个 BPR 文件(分发 BPEL 流程的存档格式)中。这不是必须的;这只是为了文便。 ActiveBPEL 引擎会“注意”到这个 BPR 文件,并把 Web service 交给 Axis SOAP 执行。引擎并不“知道” Web service 的路径也不使用任何 shortcut 来调用 Web service
 
Running the BPEL Process Client
 
运行 BPEL 流程客户端
 
To run a command-line client that calls the BPEL process Web service, type
 
运行命令行客户端来调用 BPEL 流程 Web service ,输入:
ant client
The client compares the value returned by the BPEL process with the config file value /rundata/bpel-expected-response and prints either an OK or an ERROR message.
 
客户端比较 BPEL 流程的返回值和配置文件的 value rundata bepl-expected-respones 并打印是 OK 还是 ERROR 消息。
 
As discussed above in Testing the Web Services, you must deploy everything before using this client.
 
就如上面 Testing the Web Services 所说,你必须在使用这 client 前配置好所有东西。
 
Using the BPEL Process JSP Client Page
 
使用 BPEL 流程 JSP 客户端页面
 
Instead of running the command line clients, you can use the JSP page at http://localhost:8080/bpel_example_client_page/index.jsp. (Again, if your Tomcat installation is not running at localhost:8080, modify the URL accordingly.)
 
你可以运行命令行客户端不同,你可以使用 http://localhost:8080/bpel_example_client_page/index.jsp 这个页面(重复,如果 Tomcat 没有运行于 localhost:8080 ,修改相应的 URL )。
 
The page displays many of the values from the config file and lets you edit them. Clicking the "Apply for a Loan" button saves the values you entered to the deployed copy of the config file, sends the loan application request to the BPEL process, and displays the response.
 
这页面显示很多配置文件中的值,并可以编辑。点击“ Apply for a Loan ”按钮,保存你输入的值到已分发的配置文件副本,传送借应用需求到 BPEL 流程,并显示响应(信息)。
 
The Config File
 
配置文件
 
The file bpel_example_config.xml contains values used by the test client, the two auxiliary Web services, and the Web services test client.
 
bpel_example_config.xml test 客户端用到的值,两个辅助的 Web service Web service 的客户端。
 
To deploy the config file manually, type
 
手动分发配置文件,输入:
ant deploy-config
The Ant targets that compile the clients and deploy the Web services all make sure the config file is deployed.
 
Ant target 编译客户端并分发已在配置的 Web service
 
BPEL process expected response
 
BPEL 流程预定回应
 
In order to properly set the value /rundata/bpel-expected-response, you have to understand the example loan approval BPEL process. Here it is, in pseudo-code:
 
为了合理设置 value /rundata/bpel-expected-response ,你必须理解借货 BPEL 流程例子,这是“假冒”的代码。
 
 
if (amount < 10000) {
 
    if (assessor returns "low")
 
        return "yes"
 
    else
 
        return approver response
 
}
 
else
 
    return approver response
If the assessor Web service encounters an error, it returns "high". If the approver encounters an error, it returns "no".
 
如果 assessor Web service 遇到错误,则返回“ high ”。如果 approver 遇到错误,返回“ no ”。
 
Config file changes
 
配置文件的变更
 
Instances of RuntimeParams are responsible for reading the config file. They do so in the constructor. This means that each time a RuntimeParams object is created the config file is re-parsed, allowing the config file changes to be recognized immediately. For example, Web services create a RuntimeParams object each time they are called. That means you can change the config file and deploy it and the next time a Web service is called it will use the new values.
 
 
 
RuntimeParams 实例在构建的时候负责读取配置文件。这意味着每一次 RuntimeParams 对象被建立时配置文件会初再度分析,让配置文件的变更立即被验证。如, Web service 在每次被调用时建立 RuntimeParams 对象。也就是说,你可以改变并分发配置文件,且在下一次 Web Service 被调用时会使用新的值。
 
 注:相关文件可以在 http://www.activebpel.org/samples/samples-3/samples.php找到.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 前言..............................................................................................................- 3- 1.1. 前提条件....................................................................................................- 3- 1.2. 目标...........................................................................................................- 3- 1.3. 章节设计....................................................................................................- 3- 2. 概述..............................................................................................................- 3- 2.1. BPEL背景知识..........................................................................................- 4- 2.2. 编制与编排................................................................................................- 4- 2.3. 构建业务流程.............................................................................................- 5- 3. 实例分析.......................................................................................................- 6- 3.1. 实例逻辑....................................................................................................- 6- 3.2. 列出相关Web 服务的清单.........................................................................- 7- 3.3. 为BPEL流程定义WSDL.........................................................................- 8- 3.4. 定义合作伙伴链接类型...............................................................................- 8- 3.5. 创建业务流程........................................................................................... - 10- 3.6. 部署和测试.............................................................................................. - 17- 3.6.1. 改变目录结构....................................................................................... - 17- 3.6.2. 改写BPEL文件.................................................................................... - 18- 3.6.3. 改写WSDL文件................................................................................... - 26- 3.6.4. 生成部署描述符(.pdd)........................................................................... - 39- 3.6.5. 生成可执行文件(.bpr)............................................................................ - 43- 4. 数据库持久化配置....................................................................................... - 43- 4.1. Serlvet 容器配置....................................................................................... - 44- 4.2. 安装ActiveBPEL引擎.............................................................................. - 44- 4.3. ActiveBpel 的数据持久化配置................................................................... - 44- 5. 流程的调用.................................................................................................. - 45- 5.1. WSDL文件转换为Java............................................................................ - 45- 5.2. 调用相应的web服务................................................................................ - 74-

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值