Info |
---|
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 siteThis example was tested with Visual Studio 2012. The project is a console application.
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 Enter the WSDL address and name the reference.
Once the reference is added, the following code should execute (with proper authentication information):
Code Block |
---|
using System; using using System.Collections.GenericServiceModel; using SystemProjectorExampleWS1.LinqServiceReference1; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebApplication1ProjectorExampleWS1 { using Projector = com.projectorpsa.secure; public partial class index : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { class Program { static void Main(string[] args) { //create an instance of the Projector Service Projector.OpsProjectorSvc var svc = new Projector.OpsProjectorSvcOpsProjectorSvcSoapClient(); //Authenticate with server and ensure we have the correct Service URL svc.OpsAuthenticationHeaderValue var header = new Projector.OpsAuthenticationHeader(); svc.OpsAuthenticationHeaderValue. { AccountName = "yourAccountNameyouraccount"; svc.OpsAuthenticationHeaderValue., EmailAddress = "yourEmailAddressyouremail"; svc.OpsAuthenticationHeaderValue., Password = "yourPasswordyourpassword" }; //Authenticate with server and ensure we have the correct Service URL Projector.GetWebServiceUrlRq gwsuRq var getWebServiceUrlRq = new Projector.GetWebServiceUrlRq(); Projector.GetWebServiceUrlRs gwsuRs GetWebServiceUrlRs getWebServiceUrlRs = svc.GetWebServiceUrl(gwsuRqheader, getWebServiceUrlRq); if (gwsuRsgetWebServiceUrlRs.WebServiceUrl != null) { svc.Url = { svc.Endpoint.Address = new EndpointAddress(string.Format("{0}/OpsProjectorWebSvc/OpsProjectorSvc.asmx", gwsuRsgetWebServiceUrlRs.WebServiceUrl)); } ; } //Retrieve some data from the installation using Rq/Rs Projector.ExportResourcesRq erRq var exportResourcesRq = new Projector.ExportResourcesRq(); erRq. { Parameters = new Projector.ExportResourcesRequest(); erRq.Parameters. { OnlyCountRows = true; } Projector.ExportResourcesRs erRs }; ExportResourcesRs exportResourcesRs = svc.ExportResources(erRqheader, exportResourcesRq); int iResources = erRsexportResourcesRs.Data.RowCount; } } } |