一、配置文件
二、 代码
# (c) 2003 BEA Systems, Inc. All Rights Reserved.
#ident "@(#) samples/atmi/simpapp/ubbsimple $Revision: 1.5 $"
#Skeleton UBBCONFIG file for the TUXEDO Simple Application.
#Replace the <bracketed> items with the appropriate values.
*RESOURCES
IPCKEY 123456
#Example:
#IPCKEY 123456
DOMAINID simpapp
MASTER simple
MAXACCESSERS 10
MAXSERVERS 5
MAXSERVICES 10
MODEL SHM
LDBAL N
*MACHINES
DEFAULT:
APPDIR="D:\temp"
TUXCONFIG="D:\temp\tuxconfig"
TUXDIR="C:\bea\tuxedo8.1"
#Example:
# APPDIR="/home/me/simpapp"
# TUXCONFIG="/home/me/simpapp/tuxconfig"
# TUXDIR="/usr/tuxedo"
WANGZHIPC LMID=simple
MAXWSCLIENTS=5
ULOGPFX="D:\temp\ULOG"
#Example:
#beatux LMID=simple
*GROUPS
GROUP1
LMID=simple GRPNO=1 OPENINFO=NONE
#GROUP2
# LMID=simple GRPNO=2 OPENINFO=NONE
*SERVERS
DEFAULT:
CLOPT="-A"
simpserv SRVGRP=GROUP1 SRVID=1
WSL SRVGRP=GROUP1 SRVID=2 CLOPT="-A -- -n //127.0.0.1:3050 -m2 -M5 -x10"
*SERVICES
TOUPPER
二、 代码
/************************************************************
Copyright (C), 2001-2008, Multimedia Vision. Co., Ltd.
FileName: ConvertMess.cpp
Author: Wangzhi
Date: 2008-01-10
Description:
Tuxedo 测试,基于simple app 修改,C++ Builder 6
Version:
Function List:
History:
<author> <time> <version> <desc>
Wangzhi 2008/1/10 1.0 build this moudle
***********************************************************/
#include <vcl.h>
#include <atmi.h> /* TUXEDO Header File */
#include <fml32.h> /* TUXEDO Header File */
#include <tmenv.h> /* TUXEDO Header File */
#pragma hdrstop
#include "ConvertMess.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TConvertMessForm *ConvertMessForm;
//---------------------------------------------------------------------------
__fastcall TConvertMessForm::TConvertMessForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TConvertMessForm::butConvertClick(TObject *Sender)
{
char* sendBuffer; // 发送数据缓冲区
char* recvBuffer; // 接收数据缓冲区
long sendBufLength; // 发送数据长度
long recvBufLength; // 接收数据长度
int iRet; // 返回码
ShowErrorMessage("Werrer");
// 设置环境变量
tuxputenv("WSNADDR=//127.0.0.1:3050");
// 连接系统
if( -1 == tpinit((TPINIT *) NULL) )
{
ShowErrorMessage(tpstrerror(tperrno));
return;
}
// 计算发送缓冲长度
sendBufLength = strlen(txtMess->Text.c_str());
// 分配发送数据缓冲内存
sendBuffer = (char *) tpalloc("STRING", NULL, sendBufLength + 1);
if( NULL == sendBuffer) {
ShowErrorMessage("Alloc Send Buffer Memory Failed!!");
tpterm();
return;
}
// 分配接收数据缓冲内存
recvBuffer = (char *) tpalloc("STRING", NULL, sendBufLength + 1);
if( NULL == recvBuffer)
{
ShowErrorMessage("Alloc Recive Buffer Memory Failed!!");
tpfree(sendBuffer);
tpterm();
return;
}
// 把要发送的数据放入缓冲区
StrCopy(sendBuffer, txtMess->Text.c_str());
// 调用服务
iRet = tpcall("TOUPPER", (char *)sendBuffer, 0, (char **)&recvBuffer,
&recvBufLength, 0);
// 判断返回值,-1 为调用失败
if( -1 == iRet)
{
ShowErrorMessage(tpstrerror(tperrno));
tpfree(sendBuffer);
tpfree(recvBuffer);
tpterm();
}
else
{
txtConvert->Text = StrPas(recvBuffer);
tpfree(sendBuffer);
tpfree(recvBuffer);
tpterm();
}
}
//---------------------------------------------------------------------------
void TConvertMessForm::ShowErrorMessage(char * errMess)
{
lblNotice->Caption = errMess;
}