【正文】
().send(OUT_PORT,message)。//mit the transaction()。處理異常public class ChannelListener implements MessageListener{public ChannelListener(ChatService ownerService){//initialize Listener}public void onMessage (Message message){//Code for handling the message}}12終結(jié)時(shí)關(guān)閉服務(wù)public void onClose()throws TifosiException{//destroy resources held by Tifosi layer first.//()。//dispose UI Frames and destroy all other local memory//stores for this service.//()。8 附件 3. C/C++ 接口組件開(kāi)發(fā)標(biāo)準(zhǔn)C/C++開(kāi)發(fā)服務(wù)組件的基本步驟:登錄節(jié)點(diǎn)服務(wù)器創(chuàng)建 sessions 處理異常在輸入口接收消息送消息到輸出口處理結(jié)束請(qǐng)求引用 FioranoESB Header 文件include初始化服務(wù)組件創(chuàng)建一個(gè) Launch Info 對(duì)象和設(shè)置它成員的值LaunchInfo info = newLaunchInfo()。/*Assuming the following as variables declared already:mqstring strSrvInstName。mqstring strAppInstName。mqstring strURL。mqstring strUserName。mqstring strPasswd。mqboolean isManuallaunch。Following functions should ne invoked to set the member fieldsof LaunchInfo object:*//*Set Business Service Instance Name*/LINFO_setServInstName(info, strSrvInstName)。/*Set Event Process Name*/13LINFO_setAppInstName(info, strAppInstName)。/*Set URL of Tifosi Peer Server with which to make connection*/LINFO_setPrimaryURL(info, strURL)。/*Set User Name*/LINFO_setUserName(info, strUserName)。/*Set Password Name*/LINFO_setPassword(info, strPasswd)。/*Set the isManualLaunch field*/LINFO_setIsManualLaunch(info, isManuallaunch)。/*Allocate memory for variable info*/info = newLaunchInfo()。if (MqExceptionOccurred ()){MqPrintException ()。return 0。}/*Parse the mandline arguments argv[1] and set thefields of LaunchInfo object*/LINFO_getLaunchInfo(info, argv[1])。if (MqExceptionOccurred ()){LINFO_free(info)。return 0。}創(chuàng)建一個(gè)服務(wù)組件對(duì)象tifSrv = newTifosiService()。if (MqExceptionOccurred ())return FALSE。連接節(jié)點(diǎn)服務(wù)器ServiceRuntimeArgs args。args = TIFSRV_connect(tifSrv, info)。if (args == NULL)/*Implies failure of connect call*/return FALSE。處理 runtime 參數(shù)void loadruntimeArgs(ServiceRuntimeArgs args){HashtableEnumerator hashOfArgs。Argument argument。mqstring argName。mqstring argValue。/*This is to store runtime parameter DISPLAY_NAME*/mqstring m_displayName。/*Obtain object of HashtableEnumerator from object of ServiceRuntimeArgs*/14hashOfArgs = SRVRUNTA_getArguments(args)。while (HTE_HasMoreElements(hashOfArgs)){/*Obtain object of Argument*/argument = (Argument)HTE_NextValueElement(hashOfArgs)。if (argument != NULL){/*Obtain value of Name field of Argument object*/argName = ARG_getName(argument)。/*Obtain value of Value field of Argument object*/argValue = ARG_getValue(argument)。if (strcmp(argName, DISPLAY_NAME)==0)m_displayName = argValue。printf(Value of Runtime Argument DISPLAY_NAME =%s\n, m_displayName)。}}if (hashOfArgs != NULL)HTE_Clear(hashOfArgs)。}創(chuàng)建用戶 Sessions TifosiSession session。session = TIFSRV_createSession(tifSrv, FALSE)。if (session == NULL)return FALSE。/*NULL is obtained if the call fails for somereson*/在輸入口上設(shè)置通道監(jiān)聽(tīng)者Setting up a channel listener on the input Event Portvoid listener(TifosiDocument doc)。flag = TIFSESS_addChannelListener(session, IN_PORT, amp。listener)。if (flag == FALSE){/*Print the exception occurred*/MqPrintException ()。}實(shí)現(xiàn)回叫函數(shù)/*** This is callback function to be invoked as soon as somemessage is* received on IN_PORT of this service. This function writesthe received* message on the output port.*/void listener(TifosiDocument doc){15mqstring message = NULL。mqboolean flag = FALSE。/*Extract the value of text feild of received document*/message = TIFDOC_getText(doc)。printf(Received message::%s\n, message)。/*Send the TifosiDocument object to the output port*/flag = TIFSESS_send(session, OUT_PORT, doc)。if (flag == FALSE){/*Print the exception occurred*/MqPrintException ()。/*Free the TifosiService object*/TIFSRV_free(tifSrv)。exit(0)。}/*Free the TifosiDocument object*/TIFDOC_free(doc)。flag = TIFSESS_send(session, OUT_PORT, doc)。設(shè)置異常處理/*Set ExceptionLietener*/flag = TIFSRV_setExceptionListener(tifSrv, amp。exceptionListener,NULL)。if (flag == FALSE){/*Print the exception occurred*/MqPrintException ()。}實(shí)現(xiàn)異常監(jiān)聽(tīng)者void exceptionListener(mqstring exception, void* pParam){mqboolean flag = FALSE。printf(Exception Occurred:%s\n, exception)。/*Free the TifosiService object*/TIFSRV_free(tifSrv)。exit(0)。}設(shè)置關(guān)閉監(jiān)聽(tīng)者void shutdownListener(void* pParam)。/*Set onShutdownLietener*/flag = TIFSRV_setOnShutdownListener(tifSrv, amp。shutdownListener,NULL)。if (flag == FALSE){16/*Print the exception occurred*/MqPrintException ()。}實(shí)現(xiàn)關(guān)閉監(jiān)聽(tīng)者void shutdownListener(void* pParam){mqboolean flag = FALSE。printf(Service has been stopped from the Tifosi EventProcess Composer Tool\n)。/*Free the TifosiService object*/TIFSRV_free(tifSrv)。exit(0)。}啟動(dòng)連接/*Register the service with the TPS and start for thetransactions.*/flag = TIFSRV_startConnection(tifSrv)。if (flag == FALSE)return FALSE。關(guān)閉連接void closeConnection (){/*Close the connection*/TIFSRV_onClose (tifSrv)。/*Free the TifosiService object*/TIFSRV_free(tifSrv)。9 附件 4. Web Services 接口的 WSDL 文件下面給出的是用 WSGateway 組件接口進(jìn)行文件交換的 WSDL 文件。 請(qǐng)求輸入?yún)?shù)有:文件目錄名、文件名、發(fā)送方、接收方等。 ?xml version= encoding=UTF8 ? wsdl:definitions targetNamespace=iletrans xmlns:apachesoap= xmlns:impl=ns xmlns:intf=17s xmlns:tns1= xmlns:wsdl= xmlns:wsdlsoap= xmlns:xsd= ! WSDL created by Apache Axis version: Built on Mar 31, 2022 (12:47:03 EST) wsdl:types fns:schema xmlns:fns= elementFormDefault=unqualified targetNamespace= xmlns= xmlns:fns1= xmlns:tns= xmlns:xsd= fns:element name=executeFESBRequest fns:plexType fns:sequence fns:element ref=fns1:Record / /fns:sequence /fns:plexType /fns:element xsd:element name=Record type=tns:Record /