Ejemplo n.º 1
0
        /// <summary>
        /// discovers an endpoint by a UDDI service entity key
        /// </summary>
        /// <param name="uddiKey"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="securityEndpointAddress"></param>
        /// <returns></returns>
        public string[] DiscoverByServiceKey(string uddiKey, string token)
        {
            if (uddiKey == null)
            {
                throw new ArgumentNullException("bindingKey");
            }



            string authTok = null;

            if (authrequired && String.IsNullOrEmpty(token))
            {
                authTok = getAuthToken();
            }
            else
            {
                authTok = token;
            }



            get_serviceDetailRequest1 req = new get_serviceDetailRequest1();

            req.get_serviceDetail = new get_serviceDetail2();

            req.get_serviceDetail.serviceKey = new string[] { uddiKey };


            req.get_serviceDetail.authInfo = authTok;

            get_serviceDetailResponse1 response = null;

            try
            {
                response = inquiryclient.get_serviceDetail(req);
            }
            catch (Exception ex)
            {
                throw new Exception(discoveryError, ex);
            }

            List <string> ret = new List <string>();

            if (response == null || response.serviceDetail == null || response.serviceDetail.businessService == null || response.serviceDetail.businessService.Length == 0)
            {
                return(null);
            }
            foreach (businessService2 bizs in response.serviceDetail.businessService)
            {
                //if (bizs.Signature != null)
                //    if (!VerifySignature(bizs))
                //        throw new Exception ( signatureError);
                if (bizs.bindingTemplates != null)
                {
                    foreach (bindingTemplate2 bt in bizs.bindingTemplates)
                    {
                        //if (bt.Signature != null)
                        //    if (!VerifySignature(bt))
                        //        throw new Exception(signatureError);
                        accessPoint2 ap = bt.Item as accessPoint2;
                        if (ap != null)
                        {
                            string[] apList = parseResults(ap, authTok);
                            if (apList != null)
                            {
                                for (int k = 0; k < apList.Length; k++)
                                {
                                    ret.Add(apList[k]);
                                }
                            }
                        }
                    }
                }
            }
            return(ret.ToArray());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Discovers a service endpoint by keywords. Use (%) to indicate any value for any number of characters and an underscore (_) to indicate any value for a single character. The backslash character (\) 
        /// </summary>
        /// <param name="keywords"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="securityEndpointAddress"></param>
        /// <returns></returns>
        public string[] DiscoverEndpointKeyWord(string[] keywords, string authtoken)
        {
            if (keywords == null)
                throw new ArgumentNullException("keywords");

            string authTok = "";

            if (authrequired && String.IsNullOrEmpty(authtoken))
            {
                authTok = getAuthToken();
            }
            else authTok = authtoken;
            find_serviceRequest1 req = new find_serviceRequest1();
            req.find_service = new find_service2();
            req.find_service.name = new name1[keywords.Length];
            for (int i = 0; i < keywords.Length; i++)
            {
                req.find_service.name[i] = new name1();
                // ignored req.name[i].lang
                req.find_service.name[i].Value = keywords[i];
            }

            req.find_service.findQualifiers = new string[2];

            req.find_service.findQualifiers[0] = uddi_v3_findQualifiers.approximateMatch;
            req.find_service.findQualifiers[1] = uddi_v3_findQualifiers.caseInsensitiveMatch;

            if ((authTok != null) && (authrequired))
            {
                req.find_service.authInfo = authTok;
            }

            find_serviceResponse1 response = null;
            try
            {
                response = inquiryclient.find_service(req);
            }
            catch (Exception ex)
            {
                throw new Exception(discoveryError, ex);
            }
            get_serviceDetailRequest1 sreq = new get_serviceDetailRequest1();
            if (response == null || response.serviceList == null || response.serviceList.serviceInfos == null || response.serviceList.serviceInfos.Length == 0)
                return new string[] { };//no services returned

            sreq.get_serviceDetail = new get_serviceDetail2();
            sreq.get_serviceDetail.serviceKey = new string[response.serviceList.serviceInfos.Length];
            for (int k = 0; k < response.serviceList.serviceInfos.Length; k++)
            {
                sreq.get_serviceDetail.serviceKey[k] = response.serviceList.serviceInfos[k].serviceKey;
            }

            get_serviceDetailResponse1 sresponse = null;
            try
            {
                sresponse = inquiryclient.get_serviceDetail(sreq);
            }
            catch (Exception ex)
            {
                throw new Exception(discoveryError, ex);
            }
            List<string> ret = new List<string>();
            if (sresponse != null && sresponse.serviceDetail != null)
                foreach (businessService2 bs in sresponse.serviceDetail.businessService)
                {
                    //if (bs.Signature != null)
                    //    if (!VerifySignature(bs))
                    //        throw new Exception(signatureError);
                    if (bs.bindingTemplates != null)
                        foreach (bindingTemplate2 bt in bs.bindingTemplates)
                        {
                            //if (bt.Signature != null)
                            //    if (!VerifySignature(bt))
                            //        throw new Exception(signatureError);
                            accessPoint2 ap = bt.Item as accessPoint2;
                            if (ap != null)
                            {
                                string[] apList = parseResults(ap, authTok);
                                if (apList != null)
                                    for (int k = 0; k < apList.Length; k++)
                                        ret.Add(apList[k]);

                            }
                        }
                }
            return ret.ToArray();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Discovers a service endpoint by keywords. Use (%) to indicate any value for any number of characters and an underscore (_) to indicate any value for a single character. The backslash character (\)
        /// </summary>
        /// <param name="keywords"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="securityEndpointAddress"></param>
        /// <returns></returns>
        public string[] DiscoverEndpointKeyWord(string[] keywords, string authtoken)
        {
            if (keywords == null)
            {
                throw new ArgumentNullException("keywords");
            }



            string authTok = "";

            if (authrequired && String.IsNullOrEmpty(authtoken))
            {
                authTok = getAuthToken();
            }
            else
            {
                authTok = authtoken;
            }
            find_serviceRequest1 req = new find_serviceRequest1();

            req.find_service      = new find_service2();
            req.find_service.name = new name1[keywords.Length];
            for (int i = 0; i < keywords.Length; i++)
            {
                req.find_service.name[i] = new name1();
                // ignored req.name[i].lang
                req.find_service.name[i].Value = keywords[i];
            }

            req.find_service.findQualifiers = new string[2];

            req.find_service.findQualifiers[0] = uddi_v3_findQualifiers.approximateMatch;
            req.find_service.findQualifiers[1] = uddi_v3_findQualifiers.caseInsensitiveMatch;

            if ((authTok != null) && (authrequired))
            {
                req.find_service.authInfo = authTok;
            }

            find_serviceResponse1 response = null;

            try
            {
                response = inquiryclient.find_service(req);
            }
            catch (Exception ex)
            {
                throw new Exception(discoveryError, ex);
            }
            get_serviceDetailRequest1 sreq = new get_serviceDetailRequest1();

            if (response == null || response.serviceList == null || response.serviceList.serviceInfos == null || response.serviceList.serviceInfos.Length == 0)
            {
                return new string[] { }
            }
            ;                           //no services returned

            sreq.get_serviceDetail            = new get_serviceDetail2();
            sreq.get_serviceDetail.serviceKey = new string[response.serviceList.serviceInfos.Length];
            for (int k = 0; k < response.serviceList.serviceInfos.Length; k++)
            {
                sreq.get_serviceDetail.serviceKey[k] = response.serviceList.serviceInfos[k].serviceKey;
            }

            get_serviceDetailResponse1 sresponse = null;

            try
            {
                sresponse = inquiryclient.get_serviceDetail(sreq);
            }
            catch (Exception ex)
            {
                throw new Exception(discoveryError, ex);
            }
            List <string> ret = new List <string>();

            if (sresponse != null && sresponse.serviceDetail != null)
            {
                foreach (businessService2 bs in sresponse.serviceDetail.businessService)
                {
                    //if (bs.Signature != null)
                    //    if (!VerifySignature(bs))
                    //        throw new Exception(signatureError);
                    if (bs.bindingTemplates != null)
                    {
                        foreach (bindingTemplate2 bt in bs.bindingTemplates)
                        {
                            //if (bt.Signature != null)
                            //    if (!VerifySignature(bt))
                            //        throw new Exception(signatureError);
                            accessPoint2 ap = bt.Item as accessPoint2;
                            if (ap != null)
                            {
                                string[] apList = parseResults(ap, authTok);
                                if (apList != null)
                                {
                                    for (int k = 0; k < apList.Length; k++)
                                    {
                                        ret.Add(apList[k]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(ret.ToArray());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// discovers an endpoint by a UDDI service entity key
        /// </summary>
        /// <param name="uddiKey"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="securityEndpointAddress"></param>
        /// <returns></returns>
        public string[] DiscoverByServiceKey(string uddiKey, string token)
        {
            if (uddiKey == null)
                throw new ArgumentNullException("bindingKey");

            string authTok = null;
            if (authrequired && String.IsNullOrEmpty(token))
            {
                authTok = getAuthToken();
            }
            else authTok = token;

            get_serviceDetailRequest1 req = new get_serviceDetailRequest1();
            req.get_serviceDetail = new get_serviceDetail2();

            req.get_serviceDetail.serviceKey = new string[] { uddiKey };

            req.get_serviceDetail.authInfo = authTok;

            get_serviceDetailResponse1 response = null;
            try
            {
                response = inquiryclient.get_serviceDetail(req);
            }
            catch (Exception ex)
            {
                throw new Exception(discoveryError, ex);
            }

            List<string> ret = new List<string>();
            if (response == null || response.serviceDetail == null || response.serviceDetail.businessService == null || response.serviceDetail.businessService.Length == 0)
                return null;
            foreach (businessService2 bizs in response.serviceDetail.businessService)
            {
                //if (bizs.Signature != null)
                //    if (!VerifySignature(bizs))
                //        throw new Exception ( signatureError);
                if (bizs.bindingTemplates != null)
                    foreach (bindingTemplate2 bt in bizs.bindingTemplates)
                    {
                        //if (bt.Signature != null)
                        //    if (!VerifySignature(bt))
                        //        throw new Exception(signatureError);
                        accessPoint2 ap = bt.Item as accessPoint2;
                        if (ap != null)
                        {
                            string[] apList = parseResults(ap, authTok);
                            if (apList != null)
                                for (int k = 0; k < apList.Length; k++)
                                    ret.Add(apList[k]);

                        }
                    }
            }
            return ret.ToArray();
        }