OSB(Oracle Service Bus)安装配置手册_第1页
OSB(Oracle Service Bus)安装配置手册_第2页
OSB(Oracle Service Bus)安装配置手册_第3页
OSB(Oracle Service Bus)安装配置手册_第4页
OSB(Oracle Service Bus)安装配置手册_第5页
已阅读5页,还剩65页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Oracle Service Bus安装配置手册目 录1Oracle Service Bus 安装42Oracle Service Bus域配置113开发环境准备163.1Server配置163.2建立Oracle Service Bus 配置项目及项目173.3建立记Log的Java项目203.4配置WebLogic Server的连接池(记Log要用)223.5配置Queue(对帐交易中用到)233.6建立对Socket Transport的支持293.7电子支付平台与码头接口配置344接口说明414.1接口需求文档414.2Oracle Service Bus接口描述415服务配置过程及

2、测试425.1工行实时扣费及划帐服务配置(ICBCServices)425.2工行对帐服务配置(BatchServices)615.3电子支付平台到码头服务配置(SCTService)646使用和对接711 Oracle Service Bus 安装点击osb103_weblogic103_win32.exe建立BEA Home选择Custom方式,并选择所有选择安装JDK2 Oracle Service Bus域配置启动配置向导configuration wizard(program-Oracle WebLogic-WebLogic Server 10gr3-Tools-Configurat

3、ion Wizard)选择Create a new WebLogic domain,然后Next选择Workshop for WebLogic10.3和Oracle Service Bus,然后Next输入WebLogic管理控制台用户名密码(weblogic/weblogic),然后Next选择域的运行模式,缺省开发模式,然后选择相应的JDK,然后Next选择Next输入域名称和所在目录,选择Create,直到完成,选择DoneOracle Service Bus的域配置完成.3 开发环境准备3.1 Server配置打开workshop(Program - Oracle WebLogic -

4、 Workshop for WebLogic 10gr3),在Servers的视图中选择新建选择Oracle WebLogic Server v10.3,然后Next配置域路径直到出现配置server过程完成3.2 建立Oracle Service Bus 配置项目及项目选择File-New-Oracle Service Bus Configuration Project输入项目名,比如EPSProject1选择EPSProject1,右键建立Oracle Service Bus项目输入项目名称,然后Finish在新建立的Oracle Service Bus项目下如图建立以下目录(Folder

5、),分别是BusinessServices,ProxyServices,ServiceAccount,Tranformation,WSDL,Jar分别作为以下用途BusinesssServices:用于存放定义的Business Services,接入后端服务ProxyServices:用于定义Proxy Services,提供前端调用接口ServiceAccount:用于定义ftp的访问需要的用户名密码Transformation:用于存放和定义在过程中发生的数据转换WSDL:用于存放WSDL文件Jar:用于Java Callout,主要是通过Java Callout方式来记日志3.3 建立

6、记Log的Java项目n 首先先在数据库表中建立osblog表Create table osblog(Transno varchar(20),Message varchar(200),Transdate date);n 在WebLogic console中建立到数据库的连接池,JNDI设置为XEn 建立Java Project,注意在build路径下加入weblogic.jarn 先建立一个osbutility的package,然后新建OsbLogMessage类,代码如下:package osbutility;import java.sql.Connection;import java.sq

7、l.SQLException;import java.sql.Statement;import java.util.*;import javax.naming.Context;import javax.naming.InitialContext;public class OsbLogMessage /* * param args */*public static void main(String args) / TODO Auto-generated method stub*/public static boolean log(String transno,String mess) Conne

8、ction con = null; Statement stmt = null; int val = 1;try Context ctx = null; Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY,weblogic.jndi.WLInitialContextFactory); ht.put(Context.PROVIDER_URL,t3:/localhost:7001); ht.put(Context.SECURITY_PRINCIPAL, weblogic); ht.put(Context.SE

9、CURITY_CREDENTIALS, weblogic); ctx = new InitialContext(ht); javax.sql.DataSource ds= (javax.sql.DataSource) ctx.lookup(XE); con = ds.getConnection(); String sql = insert into osblog values(+transno+,+mess+,sysdate); System.out.println(sql); stmt = con.createStatement(); val = stmt.executeUpdate(sql

10、); catch (Exception e) System.out.println(e.getMessage(); finally try if (stmt != null) stmt.close(); if (con != null) con.close(); catch (SQLException e) System.out.println(e.toString(); if (val != 0) return false; return true;3.4 配置WebLogic Server的连接池(记Log要用)打开WebLogic Server管理控制台http:/localhost:7

11、001/console新建Services-JDBC-DataSource其他选择缺省设置,并且设置用户名密码,测试通过部署到AdminServer就可3.5 配置Queue(对帐交易中用到)1) 选择Services-Messaging-JMS Modules,建立CHModule选择部署到AdminServer2) 新建JMS Servers同时部署到AdminServer3) 在CHModule中建立ConnectionFactory4) 然后新建Queue5) 选择新建Subdeployment如图完成3.6 建立对Socket Transport的支持1) 先在cmd下转到需要部署的

12、Oracle Service Bus domain目录(如E:beauser_projectsdomainsCH_domainbin),运行SetDomainEnv.cmd2) 在cmd下转到相应的Socket Transport的安装目录(如E:beaosb_10.3samplesservicebussample-transport),修改在E:beaosb_10.3samplesservicebussample-transportsrccombeaalsbtransportssock中的SocketTransportUIBinding.java,主要修改方法为: (蓝色)public bo

13、olean isServiceTypeSupported(BindingTypeInfo bindingType) return true; /* try BindingTypeInfo.BindingTypeEnum type = bindingType.getType(); if (type.equals(BindingTypeInfo.BindingTypeEnum.MIXED) BindingTypeInfo.MessageTypeEnum responseMessageType = bindingType.getResponseMessageType(); if (responseM

14、essageType != null) if (!( BindingTypeInfo.MessageTypeEnum.TEXT.equals(responseMessageType) | BindingTypeInfo.MessageTypeEnum.XML .equals(responseMessageType) return false; BindingTypeInfo.MessageTypeEnum requestMessageType = bindingType.getRequestMessageType(); if (requestMessageType != null) retur

15、n BindingTypeInfo.MessageTypeEnum.TEXT.equals(requestMessageType) | BindingTypeInfo.MessageTypeEnum.XML.equals(requestMessageType); else return false; return type.equals(BindingTypeInfo.BindingTypeEnum.ABSTRACT_XML) | type.equals(BindingTypeInfo.BindingTypeEnum.XML); catch (TransportException e) Soc

16、ketTransportUtil.logger.error(e.getLocalizedMessage(), e); return false; */ 3) 修改SocketOutBoundMessageContext.javaRun方法主要决定如何处理从后端系统的返回,修改的部分如蓝色public void run() try / if the end-point is one-way, dont read the response. if (!epc.getRequestResponse() SocketTransportMessagesLogger.oneWayEndpoint(); l

17、istener.onReceiveResponse(SocketOutboundMessageContext.this); return; String resEnc = getResponseEncoding(); responseMetadata = new SocketResponseMetaData(resEnc); InetAddress inetAddress = clientSocket.getInetAddress(); responseMetadata.setEndPointHost(inetAddress.getHostName(); responseMetadata.se

18、tEndPointIP(inetAddress.getHostAddress(); / Reading the response from the external service. InputStream inputStream = clientSocket.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream, resEnc); int i = -1; StringBuilder sb = new StringBuilder(); char buff = new c

19、har512; while (true) i = inputStreamReader.read(buff); if (i = -1) break; sb.append(buff, 0, i); /* if it ends with double CRLF, come out. We can read the content * after rnrn becuase we are expecting only one message per * connection i.e we are closing the connection after processing a * single mes

20、sage. */ if (i = sb.indexOf(SocketTransportUtil.FIN_FLAG) != -1) break; if (i != -1) / strip rnrn from the message. String msg = sb.substring(0, i+2); responseIS = new ByteArrayInputStream(msg.getBytes(resEnc); listener.onReceiveResponse(SocketOutboundMessageContext.this); else / Message format is w

21、rong, it should end with rnrn listener.onError(SocketOutboundMessageContext.this, TransportManager.TRANSPORT_ERROR_GENERIC, SocketTransportMessagesLogger.invalidMessage(); catch (IOException e) SocketTransportUtil.logger.error(e.getLocalizedMessage(), e); listener.onError(SocketOutboundMessageContex

22、t.this, TransportManager.TRANSPORT_ERROR_GENERIC, e.getLocalizedMessage(); catch (TransportException trex) SocketTransportUtil.logger.error(trex.getLocalizedMessage(), trex); listener.onError(SocketOutboundMessageContext.this, TransportManager.TRANSPORT_ERROR_GENERIC, trex.getLocalizedMessage(); fin

23、ally try clientSocket.close(); catch (IOException e) SocketTransportUtil.logger.error(e.getLocalizedMessage(), e); 4) Send则决定如何把信息从OSB发给后端系统,改动部分如蓝色:public void send(final TransportSendListener listener) throws TransportException String address = options.getURI().toString(); try String host = null;

24、int port = 0; try URI uri = new URI(address); host = uri.getHost(); port = uri.getPort(); catch (URISyntaxException e) new TransportException(e.getMessage(), e); SocketTransportMessagesLogger.ipAddress(host, port); final Socket clientSocket = new Socket(host, port); SocketEndpointConfiguration socke

25、tEndpointConfiguration = SocketTransportUtil.getConfig(config); SocketOutboundPropertiesType outboundProperties = socketEndpointConfiguration.getOutboundProperties(); clientSocket.setTcpNoDelay(!outboundProperties.getEnableNagleAlgorithm(); clientSocket.setSoTimeout(outboundProperties.getTimeout();

26、String reqEnc = socketEndpointConfiguration.getRequestEncoding(); if (reqEnc = null) reqEnc = utf-8; / Send the message to the external service. OutputStream outputStream = clientSocket.getOutputStream(); TransformOptions transformOptions = new TransformOptions(); transformOptions.setCharacterEncodi

27、ng(reqEnc); sender.getPayload().writeTo(outputStream, transformOptions); /outputStream.write(SocketTransportUtil.D_CRLF.getBytes(reqEnc); outputStream.flush(); SocketTransportMessagesLogger.flushed(); PipelineAcknowledgementTask task = new PipelineAcknowledgementTask(listener, clientSocket, socketEn

28、dpointConfiguration); TransportManagerHelper .schedule(task, socketEndpointConfiguration.getDispatchPolicy(); catch (UnknownHostException e) SocketTransportUtil.logger.error(e.getLocalizedMessage(); throw new TransportException(e.getMessage(), e); catch (IOException e) SocketTransportUtil.logger.err

29、or(e.getLocalizedMessage(); throw new TransportException(e.getMessage(), e); catch (TransformException e) SocketTransportUtil.logger.error(e.getLocalizedMessage(); throw new TransportException(e.getMessage(), e); catch (TransportException e) SocketTransportUtil.logger.error(e.getLocalizedMessage();

30、throw e; 5) 转到相应的Socket Transport的安装目录(如E:beaosb_10.3samplesservicebussample-transport),运行ant clean6) 运行ant build-jar7) 运行ant deploy3.7 电子支付平台与码头接口配置i. 在Weblogic Workshop中创建一个支持XMLBean的Web Service Projectii. 在项目底下的“Schema”文件夹中新建一个Schema:iii. 编辑该Schema文件,将接口中需要用到的数据结构定义在该Schema文件中: iv. 在“src”文件夹下创建包及

31、Web Service:v. 在”InterfaceSCT.java”文件中实现与码头的接口:package ;import javax.jws.*;import org.example.serviceIntegrateSchema.*;WebServicepublic class InterfaceSCT /接口A paySuccessInfoWebMethodpublic void paySuccessInfo(String bankId,String feebillNo,PaySuccessInfoDocument bill_list) PaySuccessInfoList psil =

32、 bill_list.getPaySuccessInfo();int len = psil.getPaySuccessInfoElmList().size();for(int i = 0;ilen;i+)PaySuccessInfoType ps = psil.getPaySuccessInfoElmList().get(i);System.out.println(this is broker+i+:+ps.getBROKER();System.out.println(this is length of containernos: +ps.getCNTRNOLIST().sizeOfCNTRN

33、OArray();/接口B dayAccountWebMethodpublic DayTotalMoneyDocument dayAccount(long startdate,long enddate) DayTotalMoneyDocument dtm = DayTotalMoneyDocument.Factory.newInstance();DayTotalMoneyType dtmt = dtm.addNewDayTotalMoney();dtmt.setDayTotalMoney(1000000);return dtm;/接口C BillPayStatusWebMethodpublic BillPayStatusReturnDocument getBillPayStatus(BillPayStatusInputDocument bill_list,String iotype) BillPayStatusReturnDocument bpsr = BillPayStatusReturnDocument.Factory.newInstance();BillPayStatusInputLis

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论