コード例 #1
0
        public void PublishBinding(string url, string serviceKey)
        {
            try
            {
                get_authTokenRequest r = new get_authTokenRequest();
                r.get_authToken        = new get_authToken1();
                r.get_authToken.cred   = util.DE(encryptedpassword);
                r.get_authToken.userID = username;
                get_authTokenResponse res = securityclient.get_authToken(r);

                save_bindingRequest req = new save_bindingRequest();
                req.save_binding                               = new save_binding1();
                req.save_binding.authInfo                      = res.authToken.authInfo;
                req.save_binding.bindingTemplate               = new bindingTemplate2[1];
                req.save_binding.bindingTemplate[0]            = new bindingTemplate2();
                req.save_binding.bindingTemplate[0].serviceKey = serviceKey;
                accessPoint2 ap = new accessPoint2();
                ap.useType = "endpoint";
                ap.Value   = url;
                req.save_binding.bindingTemplate[0].Item = ap;


                find_bindingResponse1 res2 = publishclient.save_binding(req);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
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());
        }
コード例 #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());
        }
コード例 #4
0
        /// <summary>
        /// helper class to try and dicipher the complicated arrangements of the uddi type accessPoint
        /// </summary>
        /// <param name="ap"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <returns></returns>
        private string[] parseResults(accessPoint2 ap, string authtoken)
        {
            List <string> ret = new List <string>();
            bool          ok  = false;

            if (!String.IsNullOrEmpty(ap.useType))
            {
                //useType is defined, now what?
                //lets try and figure out what it is
                switch (ap.useType.ToLower())
                {
                case "endpoint":
                    //for systinet servers, they tend to have endpoints with the value
                    //equal to some java class file, why? who the hell knows, but it's against the
                    //uddi spec and thus not really expected.
                    if (ap.Value.StartsWith("http", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ret.Add(ap.Value);
                    }
                    //if (ap.Value.StartsWith("ftp", StringComparison.CurrentCultureIgnoreCase))
                    //ret.Add(ap.Value);
                    //if (ap.Value.StartsWith("smtp", StringComparison.CurrentCultureIgnoreCase))
                    //ret.Add(ap.Value);
                    // ret.Add(ap.Value);
                    ok = true;
                    break;

                case "bindingtemplate":
                case "hostingredirector":
                    //bindingKey
                    //another call out to the same registry
                    try
                    {
                        string[] r3 = this.DiscoverEndpointBindingKey(ap.Value, authtoken);
                        for (int k = 0; k < r3.Length; k++)
                        {
                            ret.Add(r3[k]);
                        }
                    }
                    catch (Exception ex)
                    {
                        //TODO log warning
                    }
                    ok = true;
                    break;

                /* case "hostingredirector":
                 *   //another call out to a different registry
                 *   try
                 *   {
                 *       //remote auth not supported
                 *       string[] r2 = this.DiscoverEndpointKeyWord(keywords, ap.Value);
                 *       for (int k = 0; k < r2.Length; k++)
                 *           ret.Add(r2[k]);
                 *   }
                 *   catch (Exception ex)
                 *   {
                 *       //TODO log warning
                 *   }
                 *
                 *   break;*/
                case "wsdldeployment":

                    string[] urls = DiscoverEndpointByWSDL(ap.Value);
                    if (urls != null)
                    {
                        for (int a = 0; a < urls.Length; a++)
                        {
                            ret.Add(urls[a]);
                        }
                    }
                    ok = true;
                    break;

                default:

                    //so basically, for systinet servers, if the useType is not of the four defined types
                    //the uddi "should" have a corresponding tmodel that matchines the useType value
                    //systinet does NOT do this

                    /*get_tModelDetail2 rt = new get_tModelDetail2();
                     * rt.tModelKey = new string[1];
                     * rt.tModelKey[0] = ap.useType;
                     * tModelDetail2 rr = null;
                     * try
                     * {
                     *  rr = inquiry.get_tModelDetail(rt);
                     * }
                     * catch (Exception ex)
                     * { }
                     */
                    ok = false;
                    break;
                }
            }
            if (!ok)
            {
                //this means it's an unknown useType OR
                //this means the useType is not defined. lets try to guess if the value is actually a url
                if (ap.Value.StartsWith("http", StringComparison.CurrentCultureIgnoreCase))
                {
                    ret.Add(ap.Value);
                }
                //if (ap.Value.StartsWith("ftp", StringComparison.CurrentCultureIgnoreCase))
                //ret.Add(ap.Value);
                //if (ap.Value.StartsWith("smtp", StringComparison.CurrentCultureIgnoreCase))
                //ret.Add(ap.Value);
                //else ignore it, log unknown type as warning
            }
            return(ret.ToArray());
        }
コード例 #5
0
        /// <summary>
        /// Endpoint discovery via UDDI binding key
        /// </summary>
        /// <param name="bindingKey"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="securityEndpointAddress"></param>
        /// <returns></returns>
        public string[] DiscoverEndpointBindingKey(string bindingKey, string authtokenb)
        {
            if (bindingKey == null)
            {
                throw new ArgumentNullException("bindingKey");
            }



            string authTok = null;

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

            get_bindingDetailRequest1 req = new get_bindingDetailRequest1();

            req.get_bindingDetail = new get_bindingDetail2();

            req.get_bindingDetail.bindingKey    = new string[1];
            req.get_bindingDetail.bindingKey[0] = bindingKey;

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

            find_bindingResponse1 response = null;

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


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

            if (response != null && response.bindingDetail != null && response.bindingDetail.bindingTemplate != null)
            {
                foreach (bindingTemplate2 bt in response.bindingDetail.bindingTemplate)
                {
                    //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]);
                            }
                        }
                    }
                    hostingRedirector2 hr = bt.Item as hostingRedirector2;
                    if (hr != null)
                    {
                        string[] urls = DiscoverEndpointBindingKey(hr.bindingKey, authTok);
                        if (urls != null)
                        {
                            for (int i = 0; i < urls.Length; i++)
                            {
                                ret.Add(urls[i]);
                            }
                        }
                    }
                }
            }

            return(ret.ToArray());
        }
コード例 #6
0
ファイル: uddiv3.cs プロジェクト: mil-oss/fgsms
        public void PublishBinding(string url, string serviceKey)
        {
            try
            {
                get_authTokenRequest r = new get_authTokenRequest();
                r.get_authToken = new get_authToken1();
                r.get_authToken.cred = util.DE(encryptedpassword);
                r.get_authToken.userID = username;
                get_authTokenResponse res = securityclient.get_authToken(r);

                save_bindingRequest req = new save_bindingRequest();
                req.save_binding = new save_binding1();
                req.save_binding.authInfo = res.authToken.authInfo;
                req.save_binding.bindingTemplate = new bindingTemplate2[1];
                req.save_binding.bindingTemplate[0] = new bindingTemplate2();
                req.save_binding.bindingTemplate[0].serviceKey = serviceKey;
                accessPoint2 ap = new accessPoint2();
                ap.useType = "endpoint";
                ap.Value = url;
                req.save_binding.bindingTemplate[0].Item = ap;

                find_bindingResponse1 res2 = publishclient.save_binding(req);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
ファイル: uddiv3.cs プロジェクト: mil-oss/fgsms
        /// <summary>
        /// helper class to try and dicipher the complicated arrangements of the uddi type accessPoint
        /// </summary>
        /// <param name="ap"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="discoveryEndpointAddress"></param>
        /// <returns></returns>
        private string[] parseResults(accessPoint2 ap, string authtoken)
        {
            List<string> ret = new List<string>();
            bool ok = false;
            if (!String.IsNullOrEmpty(ap.useType))
            {
                //useType is defined, now what?
                //lets try and figure out what it is
                switch (ap.useType.ToLower())
                {
                    case "endpoint":
                        //for systinet servers, they tend to have endpoints with the value
                        //equal to some java class file, why? who the hell knows, but it's against the
                        //uddi spec and thus not really expected.
                        if (ap.Value.StartsWith("http", StringComparison.CurrentCultureIgnoreCase))
                            ret.Add(ap.Value);
                        //if (ap.Value.StartsWith("ftp", StringComparison.CurrentCultureIgnoreCase))
                        //ret.Add(ap.Value);
                        //if (ap.Value.StartsWith("smtp", StringComparison.CurrentCultureIgnoreCase))
                        //ret.Add(ap.Value);
                        // ret.Add(ap.Value);
                        ok = true;
                        break;
                    case "bindingtemplate":
                    case "hostingredirector":
                        //bindingKey
                        //another call out to the same registry
                        try
                        {
                            string[] r3 = this.DiscoverEndpointBindingKey(ap.Value, authtoken);
                            for (int k = 0; k < r3.Length; k++)
                                ret.Add(r3[k]);
                        }
                        catch (Exception ex)
                        {
                            //TODO log warning
                        }
                        ok = true;
                        break;
                    /* case "hostingredirector":
                         //another call out to a different registry
                         try
                         {
                             //remote auth not supported
                             string[] r2 = this.DiscoverEndpointKeyWord(keywords, ap.Value);
                             for (int k = 0; k < r2.Length; k++)
                                 ret.Add(r2[k]);
                         }
                         catch (Exception ex)
                         {
                             //TODO log warning
                         }

                         break;*/
                    case "wsdldeployment":

                        string[] urls = DiscoverEndpointByWSDL(ap.Value);
                        if (urls != null)
                        {
                            for (int a = 0; a < urls.Length; a++)
                                ret.Add(urls[a]);
                        }
                        ok = true;
                        break;
                    default:

                        //so basically, for systinet servers, if the useType is not of the four defined types
                        //the uddi "should" have a corresponding tmodel that matchines the useType value
                        //systinet does NOT do this

                        /*get_tModelDetail2 rt = new get_tModelDetail2();
                        rt.tModelKey = new string[1];
                        rt.tModelKey[0] = ap.useType;
                        tModelDetail2 rr = null;
                        try
                        {
                            rr = inquiry.get_tModelDetail(rt);
                        }
                        catch (Exception ex)
                        { }
                        */
                        ok = false;
                        break;
                }

            }
            if (!ok)
            {
                //this means it's an unknown useType OR
                //this means the useType is not defined. lets try to guess if the value is actually a url
                if (ap.Value.StartsWith("http", StringComparison.CurrentCultureIgnoreCase))
                    ret.Add(ap.Value);
                //if (ap.Value.StartsWith("ftp", StringComparison.CurrentCultureIgnoreCase))
                //ret.Add(ap.Value);
                //if (ap.Value.StartsWith("smtp", StringComparison.CurrentCultureIgnoreCase))
                //ret.Add(ap.Value);
                //else ignore it, log unknown type as warning
            }
            return ret.ToArray();
        }