📄 remoteclienttest.java
字号:
/*
* Copyright 2003-2005 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jdon.remoteClient;
import test.MySessionLocal;
import test.TestUser;
import com.jdon.bussinessproxy.ServiceClientFactory;
import com.jdon.bussinessproxy.remote.http.HttpServerParam;
/**
* @author <a href="mailto:banqiao@jdon.com">banq </a>
*
*/
public class RemoteClientTest {
public static void main(String[] args) {
try {
System.out.println(" enter test.");
// 1. 获得ServiceClientFactory工厂实例
ServiceClientFactory serviceFactory = ServiceClientFactory.getInstance();
// 2.设置服务器参数
HttpServerParam hp = new HttpServerParamFactory().getHttpServerParam();
serviceFactory.setHttpServerParam(hp);
System.out.println(" prepare to login ..");
// 以用户名banq 密码9999登录
// 这个用户名和密码是保存在服务器端的数据库user 中
String result = (String) serviceFactory.login("test12", "test12");
//String result = (String) serviceFactory.login("qqwwqqw", "qqwwqqw");
System.out.println(" login ok , result =" + result);
// 3.获得EJB代理实例
MySessionLocal mySessionLocal =
(MySessionLocal)serviceFactory.getService(
FrameworkServices.MySessionEJB);
// 4.执行服务
TestUser user = mySessionLocal.getUser("123");
System.out.println(" result name:" + user.getName());
// } catch (AuthException ae) {
//System.err.println(" login failure");
//System.err.println(ae);
} catch (Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -