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

  • 相关阅读:
    Jquery的小案例4、实现表单的验证(用户名和邮箱)
    Ubuntu下安装Python
    ListView列宽自适应
    IPtables 版本升级到 v1.4.9
    穿过已知点画平滑曲线(3次贝塞尔曲线)
    贪心算法——NY 14 会场安排问题
    零是奇数还是偶数?
    免费淘宝IP地址库简介及PHP/C#调用实例
    html锚点(mao dian)特殊的超链接
    怎么查看自己电脑的IP地址
  • 原文地址:https://www.cnblogs.com/qqzy168/p/3137008.html
Copyright © 2011-2022 走看看