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

  • 相关阅读:
    vue-cli项目打包出现空白页和路径错误问题
    Git操作手册
    Atom Editor 插件 atom-less 的使用方法
    Vue搭建
    使绝对定位高宽自适应
    原生JS表单序列化
    前端代码有关搜索引擎的代码
    网页局部打印
    万维网
    浅淡传统企业进入移动互联网的几种方式
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3137008.html
Copyright © 2020-2023  润新知