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;
        }
    }

  • 相关阅读:
    Nginx(ab性能测试)
    Nginx(配置域名后,不能配置到public目录原因)
    sublime text3的php代码合法检查
    Nginx(expires 缓存减轻服务端压力)
    Nginx(Gzip加速访问速度)
    Nginx(Rewrite语法)
    Nginx(location分析)
    Nginx(日志切割)
    Nginx(Logs)
    Java内部类——闭包与回调
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3137008.html
Copyright © 2011-2022 走看看