Chinaunix首页 | 论坛 | 博客
  • 博客访问: 314202
  • 博文数量: 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:46:27

测试通信

生成服务端

buildserver -o simpserv -f simpserv.c -s TOUPPER

生成产客户端

buildclient -f tolower.c -o tolower

buildclient -f simpcl.c -o simpcl

引导Tuxedo

tmoot –y

WebLogic的互操作性

APPDIR目录运行tolower客户端,以便调用Tolower EJB,并将结果返回客户端。使用以下命令:

     tolower ALLSMALL

WebLogic Server 服务使用以下命令答复您的Tuxedo 客户端:

     Returned string is: allsmall

应用访问Tuxedo服务

编写TuxedoClient.java

package org.flying.ejb.client;

 

import weblogic.wtc.jatmi.*;

import weblogic.wtc.gwt.*;

import javax.naming.*;

 

public class TuxedoClient {

       public String getUpper(String inStr) {

              String outStr = "";

              try {

                     // 调用接口服务

                     Context ctx = new InitialContext();

                     TuxedoConnectionFactory cdmaTuxedoFactory = (TuxedoConnectionFactory) ctx

                                   .lookup("tuxedo.services.TuxedoConnection");

                     TuxedoConnection cdmaTuxedo = cdmaTuxedoFactory

                                   .getTuxedoConnection();

                     TypedString cdmaData = new TypedString(inStr);

                     Reply cdmaRtn = cdmaTuxedo.tpcall("TOUPPER", cdmaData, 0);

                     cdmaData = (TypedString) cdmaRtn.getReplyBuffer();

                     outStr = cdmaData.toString();

                     cdmaTuxedo.tpterm();

              } catch (Exception e) {

                     outStr = e.getMessage();

              }

              return outStr;

       }

}

编写tuxedo.jsp

<%@page language="java" contentType="text/html; charset=GB2312"%>

<jsp:useBean id="mytuxedo" scope="session"

    class="org.flying.ejb.client.TuxedoClient">jsp:useBean>

<%  String str = "";

    String id = request.getParameter("id");

    if (id == null) {

       str = mytuxedo.getUpper("longshine");

    } else if (!id.equals("")) {

       str = mytuxedo.getUpper(id);

    }

%>

<html>

    <body bgcolor="#cccccc">

       <form name="f1" action="tuxedo.jsp" method="post">

           <table width=60% align="center">

              <tr>

                  <td>

                     小写字母:

                     <input name=id value=<%=id%> size=15>

                  td>

                  <td>

                     Tuxedo返回大写字母:<%=str%>td>

              tr>

              <tr>

                  <td>

                     <br>

                     <br>

                  td>

              tr>

              <tr>

                  <td align="center" colspan="2">

                     <input type="submit" name="查询">

                  td>

              tr>

           table>

       form>

    body>

html>

JSP页面tuxedo.jsp调用javabean mytuxedo getUpper方法,执行调用TuxedoTOUPPER服务的操作,并显示返回的结果:LONGSHINE

阅读(2591) | 评论(0) | 转发(0) |
0

上一篇:WTC的配置(三)

下一篇:瞬间的眩晕

给主人留下些什么吧!~~