Below is a sniplet of my code I am using to get access from the Web to the UCS. You may use it as an example with some modifications:
[code]
    protected void Search_onClick()
    {
        try
        {
            Uri ucsURI = new Uri("tcp:" + strHost + ":" + iPort.ToString());
            Endpoint ucsEndPoint = new Endpoint(ucsURI);
            ucsp = new UniversalContactServerProtocol(ucsEndPoint);
            ucsp.EnableLogging(new TraceLogger(TraceLogger.LevelDebug));
            ucsp.Opened += new EventHandler(conn_Opened);
            ucsp.Closed += new EventHandler(conn_Closed);
            ucsp.Error += new EventHandler(conn_Error);
            ucsp.ClientName = "YourClientNameHere";
            ucsp.Open();
            IMessage msg = ucsp.Request(CreateGetContacts(true));
            if (msg != null && msg.GetType() == typeof(EventGetContacts))
            {
                EventGetContacts eventGC = msg as EventGetContacts;
                ContactDataList cdl = eventGC.ContactData;
                if (cdl != null && (int)eventGC.CurrentCount > 0)
                {
                    Contact contact = cdl.Get(0);
                    strContactID = contact.Id;
                    msg = ucsp.Request(CreateGetInteractions(strContactID));
                    if (msg != null && msg.GetType() == typeof(EventError))
                    {
                        EventError error = msg as EventError;
                        strTableContent = error.FaultString;
                    }
                    else if (msg != null && msg.GetType() == typeof(EventGetInteractionsForContact))
                    {
                        EventGetInteractionsForContact egifc = msg as EventGetInteractionsForContact;
                        ContactInteractionList cil = egifc.ContactInteractions;
                        if (cil != null)
                        {
                            cil.Sort(new ContactInteractionsComparer());
                            strTableContent = BuildInteractionTable(cil);
                        }
                        else
                        {
                            strTableContent = "Can't find interactions for contact by provided information. Please try to search with different parameters.";
                        }
                    }
                    else if (msg == null)
                    {
                        strTableContent = "Can't find interactions for contact by provided information. Please try to search with different parameters.";
                    }
                }
                else
                {
                    strTableContent = "Can't find a contact by provided information. Please try to search with different parameters.";
                }
            }
            else
            {
                strTableContent = "Invalid reply from server. Please try to search with different parameters.";
            }
            ucsp.Close();
            ResultData.Text = strTableContent;
        }
        catch (ProtocolException pe)
        {
            ResultData.Text = "Error occured during request. " + pe.Message;
        }
        catch (System.UriFormatException ufe)
        {
            ResultData.Text = "Error occured during request. Invalid hostname/port specified.";
        }
        catch (Exception e1)
        {
            ResultData.Text = "Error occured during request. " + e1.ToString();
        }
    }
    public class ContactInteractionsComparer : IComparer
    {
        public int Compare(object x, object y)
        {
            ContactInteraction cix = (ContactInteraction)x;
            ContactInteraction ciy = (ContactInteraction)y;
            return (int)ciy.InteractionIndex - (int)cix.InteractionIndex;
        }
    }
    private IMessage CreateGetInteractions(string strContactID)
    {
        RequestGetInteractionsForContact rgifc  = new RequestGetInteractionsForContact();
        rgifc.ContactId                         = strContactID;
        rgifc.AttributeList                     = new StringList();
        rgifc.AttributeList.Add(InteractionAttributeListConstants.Id);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.TypeId);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.SubtypeId);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.MediaTypeId);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.Subject);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.Text);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.ThreadId);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.WebSafeEmailStatus);
        rgifc.AttributeList.Add(InteractionAttributeListConstants.StartDate);
        //rgifc.AttributeList.Add(InteractionAttributeListConstants.);
        rgifc.SearchCriteria = new SearchCriteriaCollection();
        SimpleSearchCriteria searchByMediaType = new SimpleSearchCriteria();
        searchByMediaType.Operator = Operators.Equal;
        searchByMediaType.AttrName  = InteractionSearchCriteriaConstants.MediaTypeId;
        searchByMediaType.AttrValue = "email";
        rgifc.SearchCriteria.Add(searchByMediaType);
        rgifc.SortCriteria = new SortCriteriaCollection();
        SortCriteria srt1 = new SortCriteria();
        srt1.AttrName = InteractionSortCriteriaConstants.ThreadId;
        srt1.SortIndex = 0;
        srt1.SortOperator = SortMode.Ascending;
        rgifc.SortCriteria.Add(srt1);
        SortCriteria srt2 = new SortCriteria();
        srt2.AttrName = InteractionSortCriteriaConstants.StartDate;
        srt2.SortIndex = 1;
        srt2.SortOperator = SortMode.Descending;
        rgifc.SortCriteria.Add(srt2);
        /*
        //Another one example of ComplexSearchCriteria. 
        //Here search formula: search where ( (LastName like "Ivanov") AND (AccountNumber >= 1234) )
        rgifc.SearchCriterions = new SearchCriteriaCollection();
        ComplexSearchCriteria cplx = new ComplexSearchCriteria();
        cplx.Prefix = Prefixes.And;
        cplx.Criterias = new SearchCriteriaCollection();
        SimpleSearchCriteria simple1 = new SimpleSearchCriteria();
        simple1.Operator = Operators.Like;
        simple1.AttrName = SearchCriterionsConstants.LastName;
        simple1.AttrValue = "Ivanov";
        cplx.Criterias.Add(simple1);
        SimpleSearchCriteria simple2 = new SimpleSearchCriteria();
        simple2.Operator = Operators.GreaterOrEqual;
        simple2.AttrName = SearchCriterionsConstants.AccountNumber;
        simple2.AttrValue = "1234";
        cplx.Criterias.Add(simple2);
        rgifc.SearchCriterions.Add(cplx);
        */
        return rgifc;
    }
    private IMessage CreateGetContacts(bool whisSort)
    {
        RequestGetContacts gcr      = new RequestGetContacts();
        ComplexSearchCriteria csc   = null;
        gcr.TenantId                = int.Parse(LoadBalancer.getTenantId(ssc.TenantName));
        gcr.MaxCount                = 5;
        gcr.Restricted              = false;
        gcr.SearchCriteria        = new SearchCriteriaCollection();
        if (strFirstName != "")
        {
            SimpleSearchCriteria simple1 = new SimpleSearchCriteria();
            simple1.AttrName = ContactSearchCriteriaConstants.FirstName;
            simple1.AttrValue = strFirstName;
            simple1.Operator = Operators.Equal;
            csc = new ComplexSearchCriteria();
            csc.Prefix = Prefixes.And;
            csc.Criterias = new SearchCriteriaCollection();
            csc.Criterias.Add(simple1);
            gcr.SearchCriteria.Add(csc);
        }
        if (strLastName != "")
        {
            SimpleSearchCriteria simple2 = new SimpleSearchCriteria();
            simple2.AttrName = ContactSearchCriteriaConstants.LastName;
            simple2.AttrValue = strLastName;
            simple2.Operator = Operators.Equal;
            csc = new ComplexSearchCriteria();
            csc.Prefix = Prefixes.And;
            csc.Criterias = new SearchCriteriaCollection();
            csc.Criterias.Add(simple2);
            gcr.SearchCriteria.Add(csc);
        }
        if (strEMail != "")
        {
            SimpleSearchCriteria simple3 = new SimpleSearchCriteria();
            simple3.AttrName = ContactSearchCriteriaConstants.EmailAddress;
            simple3.AttrValue = strEMail;
            simple3.Operator = Operators.Equal;
            csc = new ComplexSearchCriteria();
            csc.Prefix = Prefixes.And;
            csc.Criterias = new SearchCriteriaCollection();
            csc.Criterias.Add(simple3);
            gcr.SearchCriteria.Add(csc);
        }
        if (whisSort)
        {
            gcr.SortCriteria = new SortCriteriaCollection();
            SortCriteria srt = new SortCriteria();
            srt.SortIndex = 0;
            srt.AttrName = ContactSortCriteriaConstants.FirstName;
            srt.SortOperator = SortMode.Ascending;
            gcr.SortCriteria.Add(srt);
        }
        return gcr;
    }
    private void conn_Opened(object sender, EventArgs e)
    {
        //bConnected = true;
    }
    private void conn_Closed(object sender, EventArgs e)
    {
        //bConnected = false;
    }
    private void conn_Error(object sender, EventArgs e)
    {
        /* remove comments when ErrorEventArgs could be resolved
        ErrorEventArgs e1 = null;
        if (e is ErrorEventArgs)
            e1 = (ErrorEventArgs)e;
        Trace.WriteLine("event Error for mediaServer");
        if (e1 != null)
            Trace.WriteLine(e1.Cause.StackTrace);
        */
    }
[/code]