分类:
2008-04-07 10:41:56
Weblogic与Tuexdo之间的调用
5.4 Tuxedo到WebLogic的互操作性... 15
5.5 WebLogic应用访问Tuxedo服务... 15
WEBLOGIC与TUXEDO的调用有三种方式
1.WTC(WEBLOGIC TUXEDO CONNECTOR)
WebLogic Tuxedo Connector 提供 WebLogic Server 应用程序和 Tuxedo 服务之间的互操作性。该连接器允许 WebLogic Server 客户端调用 Tuxedo 服务,并允许 Tuxedo 客户端调用 WebLogic Server Enterprise Java Bean (EJB) 来响应服务请求。
2.JOLT
JOLT只能让WEBLOGIC调用TUXEDO. 但JOLT可以使TUXEDO与WEBSPERE等其他应用服务器相连。
3.CORBA(Common Object Request Broker Architecture)
CORBA是通用对象请求代理体系结构(Common Object Request Broker Architecture) 的英文缩写,这是标准化组织OMG提出的一种实现分布式异构环境下面向对象软件的可重用、可移植、可互操作的体系结构。只要符合CORBA规范的服务器之间都可以互联。
set TUXDIR=C:\bea\tuxedo8.1
set APPDIR=C:\bea\tuxedo8.1\samples\atmi\simpapp
set PATH=%TUXDIR%\bin;%APPDIR%;%PATH%
set TUXCONFIG=%APPDIR%\tuxconfig //编译之后生成的2进制配置文件. Tuxconfig
set BDMCONFIG=%APPDIR%\bdmconfig //编译之后生成的2进制配置文件. Bdmconfig
/* (c) 2003 BEA Systems, Inc. All Rights Reserved. */
/* Copyright (c) 1997 BEA Systems, Inc.
All rights reserved
THIS IS UNPUBLISHED PROPRIETARY
SOURCE CODE OF BEA Systems, Inc.
The copyright notice above does not
evidence any actual or intended
publication of such source code.
*/
/* #ident "@(#) samples/atmi/simpapp/simpserv.c $Revision: 1.5 $" */
#include
#include
#include
#include
/* tpsvrinit is executed when a server is booted, before it begins
processing requests. It is not necessary to have this function.
Also available is tpsvrdone (not used in this example), which is
called at server shutdown time.
*/
#if defined(__STDC__) || defined(__cplusplus)
tpsvrinit(int argc, char *argv[])
#else
tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
/* Some compilers warn if argc and argv aren't used. */
argc = argc;
argv = argv;
/* userlog writes to the central TUXEDO message log */
userlog("Welcome to the simple server");
return(0);
}
/* This function performs the actual service requested by the client.
Its argument is a structure containing among other things a pointer
to the data buffer, and the length of the data buffer.
*/
#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
TOUPPER(TPSVCINFO *rqst)
#else
TOUPPER(rqst)
TPSVCINFO *rqst;
#endif
{
int i;
for(i = 0; i < rqst->len-1; i++)
rqst->data[i] = toupper(rqst->data[i]);
/* Return the transformed buffer to the requestor. */
tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}
是用来调用tuxedo服务器上的TOUPPER服务的客户端。
/* (c) 2003 BEA Systems, Inc. All Rights Reserved. */
/* Copyright (c) 1997 BEA Systems, Inc.
All rights reserved
THIS IS UNPUBLISHED PROPRIETARY
SOURCE CODE OF BEA Systems, Inc.
The copyright notice above does not
evidence any actual or intended
publication of such source code.
*/
/* #ident "@(#) samples/atmi/simpapp/simpcl.c $Revision: 1.5 $" */
#include
#include "atmi.h" /* TUXEDO Header File */
#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
char *sendbuf, *rcvbuf;
long sendlen, rcvlen;
int ret;
if(argc != 2) {
(void) fprintf(stderr, "Usage: simpcl string\n");
return(1);
}
/* Attach to System/T as a Client Process */
if (tpinit((TPINIT *) NULL) == -1) {
(void) fprintf(stderr, "Tpinit failed\n");
return(1);
}
sendlen = strlen(argv[1]);
/* Allocate STRING buffers for the request and the reply */
if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating send buffer\n");
tpterm();
return(1);
}
if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating receive buffer\n");
tpfree(sendbuf);
tpterm();
return(1);
}
(void) strcpy(sendbuf, argv[1]);
/* Request the service TOUPPER, waiting for a reply */
ret = tpcall("TOUPPER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
if(ret == -1) {
(void) fprintf(stderr, "Can't send request to service TOUPPER\n");
(void) fprintf(stderr, "Tperrno = %d\n", tperrno);
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(1);
}
(void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
/* Free Buffers & Detach from System/T */
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(0);
}
是用来调用Weblogic服务器上的TOLOWER服务的客户端。
/* Copyright (c) 2002 BEA Systems, Inc.
All rights reserved
THIS IS UNPUBLISHED PROPRIETARY
SOURCE CODE OF BEA Systems, Inc.
The copyright notice above does not
evidence any actual or intended
publication of such source code.
*/
/* #ident "@(#) apps/simpapp/ tolower.c $Revision: 1.3 $" */
#include
#include "atmi.h" /* TUXEDO Header File */
#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
char *sendbuf, *rcvbuf;
long sendlen, rcvlen;
int ret;
if(argc != 2) {
(void) fprintf(stderr, "Usage: tolower string\n");
return(1);
}
/* Attach to System/T as a Client Process */
if (tpinit((TPINIT *) NULL) == -1) {
(void) fprintf(stderr, "Tpinit failed\n");
return(1);
}
sendlen = strlen(argv[1]);
/* Allocate STRING buffers for the request and the reply */
if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating send buffer\n");
tpterm();
return(1);
}
if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
(void) fprintf(stderr,"Error allocating receive buffer\n");
tpfree(sendbuf);
tpterm();
return(1);
}
(void) strcpy(sendbuf, argv[1]);
/* Request the service TOLOWER, waiting for a reply */
ret = tpcall("TOLOWER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
if(ret == -1) {
(void) fprintf(stderr, "Can't send request to service TOLOWER\n");
(void) fprintf(stderr, "Tperrno = %d\n", tperrno);
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(1);
}
(void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
/* Free Buffers & Detach from System/T */
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(0);
}
*RESOURCES
IPCKEY 123435
DOMAINID simpapp
MASTER SITE1
MODEL SHM
LDBAL N
*MACHINES
"@HOST@"
LMID = SITE1
APPDIR = "@APPDIR@"
TUXCONFIG = "@TUXCONFIG@"
TUXDIR = "@TUXDIR@"
MAXWSCLIENTS = 10
*GROUPS
GROUP1
LMID=SITE1 GRPNO=1 OPENINFO=NONE
GROUP2
LMID=SITE1 GRPNO=2 OPENINFO=NONE
*SERVERS
DEFAULT:
CLOPT="-A"
simpserv SRVGRP=GROUP1 SRVID=1
DMADM SRVGRP=GROUP2 SRVID=1
GWADM SRVGRP=GROUP2 SRVID=2
GWTDOMAIN SRVGRP=GROUP2 SRVID=3
*SERVICES
TOUPPER
tmloadcf –y ubbconfig
*DM_RESOURCES
VERSION=U22
*DM_LOCAL_DOMAINS
TDOM1 GWGRP=GROUP2
TYPE=TDOMAIN
DOMAINID="TDOM1"
BLOCKTIME=20
MAXDATALEN=56
MAXRDOM=89
DMTLOGDEV="@DMTLOGDEV@"
DMTLOGNAME="DMTLOG_TUXDOM"
*DM_REMOTE_DOMAINS
TDOM2 TYPE=TDOMAIN
DOMAINID="TDOM2"
*DM_TDOMAIN
TDOM1 NWADDR="//@TuxedoServerIP@:1234"
TDOM2 NWADDR="//@WebLogicServerIP@:5678"
*DM_REMOTE_SERVICES
TOLOWER RDOM="TDOM2"
dmconfig –y domconfig。