Chinaunix首页 | 论坛 | 博客
  • 博客访问: 318337
  • 博文数量: 50
  • 博客积分: 3095
  • 博客等级: 中校
  • 技术积分: 510
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-22 10:43
文章分类

全部博文(50)

文章存档

2014年(1)

2012年(1)

2011年(2)

2010年(3)

2009年(6)

2008年(20)

2007年(15)

2006年(2)

我的朋友

分类:

2008-04-07 10:41:56

WeblogicTuexdo之间的调用

 (部分文件源码引用自BEA官方文档)

 

1调用方式... 2

2 Tuxedo的配置... 2

2.1设置环境变量: 2

2.2编写Tuxedo服务(atmi) 2

2.3编写Tuxedo客户端(atmi) 4

2.3.1 simpcl.c文件... 4

2.3.1 tolower.c文件... 5

2.4配置ubbconfig文件... 7

2.5编译ubbconfig文件... 7

2.6配置domconfig文件... 8

2.7编译domconfig文件... 8

3 EJB程序开发... 8

3.1编写WeblogicEJB.java. 8

3.2配置ejb-jar.xml 10

3.3配置weblogic-ejb-jar.xml 11

3.4 EJB程序打包成JAR. 11

4 WTC的配置... 11

4.1 EJB发布到weblogic. 11

4.2创建WTC服务... 12

4.3创建本地Tuxedo访问点... 12

4.4创建远程Tuxedo访问点... 13

4.5创建已导出的服务... 13

4.6创建已导入的服务... 13

4.7mySimpapp指向adminServer 14

4.8TDOM1注册为WebLogic用户... 14

5测试通信... 14

5.1生成服务端... 14

5.2生成产客户端... 14

5.3引导Tuxedo... 14

5.4 TuxedoWebLogic的互操作性... 15

5.5 WebLogic应用访问Tuxedo服务... 15

5.5.1编写TuxedoClient.java. 15

5.5.2编写tuxedo.jsp. 16

 

 

 

 

 

 

 

调用方式

WEBLOGICTUXEDO的调用有三种方式
1
WTC(WEBLOGIC TUXEDO CONNECTOR)

WebLogic Tuxedo Connector 提供 WebLogic Server 应用程序和 Tuxedo 服务之间的互操作性。该连接器允许 WebLogic Server 客户端调用 Tuxedo 服务,并允许 Tuxedo 客户端调用 WebLogic Server Enterprise Java Bean (EJB) 来响应服务请求。

2JOLT

JOLT只能让WEBLOGIC调用TUXEDO. JOLT可以使TUXEDOWEBSPERE等其他应用服务器相连。

3CORBA(Common Object Request Broker Architecture)

CORBA是通用对象请求代理体系结构(Common Object Request Broker Architecture) 的英文缩写,这是标准化组织OMG提出的一种实现分布式异构环境下面向对象软件的可重用、可移植、可互操作的体系结构。只要符合CORBA规范的服务器之间都可以互联。

Tuxedo的配置

设置环境变量:

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

编写Tuxedo服务(atmi)

/*    (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    /* TUXEDO Header File */

#include      /* TUXEDO Header File */

/* 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客户端(atmi)

文件

是用来调用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);

}

配置ubbconfig文件

*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

编译ubbconfig文件

tmloadcf –y ubbconfig

配置domconfig文件

*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"

编译domconfig文件

dmconfig –y domconfig

阅读(7101) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-10-14 00:45:11

tuxedo.jsp文件的第一行多了个mytuxedo是干嘛的呀