1:接口
@Remote public interface XgmZzsNssb {}
2:实现
@Stateless(mappedName="XgmZzsNssbImpl") @Remote(XgmZzsNssb.class) public class XgmZzsNssbImpl implements XgmZzsNssb{}
3:客户端调用
public static void main(String[] args) { try { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.SECURITY_PRINCIPAL, "weblogic"); env.put(Context.SECURITY_CREDENTIALS, "weblogic1"); //集群下使用"t3://localhost:7101,localhost:7102" env.put(Context.PROVIDER_URL, "t3://localhost:7001"); Context ctx = new InitialContext(env); XgmZzsNssb nssb = (XgmZzsNssb) ctx.lookup("XgmZzsNssbImpl#com.wzh.sb.XgmZzsNssb"); System.out.println(nssb.request44("xml")); } catch (NamingException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } }
时间: 2024-10-22 19:27:37