Code Examples: Consuming the AgilePoint API Running in Window Service Mode

The code examples in this topic show how to consume an AgilePoint API running in Window Service mode.

Example 1: GetAdminService

public IWFAdminService GetAdm()
{
…
…..
…….
string hostingMechanism = null;
    if (String.IsNullOrEmpty(ConfigurationSettings.AppSettings["HostingMechanism"]))
            hostingMechanism = "IIS";
    else
        hostingMechanism = (String)ConfigurationSettings.AppSettings["HostingMechanism"];

    if (hostingMechanism.ToLower() != "wcf")
    {
        //CODE Snippet for creating WorkFlowService object in AgilePoint WebService (IISVersion)
        ………
        …….
    }
    else
    {
        string user = domainname + @"\" + username;
        string adminBinding = (String)ConfigurationSettings.AppSettings["AdminBindingUsed"];
        m_adm = new WCFAdminProxy("SampleApplication", "CSC-NINE", locale, user, credentials, adminBinding);
        String username = m_adm.CheckAuthenticated();
    }
…
…
…
}

Example 2: GetWorkflowService

public IWFWorkflowService GetApi()
{
 ……
 ……
 ….
string hostingMechanism = null;
    if String.IsNullOrEmpty(ConfigurationSettings.AppSettings["HostingMechanism"]))
          hostingMechanism = "IIS";
    else
      hostingMechanism = (String)ConfigurationSettings.AppSettings["HostingMechanism"];
    if (hostingMechanism.ToLower() != "wcf")
    {
      //CODE Snippet for creating WorkFlowService object in AgilePoint WebService (IISVersion)
 ………
 …….
    }
    else
    {
      // CODE snippet for creating WorkFlowService object in AgilePoint WCF version.
   string user = domainname + @"\" + username;
   string workflowBinding = (String)ConfigurationSettings.AppSettings["WorkFlowBindingUsed"]; // WCF Binding used
   m_api = new WCFWorkflowProxy("MyApplication", "CSC-NINE", locale, user, credentials, workflowBinding);
   m_api.CheckAuthenticated();
   }
….
….
}