zoukankan      html  css  js  c++  java
  • webservice提速调用远程接口 .

    webservice提速调用远程接口 .
    WebServiceStubHelper类:


    public class WebServiceStubHelper
    {
      
        private static URL imUrl;
       
        private final static String HTTP_PREFIX = "http://";
       
        //im服务地址配置
        private static String imServiceIP =
            Configuration.getInstance().getConfigValue("imServiceIP", Constant.EMPTY_STRING);
        private static String imServicePort =
            Configuration.getInstance().getConfigValue("imServicePort", Constant.EMPTY_STRING);
        private static String imServicePost =
            Configuration.getInstance().getConfigValue("imServicePost", Constant.EMPTY_STRING);
       
      
        /** The IM stub. */
       
        private SysMessageExSendSysMessageEx imStub = null;
       
        /** The instance. */
        private static WebServiceStubHelper instance = null;
        
        static
        {
            try
            {
                
                String imServiceURL =   HTTP_PREFIX+pgmServiceIP+":"+pgmServicePort

    +"/"+imServicePost;
                imUrl = new URL(imServiceURL);
                
            }
            catch (MalformedURLException e)
            {
                DebugLogFactory.error(WebServiceStubHelper.class, "Error", e);
            }
        }
        
        private WebServiceStubHelper()
        {

      try//【此处提速调用远程接口】
            {
                 EngineConfiguration defaultConfig =

    EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig();
               
                SimpleProvider config = new SimpleProvider(defaultConfig);
               
                config.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME, new

    PortalCommonsHTTPSender());
                imStub = new GnsServiceLocator(config).getSysMessageExSendSysMessageEx(imUrl);
            }
            catch (ServiceException e)
            {
                DebugLogFactory.error(this.getClass(), "Get imStub failed", e);
            }
           
        }
       
       
        private static WebServiceStubHelper getInstance()
        {
            if (null == instance)
            {
                instance = new WebServiceStubHelper();
            }
            return instance;
        }
       
      
        public static SysMessageExSendSysMessageEx getImStub()
        {
            return getInstance().imStub;
        }
    }

  • 相关阅读:
    rpm
    java 锁4
    java 锁3
    小技巧:在线生成按钮Shape的网站
    Python入门:内置函数
    山东理工大学SDUT
    Android项目实战(四十):Andoird 7.0+ 安装APK适配
    Android打赏功能:支付宝转账
    浅谈Android数据库DBFlow
    acffo的开源项目汇总
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3137008.html
Copyright © 2011-2022 走看看