Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The account used to connect to your installation must have the Export Data permission enabled.

C#

This example will retrieve the number of resources in your installation. 

  • This example uses an ASP website application framework
  • A web reference of com.projectorpsa.secure has already been added
  • We retrieve the data in two ways. Once using rq/rs and once using request/response.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication1
    {
        using Projector = com.projectorpsa.secure;
    
        public partial class index : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                //create an instance of the Projector Service
                Projector.OpsProjectorSvc svc = new Projector.OpsProjectorSvc();
    
                //Authenticate with server and ensure we have the correct Service URL
                svc.OpsAuthenticationHeaderValue = new Projector.OpsAuthenticationHeader();
                svc.OpsAuthenticationHeaderValue.AccountName = "yourAccountName";
                svc.OpsAuthenticationHeaderValue.EmailAddress = "yourEmailAddress";
                svc.OpsAuthenticationHeaderValue.Password = "yourPassword";
                Projector.GetWebServiceUrlRq gwsuRq = new Projector.GetWebServiceUrlRq();
                Projector.GetWebServiceUrlRs gwsuRs = svc.GetWebServiceUrl(gwsuRq);
                if (gwsuRs.WebServiceUrl != null)
                {
                    svc.Url = string.Format("{0}/OpsProjectorWebSvc/OpsProjectorSvc.asmx", gwsuRs.WebServiceUrl);
                }
    
                //Retrieve some data from the installation using Rq/Rs
                Projector.ExportResourcesRq erRq = new Projector.ExportResourcesRq();
                erRq.Parameters = new Projector.ExportResourcesRequest();
                erRq.Parameters.OnlyCountRows = true;
                Projector.ExportResourcesRs erRs = svc.ExportResources(erRq);
                int iResources = erRs.Data.RowCount;
    
                //Retrieve some more data from the installation using Request/Response
                Projector.ExportResourcesRequest erRequest = new Projector.ExportResourcesRequest();
                erRequest.OnlyCountRows = true;
                Projector.ExportResourcesResponse erResponse = svc.ExportResources(erResponse);
                int iResources2 = erResponse.RowCount;
            }
        }
    }
  • No labels