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

« Previous Version 6 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. 

Project

I used VS2010 to create an ASP website application framework based site

Add Web Reference

You'll need to add a web reference to Projector's WSDL. You can do so by right-clicking References in the solution explorer and choosing Add Service Reference.

Put in the WSDL address and name the reference.

 

 

 

 

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;
        }
    }
}
  • No labels