|
#region Using directives
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Services.Protocols;
using System.Net;
using SmartInstitute.Automation.SmartInstituteServices.StudentService;
using SmartInstitute.Automation.SmartInstituteServices.SecurityService;
using SmartInstitute.Automation.SmartInstituteServices.CourseService;
using SmartInstitute.Automation.SmartInstituteServices.AccountService;
#endregion
namespace SmartInstitute.Client.Automation.Factories
{
internal class ServiceProxyFactory
{
/// <summary>
/// Contruct a student web service proxy ready to be called
/// </summary>
/// <returns></returns>
public static StudentService GetStudentService()
{
StudentService service = new StudentService();
service.Url = _Application.Settings.WebServiceUrl + "StudentService.asmx"; ;
SmartInstitute.Automation.SmartInstituteServices.StudentService.CredentialSoapHeader header =
new SmartInstitute.Automation.SmartInstituteServices.StudentService.CredentialSoapHeader();
header.Username = _Application.Settings.UserInfo.UserName;
header.PasswordHash = _Application.Settings.UserInfo.UserPassword;
header.VersionNo = _Application.Settings.VersionNo;
SetProxy(service);
service.CredentialSoapHeaderValue = header;
return service;
}
/// <summary>
/// Contruct a security web service proxy ready to be called
/// </summary>
/// <returns></returns>
public static SecurityService GetSecurityService()
{
SecurityService service = new SecurityService();
service.Url = _Application.Settings.WebServiceUrl + "SecurityService.asmx" ;
//<ReplaceWithWse>
SmartInstitute.Automation.SmartInstituteServices.SecurityService.CredentialSoapHeader header =
new SmartInstitute.Automation.SmartInstituteServices.SecurityService.CredentialSoapHeader();
header.Username = _Application.Settings.UserInfo.UserName;
header.PasswordHash = _Application.Settings.UserInfo.UserPassword;
header.VersionNo = _Application.Settings.VersionNo;
SetProxy(service);
service.CredentialSoapHeaderValue = header;
//</ReplaceWithWse>
return service;
}
/// <summary>
/// Contruct a Course web service proxy ready to be called
/// </summary>
/// <returns></returns>
public static CourseService GetCourseService()
{
CourseService service = new CourseService();
service.Url = _Application.Settings.WebServiceUrl + "CourseService.asmx";
SmartInstitute.Automation.SmartInstituteServices.CourseService.CredentialSoapHeader header =
new SmartInstitute.Automation.SmartInstituteServices.CourseService.CredentialSoapHeader();
header.Username = _Application.Settings.UserInfo.UserName;
header.PasswordHash = _Application.Settings.UserInfo.UserPassword;
header.VersionNo = _Application.Settings.VersionNo;
service.CredentialSoapHeaderValue = header;
SetProxy(service);
return service;
}
public static AccountService GetAccountsService()
{
AccountService service = new AccountService();
service.Url = _Application.Settings.WebServiceUrl + "AccountService.asmx";
// set credential soap header
SmartInstitute.Automation.SmartInstituteServices.AccountService.CredentialSoapHeader header =
new SmartInstitute.Automation.SmartInstituteServices.AccountService.CredentialSoapHeader();
header.Username = _Application.Settings.UserInfo.UserName;
header.PasswordHash = _Application.Settings.UserInfo.UserPassword;
header.VersionNo = _Application.Settings.VersionNo;
// set the header to send
service.CredentialSoapHeaderValue = header;
SetProxy(service);
return service;
}
private static void SetProxy(SoapHttpClientProtocol serviceProxy)
{
// Turn off proxy if set
if (_Application.Settings.NoProxy)
serviceProxy.Proxy = new WebProxy();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here