JCO SERVER CONNECTION使用说明

JCo(Sap Java Connect 2010-01-09 22:03:02 阅读66 评论0   字号:大小 订阅

1.    Jco Server  Connection实现要点

1)       Implement the JCoServerFunctionHandler and the coding to be executed when the call is received.

2)       Create an instance for your JCoServer implementation and start it with start().

1.1. 建立与sap端的连接

static

{

Properties connectProperties = new Properties();

connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "10.52.41.3");

connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "02");

connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");

connectProperties.setProperty(DestinationDataProvider.JCO_USER, "CRCTEST");

connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "12345678");

connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");

createDataFile(DESTINATION_NAME1, "jcoDestination", connectProperties);

connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");

connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");

createDataFile(DESTINATION_NAME2, "jcoDestination", connectProperties);

Properties servertProperties = new Properties();

servertProperties.setProperty(ServerDataProvider.JCO_GWHOST, "10.52.41.3");

servertProperties.setProperty(ServerDataProvider.JCO_GWSERV, "3302");

servertProperties.setProperty(ServerDataProvider.JCO_PROGID, "JCODEMO");

servertProperties.setProperty(ServerDataProvider.JCO_REP_DEST, "ABAP_AS_WITH_POOL");

servertProperties.setProperty(ServerDataProvider.JCO_CONNECTION_COUNT, "2");

createDataFile(SERVER_NAME1, "jcoServer", servertProperties);

}

其中ServerDataProvider.JCO_GWHOST 设置的是server端的ip地址,ServerDataProvider.JCO_GWSERV设置的是sap端的端口号。

1.2. StfcConnectionHandle类处理RFC

StfcConnectionHandle类继承JCoServerFunctionHandle接口,并重写了handleRequest(JCoServerContext serverCtx,JCoFunction function)方法。

New 一个DefaultServerHandlerFactory.FunctionHandlerFactory 对象,使用registerHandler(Function Name,stfcConnectionHandler)方法,前面一个参数是sap端所要调用的函数,后面一个参数是StfcConnectionHandler类的一个实例。

然后使用server name的setCallHandlerFactory(DefaultServerHandlerFactory.FunctionHandlerFactory factory)方法,就可以用server.start()了。

补充handleRequest(JCoServerContext serverCtx,JCoFunction function)功能:

function.getImportParameterList()用来获取sap call Function 传递过来的exporting参数。

function.getExportParameterList().setValue()用来设置importing参数。

1.3. Simple Server Connection 、With Exception Listener Server Connection 和 tRFC Server Connection

1.3.1.    With Exception Server Connection 在Simple Server Connection 的基础上,register Listener Class.

MyThrowableListener eListener = new MyThrowableListener();

server.addServerErrorListener(eListener);

server.addServerExceptionListener(eListener);

MyThrowableListener 继承JCoServerErrorListener 和JCoServerExceptionListener 两个接口,重写了serverErrorOccurred() 和serverExceptionOccurred()方法。

1.3.2.    tRFC Server Connection 在Simple Server Connection的基础上,通过TIDHandler实现事务型Connection。

myTIDHandler = new MyTIDHandler();

server.setTIDHandler(myTIDHandler);

MyTIDHandler类继承JCoServerTIDHandler 接口,重写了checkTID(),commit(),rollback(),confirmTID(),execute()方法。

使用了一个HashTable存储status(CREATED, EXECUTED, COMMITTED, ROLLED_BACK, CONFIRMED ),TIDState state = availableTIDs.get(tid)。如果status为null,则改变为CREATED,返回TRUE;如果status为CREATED或者ROLLED_BACK,则返回TRUE,其他返回FALSE。

JCO SERVER CONNECTION相关推荐

  1. Navicat客户端PostgreSQL连接报错:Could not connect to server:Connection refused(0x00002740/10061)

    Navicat客户端PostgreSQL连接报错:Could not connect to server:Connection refused(0x00002740/10061) 遇到这样的问题应该怎 ...

  2. Spring Boot 发送邮件时,出现 Mail server connection failed 异常问题

    问题描述:在使用 SpringBoot 的邮件发送组件功能,发送邮件时,本地环境能够发送成功,但部署到 腾讯云服务器后,却发送失败,报错 org.springframework.mail.MailSe ...

  3. could not connect to server: Connection timed out (Ox0000274C/10060)ls the server running on host “

    PostgreSQL安装后Navicat客户端连接报错如下: 主要注意两个方面:是否开启了远程访问.是否开启了防火墙或配置了防火墙白名单. 检查是否开启了远程访问 1.修改/var/lib/pgsql ...

  4. DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (xxx.xxx.com)\n 报错解决

    背景 在windows上使用pymssql连接SQLServer数据库是正常的,但是在linux服务器上使用pymssql连接SQLServer数据库的时候报了下面这个错误: File "/ ...

  5. spring boot 使用 javax.mail发送邮件常见错误Authentication failed、Mail server connection failed

    最近做系统内审批业务,需要发送邮件,在本地使用公司邮箱测试时,是没有问题的,没有使用发件服务器验证: 项目使用的是spring boot 2.x; 初始配置文件: spring:mail:host: ...

  6. PostgreSQL连接报错:could not connect to server: Connection refused (0x0000274D/10061)

    问题描述: Win10系统更新后,启动项目,显示拒绝连接.之后打开pgAdmin登录操作,但失败了!并显示错误信息. could not connect to server: Connection r ...

  7. paramiko.ssh_exception.SSHException: Server connection dropped

    pip install shutilwhich # 旧方法下载大文件会出现Server connection dropped # self.sftp.get(server_path, local_pa ...

  8. 转载:有关SQL server connection Keep Alive 的FAQ(3)

    转载:http://blogs.msdn.com/b/apgcdsd/archive/2012/06/07/sql-server-connection-keep-alive-faq-3.aspx 这个 ...

  9. 有关SQL server connection Keep Alive 的FAQ(3)

    这个是SQL Server Keep Alive FAQ文章的最后一篇. 问题1:为什么我在客户端设置了KeepAlive值,但是我使用SQL server management studio 测试的 ...

最新文章

  1. PHP 错误抛出及自定义处理
  2. Apache Web服务器访问控制机制全解析
  3. 如何找出R中加载的软件包版本?
  4. Python之函数的收集参数和分配参数用法(‘*’ 和 ‘**’)
  5. 华为mate10pro测试软件,华为Mate10和华为Mate10Pro的区别在哪里?华为Mate10和华为Mate10Pro对比测评告诉你(附全文)...
  6. vs调用css写的c语言程序,c语言文件读写实例
  7. 汇率兑换 双向兑换_常出国的你一定要看:如何兑换外币最省钱?
  8. Oracle(plsql)数据导入导出
  9. JAVA代码生成器源码-基于SSM架构
  10. VSCode通过源代码管理插件GitLens提交项目代码的过程
  11. php爬取房源,Python 爬虫 链家二手房(自行输入城市爬取)
  12. 计算机系统概论输入输出,计算机系统概论笔记-4-冯·诺依曼模型
  13. python期权价格计算器_GitHub - ttfcfc/Options-Calculator: 期权价格计算器——金融工程第二次展示...
  14. 茅台酒养成记:质量是对消费者最长久而衷心的承诺
  15. Hugging face 的入门使用
  16. 幂律分布(python)
  17. Linux系统安全以及应用
  18. 管理学定律六:马太效应与鸟笼逻辑
  19. mmdetection运行demo出现 no attribute ‘__version__‘
  20. 关于“Guice ”

热门文章

  1. Python-matplotlib实现多条曲线画在一张图上
  2. 华为安卓设备点击返回键直接回到桌面的问题的解决
  3. JS实现一键复制功能
  4. 2013年6月9日 20:39:59
  5. 【AC梦工厂】最大流hdu1532模版题
  6. c语言支持虚函数,C语言多态虚函数.doc
  7. Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) a
  8. 力扣:爬楼梯(假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?)
  9. 弘辽科技:商家不要错过的淘宝直播妙招!
  10. RS232串口通信(UART的接收部分)