示例#1
0
        private string GetWebServiceConfigurationName(ITisWebServiceInfo oServiceInfo)
        {
            string serviceConfigurationName = oServiceInfo.WebServiceConfigurationName;

            if (!StringUtil.IsStringInitialized(serviceConfigurationName))
            {
                serviceConfigurationName = oServiceInfo.ServiceName + "_" + m_communicationProtocol;
            }

            return(serviceConfigurationName);
        }
示例#2
0
        private byte[] GetInstancePermission(
            ITisWebServiceInfo oServiceInfo,
            string appName,
            string stationName)
        {
            if (m_lastStationInstancePermission == null && !IsClaimsService(oServiceInfo))
            {
                throw new AuthenticationException(string.Format("Missing permission for application {0} / station {1}", appName, stationName));
            }

            return(m_lastStationInstancePermission);
        }
示例#3
0
        private object GetWebServiceClientChannel(
            string sHostName,
            string sAppName,
            ITisWebServiceInfo oServiceInfo,
            string serviceInstanceName)
        {
            lock (this)
            {
                string webServiceUri = CreateWebServiceURI(
                    sHostName,
                    sAppName,
                    oServiceInfo.ServiceName);

                TisWebServiceClient webServiceClient =
                    GetWebServiceClientByUri(sAppName, webServiceUri);

                TisWebServiceContextData webServiceContextData = new TisWebServiceContextData()
                {
                    Name               = oServiceInfo.ServiceName,
                    ApplicationName    = sAppName,
                    InstanceName       = serviceInstanceName,
                    CreatorTypeName    = oServiceInfo.ServiceCreatorType,
                    NodeName           = Name,
                    Version            = ModuleVersion.PlatformVersion.ToString(),
                    InstancePermission = GetInstancePermission(oServiceInfo, sAppName, StationName),
                    StationName        = StationName,
                    StationId          = StationId,
                    UserName           = UserName
                };

                if (webServiceClient == null)
                {
                    m_clientChannelFactoryConfiguration.EndPointConfigurationName = GetWebServiceConfigurationName(oServiceInfo);

                    webServiceClient = new TisWebServiceClient(
                        oServiceInfo.WebServiceContractType,
                        m_clientChannelFactoryConfiguration,
                        webServiceContextData,
                        webServiceUri);

                    m_cachedWebServiceClients.TryAdd(new TisWebServiceClientInfo(sAppName, webServiceUri), webServiceClient);
                }

                webServiceClient.Header = webServiceContextData;

                return(webServiceClient.ClientChannel);
            }
        }
示例#4
0
        private object CreateWebServiceClient(
            string sHostName,
            string sAppName,
            ITisWebServiceInfo oServiceInfo,
            string serviceInstanceName)
        {
            try
            {
                return(GetWebServiceClientChannel(sHostName, sAppName, oServiceInfo, serviceInstanceName));
            }
            catch
            {
                // Try with IP address (probably DNS is unavailable)
                string hostIPAddress = NetworkUtil.GetIPAddress(sHostName);

                Log.WriteInfo("Failed to get service via host name : [{0}]. Trying via IP address : [{1}]", sHostName, hostIPAddress);

                return(GetWebServiceClientChannel(hostIPAddress, sAppName, oServiceInfo, serviceInstanceName));
            }
        }
示例#5
0
 private bool IsClaimsService(ITisWebServiceInfo oServiceInfo)
 {
     return(StringUtil.CompareIgnoreCase(oServiceInfo.ServiceName, TisServicesConst.CLAIMS_SERVICE_WINDOWS) ||
            StringUtil.CompareIgnoreCase(oServiceInfo.ServiceName, TisServicesConst.CLAIMS_SERVICE_USER));
 }