...
Info |
---|
Your Projector account may be hosted on any one of multiple Projector servers. Before consuming web services, it is necessary that your program ascertain the url of the server that hosts your company's data. Therefore, the first thing that your web services code should do is get the correct url by calling the GetWebServiceUrl service. Below is a C# example of retrieving your service url. |
Code Blocktip |
---|
title | SOAP Connection Example | Session Tickets |
---|
|
This example assumes that you can create a session ticket. To learn how to create session tickets see C Sharp Example. You must use the v2 web services to generate session tickets. They can be used by the v1 services. |
Code Block |
---|
borderStyle | solid |
---|
title | SOAP Connection Example |
---|
|
OpsProjectorSvc svc = new OpsProjectorSvc ();
svc.OpsAuthenticationHeaderValue = new OpsAuthenticationHeader ();
svc.OpsAuthenticationHeaderValue.AccountName = "(sessionticket)";
//you can log in using your credentials directly, but we strongly discourage this approach. You should generate session tickets to log in. Direct credentials are fine for some simple tests
//svc.OpsAuthenticationHeaderValue.AccountName = "(account-name)";
//svc.OpsAuthenticationHeaderValue.EmailAddress = "(user-name)";
//svc.OpsAuthenticationHeaderValue.Password = "(password)";
GetWebServiceUrlRq rq = new GetWebServiceUrlRq ();
GetWebServiceUrlRs rs = svc.GetWebServiceUrl (rq);
if (rs.WebServiceUrl != null)
{
svc.Url = string.Format("{0}/OpsProjectorWebSvc/OpsProjectorSvc.asmx", rs.WebServiceUrl);
}
// Use svc to invoke further web services |
...
This URL may take as long as a minute to respond on a windows based system that needs to resolve a proxy prior to connecting to the internet. If you are experiencing slow response times, please look into how your application is configured to resolve proxies. You can potentially work around this by adding the following line
Code Block |
---|
System.Net.WebRequest.DefaultWebProxy = null; |