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

  • 相关阅读:
    Kubernetes 弹性伸缩全场景解析 (四)- 让核心组件充满弹性
    15分钟在笔记本上搭建 Kubernetes + Istio开发环境
    idea 插件的使用
    jQuery获取select元素选择器练习
    【Maven】添加ueditor到maven本地仓库
    jQuery序列化乱码解决
    Linux安装RedHat
    MyBatis SQL xml处理小于号与大于号
    js判断数据类型
    基于SSM框架的通用权限框架设计
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3137008.html
Copyright © 2011-2022 走看看