java如何调用com组件,最好给出代码
我最近在写一个接口,对方是用com组件的,但是我不懂怎么用Java写,请求大神们给出方法。
属性 值
App ID
Type Library ID
Program ID yinhai.gg.interface
COM ClassName COClass_n_yh_interface
COM ClassID
Interface Type Dual Interface
Interface Name In_yh_interface
Interface ID
交易接口函数描述
yh_interface_init
原型定义:
yh_interface_init(
ref integer aint_appcode,
ref string astr_appmsg)
函数说明:
初始化函数,HIS应用启动时调用,进行医保交易处理初始化,本交易调用成功后才能进行其他交易处理。,不要在yh_interface_call调用之前重复初始化。
yh_interface_destroy
原型定义:
yh_interface_destroy()
函数说明:
资源释放函数,在HIS应用退出时调用。
yh_interface_call
原型定义:
yh_interface_call(
string astr_jybh,
string astr_jysr_xml,
ref string astr_jylsh,
ref string astr_jyyzm,
ref string astr_jysc_xml,
ref long aint_appcode,
ref string astr_appmsg)
原型定义:
yh_interface_cancel (
string astr_jylsh,
ref long aint_appcode,
ref string astr_appmsg)
原型定义:
yh_interface_confirm(
string astr_jylsh,
string astr_jyyzm,
ref long aint_appcode,
ref string astr_appmsg)
delphi调用
注意:delphi调用时先要 uses ComObj;否则不能引用oleobject。
Var
yinhaiobject: Variant; //定义存放引用对象的变量。
BusinessID: String;
Dataxml : String;
Businesssequence: String;
Businessvalidate: String;
Outputxml: String;
Appcode: integer;
Appmsg: String;
Begin
try
yinhaiobject := CreateOleObject('yinhai.gg.interface');
BusinessID:= '01';
yinhaiobject.yh_interface_init (Appcode,Appmsg) ;
yinhaiobject.yh_interface_call(BusinessID ,Dataxml ,Businesssequence,Businessvalidate,Outputxml,Appcode,Appmsg)
//返回结果判断,HIS内部处理
finally
yinhaiobject:=Unassigned;// 关闭对象
end;
End;
以上是delphi的调用代码,那么用java的话可以怎么实现呢?