Exemplo n.º 1
0
        public MatchingKeywordList GetMatchingKeywords(string keyword, string queryID, bool exactKeyword)
        {
            ProfileSearchBL ps = new ProfileSearchBL();

            Connects.Profiles.Service.DataContracts.MatchingKeywordList pl = new Connects.Profiles.Service.DataContracts.MatchingKeywordList();

            using (XmlReaderScope scope = ps.GetMatchingKeywords(keyword, queryID, exactKeyword))
            {
                Type   type = typeof(MatchingKeywordList);
                string responseXML;

                scope.Reader.Read();
                responseXML = scope.Reader.ReadOuterXml();

                pl = XmlUtilities.DeserializeObject(responseXML, type) as MatchingKeywordList;

                return(pl);
            }
        }
Exemplo n.º 2
0
        public PersonList ProfileSearch(Connects.Profiles.Service.DataContracts.Profiles qd, bool isSecure)
        {
            PersonList pl = null;

            try
            {
                ProfileSearchBL ps = new ProfileSearchBL();
                Connects.Profiles.Service.DataContracts.Profiles p = new Connects.Profiles.Service.DataContracts.Profiles();

                //qd.OutputOptions.StartRecord = (Convert.ToInt32(qd.OutputOptions.StartRecord) + 1).ToString();

                string req = XmlUtilities.SerializeToString(qd);


                req = req.Replace("Version=\"0\"", "Version=\"1\"");


                XmlUtilities.logit("Line 1: ProfileServiceAdapter.ProfileSearch(" + req + "," + isSecure.ToString() + ")");

                // If we are enforcing XSD
                if (Convert.ToBoolean(ConfigUtil.GetConfigItem("EnforceQuerySchema")) == true)
                {
                    XmlUtilities.logit("Line 2: Enforcing XSD");
                    if (ValidateSearchRequest(req) == false)
                    {
                        XmlUtilities.logit("Line 3: Failed XSD");
                        throw new Exception("Search request failed XML schema validation");
                    }
                    XmlUtilities.logit("Line 3: Passed XSD");
                }
                else
                {
                    XmlUtilities.logit("Line 2 and 3: No XSD Required");
                }

                using (XmlReaderScope scope = ps.ProfileSearch(req, isSecure))
                {
                    Type   type = typeof(PersonList);
                    string responseXML;

                    scope.Reader.Read();

                    responseXML = scope.Reader.ReadOuterXml();
                    XmlUtilities.logit("Line 4: Response data " + responseXML);

                    // If we are enforcing XSD
                    if (Convert.ToBoolean(ConfigUtil.GetConfigItem("EnforceResponseSchema")) == true)
                    {
                        XmlUtilities.logit("Line 5: Enforcing response XSD");

                        if (ValidateSearchResponse(responseXML) == false)
                        {
                            XmlUtilities.logit("Line 6: Failed response xsd");
                            throw new Exception("Search response failed XML schema validation");
                        }
                        XmlUtilities.logit("Line 6: Passed response xsd");
                    }
                    else
                    {
                        XmlUtilities.logit("Line 5 and 6: No XSD Required");
                    }


                    pl = XmlUtilities.DeserializeObject(responseXML, type) as PersonList;

                    XmlUtilities.logit("Line 7: Returned to requestor");
                }
            }
            catch (Exception ex)
            {
                XmlUtilities.logit("ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source);
            }


            return(pl);
        }