Please or Register to create posts and topics.

Web Service Client Example: Get All Projects

Here is a complete example of how to use the OfficeClip Web Service Client. This example is written in C#

Code:


using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Web.Services.Protocols;
using WebServiceClient.Generic;

namespace WebServiceClient
{
 public class Program
 {
  static void Main(string[] args)
  {
   // Create a web services connection
   WebServiceClient.Generic.OfficeClipGeneric ofg = new WebServiceClient.Generic.OfficeClipGeneric();

   try
   {
    // Create a cookie container so that the session can persist on the server
    ofg.CookieContainer = new System.Net.CookieContainer();
   
    // Login to the Server
    string errorMessage = ", "password");
    Console.WriteLine ( (errorMessage == string.Empty) ? "Login Successful" : "Login Failed: " + errorMessage);

    // Get all the projects
    // Service Type 32 is for Project, for details of other parameter and output schema see the API. 
    // The output dataset will contain all the project information.
    DataSet ds = ofg.GetDataSet(32, -1, string.Empty, string.Empty, string.Empty, -1);
   }

   catch (SoapException ex)
   {
    Console.WriteLine(ex.Message);
   }

   finally
   {
     // Finally end the Session with OfficeClip Server
    ofg.SessionOver();
   }
  }
}