Test Web Gateway用途是能从客户端发多请求测试Web Gateway的性能,例如测试WebService请求的性能,主要用途有:
The Cordys Web gateway is the HTTP interface of Cordys BOP. The Cordys Web Gateway forwards Web requests to and receives responses from service groups. It functions as a bridge between the Web browser and the service groups that operate in Cordys BOP. Gateway is a Java object and is loaded as a Web server object in the Web server. Once it is loaded, the Gateway searches for specific service groups in Cordys BOP and passes the requests back and forth between the service groups and the Web browser.
由于系统使用了支持分布式、多租户的主键关键字,不能使用数据库直接产生,因此,需要通过调用WebService方式生成到数据库中。
打开Workspace工作台,选择对应项目(例如:RJDBXM)下的Web Services文件夹,如下图所示。
找到需要使用的WebService接口,例如:UpdateSmOrganization,选中右键弹出窗口,选中“Test Web Service Operation”,如下图所示:
如下图所示,从“Operation Test Tool”获取SOAP请求(SOAP Request)。
关于SOAP请求XML详见下段内容。
登录Cordys开发平台,在 CUSP > My Applications,点击(Test Web Gateway),打开 The Test Web Gateway 窗口,如下图所示。
如上图所示,执行800次SOAP请求(注:已经人工初始化了200多个部门),在数据中产生800个组织ID,SOAP请求内容如下:
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<UpdateSmOrganization xmlns="http://com.unicom.bopm/organization" reply="yes" commandUpdate="no" preserveSpace="no" batchUpdate="no">
<tuple>
<new>
<SM_ORGANIZATION qAccess="0" qConstraint="0" qInit="0" qValues="">
<ORG_ID></ORG_ID>
<ORG_NAME>GMJT_ZHB</ORG_NAME>
<PARENT_ID>875e3086-6422-11e5-f4ad-14d3e43b5f96</PARENT_ID>
<ORG_CODE>HLJ_01</ORG_CODE>
<TENANT_DN>dn</TENANT_DN>
<ORG_LEVEL>1</ORG_LEVEL>
<IS_COMPANY>0</IS_COMPANY>
<IS_COUNTY>0</IS_COUNTY>
<IS_VIRTUAL_ORG>0</IS_VIRTUAL_ORG>
<IS_TENANT_ROOT>0</IS_TENANT_ROOT>
<SORT_NO>0</SORT_NO>
<STATUS_SIGN>0</STATUS_SIGN>
<CREATE_PERSON>99</CREATE_PERSON>
<DESC_MEMO>0</DESC_MEMO>
</SM_ORGANIZATION>
</new>
</tuple>
</UpdateSmOrganization>
</SOAP:Body>
</SOAP:Envelope>
注:此处只保留操作,用于插入数据操作。
create table TMP_ORG ( DEPTCODE VARCHAR2(40) not null, DEPTNAME VARCHAR2(100), OWNER VARCHAR2(40), DN VARCHAR2(100), DEPTID VARCHAR2(50), OWNERID VARCHAR2(50), BZ1 VARCHAR2(50) );
-- Create/Recreate primary, unique and foreign key constraints
alter table TMP_ORG add constraint PK_TMP_ORG primary key (DEPTCODE);
导入数据操作,略。
详见:《新PaaS平台上线数据初始化经验》.
获取上级组织ID。
update tmp_org t set t.ownerid = (select tt.org_id from sm_organization tt where tt.org_code = t.owner);
由于组织表(sm_organization)与临时数据表间,无直接对应关系,需要编程把临时表中的数据更新到组织表中。
create or replace procedure proc_init_org is --游标,取出临时组织数据 cursor get_org_data is select deptcode,deptname,owner,ownerid from bop_pdt.tmp_org where owner not in ('HLJ','HRB');
v_deptcode bop_pdt.tmp_org.deptcode%type;
v_deptname bop_pdt.tmp_org.deptname%type;
v_owner bop_pdt.tmp_org.owner%type;
v_ownerid bop_pdt.tmp_org.ownerid%type;
v_sqlcode number;
v_sqlmsg varchar2(2000);
begin
v_num := 0;
open get_org_data;
loop
fetch get_org_data
into v_deptcode,v_deptname,v_owner,v_ownerid;
exit when get_org_data%notfound;
update bop_pdt.sm_organization
set org_code = v_deptcode,
org_name = v_deptname,
parent_id = v_ownerid,
tenant_dn = 'o='||v_owner||',cn=cordys,cn=defaultInst,o=hlcuc.com'
where org_code = 'GMJT_ZHB' and create_person = '99' and rownum = 1;
end loop;
commit;
close get_org_data;
exception
when others then
v_sqlcode := sqlcode;
v_sqlmsg := substr(sqlerrm, 1, 2000);
dbms_output.put_line(v_sqlcode || '::' || v_sqlmsg);
end proc_init_org;
通过PL/SQL工具执行存储过程。
选择需要执行的存储过程“proc_init_org”,右键选择“Test”。
打开测试存储过程(Test script)窗口,点击“齿轮”图标来执行存储过程。
稍后,查询sm_organization表,确认组织数据导入完整。