package com.bjgoodwill.jhipwebsvc; import java.util.Scanner; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; /** * 单点登录服务代理类 * @author shuyongfu * */ public class JhipSsoWebsvcProxy implements JhipSsoWebsvc { private static Logger logger = Logger.getLogger(JhipSsoWebsvcProxy.class); private String _endpoint = null; private com.bjgoodwill.jhipwebsvc.JhipSsoWebsvc jhipSsoWebsvc = null; public JhipSsoWebsvcProxy() { _initJhipSsoWebsvcProxy(); } public JhipSsoWebsvcProxy(String endpoint) { _endpoint = endpoint; _initJhipSsoWebsvcProxy(); } private void _initJhipSsoWebsvcProxy() { try { jhipSsoWebsvc = (new com.bjgoodwill.jhipwebsvc.JhipSsoWebsvcImplServiceLocator()) .getJhipssoWebsvcSOAP(); if (jhipSsoWebsvc != null) { if (_endpoint != null) ((javax.xml.rpc.Stub) jhipSsoWebsvc) ._setProperty( "javax.xml.rpc.service.endpoint.address", _endpoint); else _endpoint = (String) ((javax.xml.rpc.Stub) jhipSsoWebsvc) ._getProperty("javax.xml.rpc.service.endpoint.address"); } } catch (javax.xml.rpc.ServiceException serviceException) { } } public String getEndpoint() { return _endpoint; } public void setEndpoint(String endpoint) { _endpoint = endpoint; if (jhipSsoWebsvc != null) ((javax.xml.rpc.Stub) jhipSsoWebsvc)._setProperty( "javax.xml.rpc.service.endpoint.address", _endpoint); } public com.bjgoodwill.jhipwebsvc.JhipSsoWebsvc getJhipSsoWebsvc() { if (jhipSsoWebsvc == null) _initJhipSsoWebsvcProxy(); return jhipSsoWebsvc; } public java.lang.String getUserDetailInfo(java.lang.String inputPara) throws java.rmi.RemoteException { if (jhipSsoWebsvc == null) _initJhipSsoWebsvcProxy(); String result=jhipSsoWebsvc.getUserDetailInfo(inputPara); logger.debug("inputPara="+ inputPara +",result=" + result); return result; } public static void main(String[] args) { Scanner scanner = null; try{ String sessionId = "3CF38BEE-CE88-4A86-B08D-57640553CC76"; String inputParam = "%s "; String result = new JhipSsoWebsvcProxy().getUserDetailInfo(String.format(inputParam, sessionId)); logger.debug("sessionId="+ sessionId +",result=" + result); scanner = new Scanner(System.in); sessionId = scanner.nextLine(); if(StringUtils.isNotBlank(sessionId)){ result = new JhipSsoWebsvcProxy().getUserDetailInfo(String.format(inputParam, sessionId)); logger.debug("sessionId="+ sessionId +",result=" + result); } }catch(Exception e){ logger.error("getUserDetailInfo exception=" + e); e.printStackTrace(); }finally{ if(scanner != null){ scanner.close(); } } } }