
它是一种构建应用程序的普遍模型,可以在任何支持网络通讯的 *** 作系统中实施运行,它是一种新的web应用程序分支,是自包含、自描述、模块化的应用,可以发布、定位、通过web调用。Web Service是一个应用组件,它逻辑性的为其他应用程序提供数据与服务,各应用程序通过网络协议和规定的一些标准数据格式(Http,XML,Soap)来访问Web Service,通过Web Service内部执行得到所需结果。Web Service可以执行从简单的请求到复杂商务处理的任何功能。一旦部署以后,其他Web Service应用程序可以发现并调用它部署的服务。实际上,WebSerice的主要目标是跨平台的可互 *** 作性。为了达到这一目标,WebService完全基于XML、XSD等独立于平台、独立于软件供应商的标准,是创建可互 *** 作的、分布式应用程序的新平台。在以下三种情况下,使用WebService会带来极大的好处:
1)跨防火墙的通讯
2)应用程序集成
3)B2B的集成
4)软件和数据重用
不过,也有一些情况,WebService根本不能带来任何好处。
一、单机应用程序
二、局域网的统购应用程序(此种集成,使用DCOM比SOAP/HTTP效率高的多)
2. 背景说明
鼎新的Tiptop ERP系统,采用法国4js公司的Genero开发工具,也就是俗称的第四代开发语音(4gl),其前身来源于Informix数据库,后经过4js公司的扩展,目前已可以兼容多种数据库,比如重量级的Oracle,DB2等,还有一些轻量级的,如GeneroDB,mySQL等。因为Tiptop系统通常运行在Unix/Linux平台,跟基于SQL Server数据库的应用程序集成的时候便显得异常困难。虽然可以使用如Oracle的透明网关之类的解决方法,但是却受到颇多限制(Oracle也只限Win平台),因此使用WebService的方式就顺利成章了。所幸,Genero中已经提供了针对WebService的解决方案,而且相当的简单。
本人使用的Tiptop版本为GP5.X。鼎新已经在其产品包中提供了很多关于Web Services的程序,本文不打算讨论这些针对ERP的Web Services,就从Genero的底层开始,探讨如何使用4gl调用Web Service函数,来实现ERP数据跟另外一个系统(数据库平台为SQL Server)的同步。除了实现数据库同步外,还可以实现其他复杂的业务逻辑,本文仅抛砖引玉,如果你有更好的方案,可以同作者交流。
如果需在在Genero中提供Web Service服务函数,另开文章探讨。
3. 测试本文档需要具备的条件?
l IIS(Internet Information Services),Web Server,部署web servies的服务器
l Visual Studio 2005,开发Web Services服务函数。当然也可以使用其他开发工具开发,本文以C#为例说明。
l Genero Studio,开发客户端4gl程序,可以是其他工具,如UE、VI等。
l 程序要达到的目的:ERP有一个基本档aooi040,用来输入员工基本信息,员工的工号为Key值,不允许在ERP中直接修改。程序最终看到的结果:在ERP中新增、修改、删除数据记录时,同时在另一个系统的SQL Server数据库的数据也会同步更新。SQL SERVER的数据结构如下:
CREATE TABLE [dbo].[Employee](
[ID] [int] IDENTITY(1,1) NOT NULL,
[EmpCode] [varchar](8) COLLATE Chinese_PRC_CI_AS NOT NULL,
[EmpName] [varchar](30) COLLATE Chinese_PRC_CI_AS NULL,
[EmpDept] [varchar](6) COLLATE Chinese_PRC_CI_AS NULL,
[CreateDate] [smalldatetime] NULL,
CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED
(
[EmpCode] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
//刚写的,测试通过,如果有疑问,欢迎交流#include<iostream>
#include<string>
using namespace std
class CStudent{
private:
string stu_name
string stu_no
int stu_score
public:
CStudent(string name, string no, int score){
stu_name = name
stu_no = no
stu_score = score
}
void set_name(string name){stu_name = name}
void set_no(string no){stu_no = no}
void set_score(int score){stu_score = score}
string get_name(){return stu_name}
string get_no(){return stu_no}
int get_score(){return stu_score}
friend void statis_students(CStudent [], int num, int &max_score, int &min_score)
}
void statis_students(CStudent stus[], int num, int &max_score, int &min_score){
max_score = stus[0].stu_score
min_score = stus[0].stu_score
int avg_score = 0,i
for(i = 0 i<num i++){
avg_score+=stus[i].stu_score
if(stus[i].stu_score > max_score){
max_score = stus[i].stu_score
}
if(stus[i].stu_score<min_score){
min_score = stus[i].stu_score
}
}
avg_score/=num
cout<<"Students' name above the average score:"<<endl
for(i = 0 i<num i++){
if(avg_score < stus[i].stu_score){
cout<<stus[i].stu_name<<endl
}
}
}
int main(){
CStudent stus[3] = {CStudent("10", "li", 100),CStudent("11", "wang", 89), CStudent("12", "zhao",70)}
int max_score, min_score
statis_students(stus,3, max_score, min_score)
cout<<"the max score"<<endl
cout<<max_score<<endl
cout<<"the min score"<<endl
cout<<min_score<<endl
return 0
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)