11/14/2006

About WebMethods

webMethods 概览

webMethods 是一个platform的名字,也是一个公司的名字。这个platform主要是用来做EAI的。webMethods公司的网站就是webMethods.com,上面有一些简单的介绍。而如果需要学习,则可以到advantage.webmethods.com这个地址上去,不过似乎只有webMethods的合作伙伴才可以注册帐号,浏览里面的doc. 另外有一个叫wmusers.com的网站,上面有一些简单的资料,但是远不如前者齐全了。

webMethods有一个certificate,以前是免费的(当然,你需要是webMethods的partner)。但从今年的7月开始,无论是谁,都必须先参加其相关课程才能够去考。(相关课程的价格很高,数千USD)。所以以前能考出来的人实在是幸运的。

webMethods 这个平台有好几个部分构成,主要有IS(Intergration Server), Broker, Workflow, Modeler, Trading Network,还有一些诸如MainFrame,eStandards等的还没怎么接触过。

就软件而言,webMethods提供了IS Server,Developer,Modeler,Workflow,Administrator等, 这几个已经可以基本完成开发了。在后面的相关文章里我会再逐一介绍。

接下来的文章里,绝大部分来自于webMehods官方提供的guideline里的内容,也有一些是在做case study时的一些体会。


webMethods 之 components

首先我们看一下webMethods的主要结构:

如图所示,左侧的几个组件代表client端的组件,而右侧的是server端的。

在官方文档里,将webMethods platform分为了run-time components, design-tiem conponents和

administrator components。后两者主要以操作为主,在本文中,主要介绍run-time组件。

webMethods的run-time组件主要分为IS(Integration Server),Broker,Adapters,Mainframe,Trading Networks和Workflow等。

IS是run-time的核心组件,它是integration logic的主要执行者。“ webMethods Integration Server connects internal and external resources to the integration platform”。

Broker是“message router”,它是我们所说的“message backbone” or “message facility”的主要部件。

Adapter位于IS上,它将the back-end resources与integration platform连接起来。

Mainframe “functions as an agent between the Integration Server and online applications running under CICS (Customer Information Control System) or IMS/DC (Information Management System/Data Communications) on the mainframe.”

Trading Networks 是IS的一个附加(add-on)组件,它用以实现与外部系统(如客户的相关系统)的信息交换。“webMethods Trading Networks acts as a business document gateway ”。

Workflow用来执行workflows. "A workflow is a series of tasks performed by one or more people (participants) at execution time."

Run-time components主要就是以上几种。另外,design-time components主要包括Developer, Workflow Designer, Modeler, Trading Networks Console. Adminstrator components主要有Administrator,Monitor和Manger。这些将在后面介绍。


webMethods 之 Developer 1

现在开始Developer的内容。Developer我认为是webMethods开发的最重要的IDE。本文先讲一些相关概念。

Service

这里的service很像我们平常程序中的函数,doc:Integration Server is a service-base integration broker. A service is a process that may be invoked to perform a wide variety of tasks.


Package

Pacakge可以看成是一个容器。官方的doc是这么写的“A package is a container that is used to bundle services and related elements. Packages are designed to hold all of the components of a logical unit in an integration solution.”


Element

Elements可以看成是package中可以包含的元素。doc:Elements include folders, services, specifications, IS document types, triggers, and IS schemas.


Element Names

Elements Names比较特别,是由目录名和element名构成的。比如:

folder.subfolder1.subfolder2:element


Lock

Lock很像版本控制里的概念。doc: A lock on an element prevents another user from editing that element. There are two types of locks: user locks and system locks.


ACL


ACL是一种权限控制的机制。doc:

An ACL (access control list) controls access to packages, folders, and other elements (such as services, IS document types, and specifications) at the group level.


webMethods 之 Developer 2


我们继续讲webMethods Developer。本文主要讲的是Developer的Flow Service。

Flow Service的功能类似于一般的函数。但是,这个函数是用webMethods自创的Flow语言写的。(其实与其说写,还不如说“画”的)。看doc里的定义: A flow service is a service that is written in the webMethods flow language. 另外,每个Flow Service都有输入输出。

Flow Service是由Flow Step构成的。我们可以将flow step想象为函数的一条(或者多条语句)。doc:A flow step is a basic unit of work. 本文主要讲的就是不同类型的flow step。

了解了上面的两个概念,我们还需要知道Pipeline的含义。 在我看来,Pipeline很像JSP里的Servlet Context,它存放着可以被整个系统使用的数据。我们看doc:The pipeline is the general term used to refer to the data structure in which input and output values are maintained for a flow service. It allows services in the flow to share data. When a service in the flow executes, it has access to all data in the pipeline at that point. (SHARE)

接下来是有关flow step的内容。flow step 分为BRANCH,SEQUENCE,REPEAT,LOOP,EXIT,MAP六种。这六种其实只不过是对一般编程语言的赋值、流程控制等的重新定义而已。

BRANCH是分支结构的意思,它与Java里的switch类似。而有趣的是,用来确定BRANCH走向的参数名恰好就是在switch中定义的. (而子选择参数是以Label确定的)

SEQUENCE是顺序结构的意思。它的意义在于它可以将多个flow step封装成一个来看待。并且,在其内部可以定义运行到何时结束,比如until failure, until success, until done等。

REPEAT是重复,它可以指定重复次数。

LOOP的意义在于它极大方便了对数组的枚举。

EXIT是退出的意思,它可以选择退出到程序的那一层。

MAP是赋值的作用,它有一个叫transformer的东西,可以在赋值前完成一些处理。

以上就是对Flow Language的简单介绍,上面的各种step都是通过拖拽图标实现的,而不是手工code。这是好是坏,也没什么好说的。不过pipeline的作用,是需要在实践中逐步体会的。


webMethods 之 Developer 3

写到这里,有关于Developer的基本概念应该是有些了解了。那么在本文中,我们看一下在实践中的几个要点。


首先是启动Integration Server。IS的启动可以直接在开始菜单启动,也可以在cmd下启动。在cmd中启动时,有个参数可以用:

-debug num 这个表示log的显示等级,num越大Log越详细

-log none 这个表示将log显示在cmd窗口中,如果没有这个参数,可进入Adminstrator查看

一般来说,初次启动IS还是需要在cmd中显示比较好(顺便说一句,笔者使用的webMethods6.1,要想正常启动IS,需要修改: %webMethods%/IntergrationServer/bin/server.bat ,line 49:

SET JAVA_DIR=C:\webMethods6\jvm\win142

否则会报ClassNotFound的错误,因为JRE路径没有设对)

成功启动IS之后,可以在浏览器输入http://localhost:5555 进入Administrator。第一次进入的用户名是Administrator,密码是manage。在里面,通常可以自己添加用户。这个比较简单,就不说了。

以后在Developer中,以自己的用户登录,就可以开始工作了。


webMethods 之 Developer 4

成功进入Developer之后,我们就可以开始工作了。比较简单的内容这里就不写了,下面只摘录一些我在做case study时的理解。
  1. 在一般编程时,我们常常需要定义一些数据类型。在Developer里,这种数据类型的定义是通过Document Type来实现的。这种Document Type很像structure,当然,通过IDE,它的定义过程也被极大地傻瓜化了。同时,Document Type的定义也可来自XML、XML Schema等,这也许才是改进之处吧。

  2. 既然Service可以看成一个函数,那么因为原来函数是可以调用函数的,所以,Service也是可以调用Service的。事实上,数据定义,流程控制,以及数据处理——这三者已经构成了编程语言的三个要素。

  3. 在Developer 中,还有一些常用的Element,其实都是傻瓜化了的程序功能。比如Adapter Service,提供了对数据库操作的支持,我们只需要在IS中定义好相应的数据库联接,就可以方便的在Developer中调用。又比如 Trriger,它提供了对subscribe的支持(以后我会讲publish-subscribe)。比如Notification,它能够监视数据源的变化,有力地支持了数据同步功能。这些可以说是webMethods为集成提供的不错的工具吧。

webMethods 之 Trading Networks

笔者对Trading Networks的认识还只是概念而已,由于读了相应的文档,所以把一些笔记整理在这里。

普遍意义上的Trading Network是指“a set of organizations that have agreed to exchange business documents”

webMethods Trading Networks是运行在IS上的一个组件,其功能是与其他组织(公司、市场等)的系统联系“to form a business-to-business trading network.”

在Trading Networks有Partner这样的概念。它是构成Trading Network的元素,“send documents to Trading Networks for processing and/or that will receive documents that Trading Networks is instructed to deliver”

有关Partner的Information有两方面:一个是Profile,记录的是“information about a corporation that is a part of a trading network.”

另一个是TPA(Trading partner agreements),是一组定义Trading的参数约定,是可选的。文档里的说法是:“ A Trading Partner Agreement (TPA) is an optional set of parameters that you can define and use to tailor how documents are exchanged between two trading partners.

1 条评论:

匿名 说...

想跟你请教下WEBMETHODS的问题,急!请加我:ousan2007@hotmail.com