// --------------------------------------------------------------------------------
// Module: ListenerCore.asmx.cs
// Author: SGregory
// Date: 03 March 2002
// Description: This file contains the Web Service entry point for the 2nd
// generation Registration.NET Service, using the new Microsoft WSE.
//
// The WDSK is an implementation of several new generation standards
// designed to make Web Services more secure, fault tolerant and
// geenrally more useful. This includes:
//
// WS-Security encryption, signing SOAP messages
// WS-Routing dynamic routing of a message between end points
// WS-Attachments binary attachment support
//
// The web service exposures are part of the eqos.com/webservices
// namespace.
//
// We could have added our Web service logic directly to this file,
// so that the service class would be included directly in this
// .asmx file. We decided to use a separate file, into an assembly
// called Eqos.RegistrationService.Engine. The fact that it is a
// separate assembly, means we can access it from several clients:
//
// * This Web Service Exists
// * MIS/Admin pages written in ASP.NET Exists
// * An internal (trusted) client Ficticious
//
// Each public method is signified with an attribute [WebMethod].
// This signifies that the method should be accessible across teh Web.
// The following API is thus accessible:
//
// * public IsCollaboratorRegistered(string vstrEnvUUID)
// * public string IsCollaboratorRegisteredForTrial(string vstrEnvUUID)
// * public string IsCollaboratorRegisteredForProduction(string vstrEnvUUID)
// * public string RegisterCollaborator(string vstrEnvUUID, string vstrEnvName,string vstrEnvVersion, string vstrEnvRelease, string vstrEnvUpdateDesc, string vstrOwnerOrgName, string vstrOwnerContactName, string vstrEnvIPAddress, string vstrEnvURL)
// * public string NotifyCollaboratorUpgrade(string vstrEnvUUID, string vstrEnvName, string vstrEnvVersionFrom, string vstrEnvReleaseFrom, string vstrEnvUpdateDescFrom, string vstrEnvVersionTo, string vstrEnvReleaseTo, string vstrEnvUpdateDescTo, string vstrOwnerOrgName, string vstrOwnerContactName, bool vblnJustCheckWouldUpgrade)
// * public string NotifyCollaboratorUsage(string vstrEnvUUID, string vstrEnvName, string vstrUsageType, string vstrUsageValue)
// * public string IsCollaboratorBarred(string vstrEnvUUID)
// * public string BarCollaborator(string vstrEnvUUID, bool vblnBarEnv)
// * public string CreateUsageCookie(string vstrEnvUUID)
//
// Each method perfoms some basic operrations:
//
// 1) Log Entry Point via Logger
// 2) Make call to relevant Class method
// 3) Log Exit with result via Logger
//
// Caught Exceptions result in a call to WSCommon.ConstructFaultFromError() which
// creates a SOAP fault packet for return to the client.
//
// --------------------------------------------------------------------------------
// $Archive: <VSS Path To File>/ListenerCore.asmx.cs $
// $Revision: 1 $ changed on $Date: 03 March 2002 15:21 $
// Last changed by $Author: SGregory $
// --------------------------------------------------------------------------------
using System;
using System.Web;
using System.Web.Services; // Web Services exposure
using Microsoft.Web.Services;
using Microsoft.Web.Services.Security; // For WS-Security support
// --------------------------------------------------------------------------------
// Namespace: Eqos.RegistrationService.Presentation.WebServiceFacade
// Author: sgregory
// Date: 25 February 2002
// Description: This namespace encapsulates the core function of the Registration
// Service, and supports the following discrete units of work:
//
// * IsCollaboratorRegistered
// * IsCollaboratorRegisteredForTrial
// * IsCollaboratorRegisteredForProduction
// * RegisterCollaborator
// * NotifyCollaboratorUpgrade
// * NotifyCollaboratorUsage
// * IsCollaboratorBarred
// * BarCollaborator
// + CreateUsageCookie
//
//
//
// NOTE: Format of the vstrEnvUUID entry.
//
// This used to be a simple 32 character GUID representation e.g.
// 12345678901234567890123456789012.
//
// As of 22 June 2001, I've changed this so that each UUID passed to
// the Web Service is of the following format:
//
// UUID 32 chars
// eCryptoType 1 char (0 = Light encryption, 1 = Standard encryption)
// Checksum nn chars (4 = Light encryption, 20 = Standard encryption)
//
// This allows us to cater for French clients where the Crypto API does not
// work.
//
// During each call, the vstrEnvUUID string is split out into these 3
// pieces of information.
//
// --------------------------------------------------------------------------------
namespace Eqos.RegistrationService.Presentation.WebServiceFacade
{
using Eqos.SystemServices.DebugSupport; // CallTracking, ExceptionTracking and ContractCheck
using Eqos.SystemServices.Aspects; // For SoapExtensions
using Eqos.RegistrationService.Engine; // For main middle tier classes
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>The Registration.NET Web Service entry point for ALL operations</summary>
/// <remarks>
/// Contains the implementation of the API described in the file header.
/// </remarks>
[WebService(Namespace="http://eqos.com/webservices/")]
[CLSCompliant(true)] // This class can be used from any .NET Language
//[CallTracking("Eqos Registration Service")] // Tracks all calls
//[ExceptionTracking("Eqos Registration Service")] // Tracks method parameters on return from methods throwing exceptions
public class ListenerCore : System.Web.Services.WebService
{
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Constructor</summary>
/// <preconditions>Object being initialised</preconditions>
/// <postconditions>Steady state reached</postconditions>
public ListenerCore()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
// Registration Web Service API
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Checks to see if the Environment UUID is defined in the Registration database at all</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <returns type="string">XML representing success or a SOAP fault</returns>
/// <preconditions>Valid Environment UUID packet</preconditions>
/// <postconditions>Result returned in string</postconditions>
[WebMethod]
public string IsCollaboratorRegistered(
string vstrEnvUUID)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.IsCollaboratorRegistered(
arrContext,
vstrEnvUUID);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Checks to see if the Environment UUID is defined in the Registration database as Trial</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <returns type="string">XML representing success or a SOAP fault</returns>
/// <preconditions>Valid Environment UUID packet</preconditions>
/// <postconditions>Result returned in string</postconditions>
[WebMethod]
public string IsCollaboratorRegisteredForTrial(
string vstrEnvUUID)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.IsCollaboratorRegisteredForTrial(
arrContext,
vstrEnvUUID);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Checks to see if the Environment UUID is defined in the Registration database as Production</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <returns type="string">XML representing success or a SOAP fault</returns>
/// <preconditions>Valid Environment UUID packet</preconditions>
/// <postconditions>Result returned in string</postconditions>
[WebMethod]
public string IsCollaboratorRegisteredForProduction(
string vstrEnvUUID)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.IsCollaboratorRegisteredForProduction(
arrContext,
vstrEnvUUID);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Attempts to register the Environment</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <param name="vstrEnvName" type="string">Short Name of Environment</param>
/// <param name="vstrEnvVersion" type="string">Environment Version</param>
/// <param name="vstrEnvRelease" type="string">Environment Release</param>
/// <param name="vstrEnvUpdateDesc" type="string">Environment Service Pack description</param>
/// <param name="vstrOwnerOrgName" type="string">Owning Company</param>
/// <param name="vstrOwnerContactName" type="string">Owning Company contact</param>
/// <param name="vstrEnvIPAddress" type="string">IP Address of client</param>
/// <param name="vstrEnvURL" type="string">Base URL of Environment</param>
/// <returns type="string">XML representing success or a SOAP fault</returns>
/// <preconditions>Valid inputs</preconditions>
/// <postconditions>String returned with Usage Cookie and message XML or SOAP failure</postconditions>
[WebMethod]
//[EncryptionExtension(Decrypt=DecryptMode.Request)]
public string RegisterCollaborator(
string vstrEnvUUID,
string vstrEnvName,
string vstrEnvVersion,
string vstrEnvRelease,
string vstrEnvUpdateDesc,
string vstrOwnerOrgName,
string vstrOwnerContactName,
string vstrEnvIPAddress,
string vstrEnvURL)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.RegisterCollaborator(
arrContext,
vstrEnvUUID,
vstrEnvName,
vstrEnvVersion,
vstrEnvRelease,
vstrEnvUpdateDesc,
vstrOwnerOrgName,
vstrOwnerContactName,
vstrEnvIPAddress,
vstrEnvURL);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Record an Environment Upgrade</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <param name="vstrEnvName" type="string">Short Name of Env</param>
/// <param name="vstrEnvVersionFrom" type="string">Env Version</param>
/// <param name="vstrEnvReleaseFrom" type="string">Env Release</param>
/// <param name="vstrEnvUpdateDescFrom" type="string">Env Service Pack description</param>
/// <param name="vstrEnvVersionTo" type="string">Env Version</param>
/// <param name="vstrEnvReleaseTo" type="string">Env Release</param>
/// <param name="vstrEnvUpdateDescTo" type="string">Env Service Pack description</param>
/// <param name="vstrOwnerOrgName" type="string">Organsiation Name</param>
/// <param name="vstrOwnerContactName" type="string">Contact Name</param>
/// <param name="vblnJustCheckWouldUpgrade" type="bool">If true, don't do the upgrade - just check</param>
/// <returns type="string">String representing result</returns>
/// <preconditions>Valid inputs</preconditions>
/// <postconditions>String returned indicating success or SOAP failure</postconditions>
[WebMethod]
//[EncryptionExtension(Decrypt=DecryptMode.Request)]
public string NotifyCollaboratorUpgrade(
string vstrEnvUUID,
string vstrEnvName,
string vstrEnvVersionFrom,
string vstrEnvReleaseFrom,
string vstrEnvUpdateDescFrom,
string vstrEnvVersionTo,
string vstrEnvReleaseTo,
string vstrEnvUpdateDescTo,
string vstrOwnerOrgName,
string vstrOwnerContactName,
bool vblnJustCheckWouldUpgrade)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.NotifyCollaboratorUpgrade(
arrContext,
vstrEnvUUID,
vstrEnvName,
vstrEnvVersionFrom,
vstrEnvReleaseFrom,
vstrEnvUpdateDescFrom,
vstrEnvVersionTo,
vstrEnvReleaseTo,
vstrEnvUpdateDescTo,
vstrOwnerOrgName,
vstrOwnerContactName,
vblnJustCheckWouldUpgrade);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Records usage information update from client</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <param name="vstrEnvName" type="string">Env Name</param>
/// <param name="vstrUsageType" type="string">
/// Event Key based on combination of:
/// -- 'USRCOUNT' Number of Users added
/// -- 'ORGCOUNT' Number of Companies added
/// -- 'APPCOUNT' Number of Applications added
/// -- 'FRMCOUNT' Number of Forms added
/// -- 'FLDCOUNT' Number of Fields added
/// -- 'LGNCOUNT' Number of Users logged on
/// </param>
/// <param name="vstrUsageValue" type="string">Value of Events as a Comma Delimited String</param>
/// <returns type="string">XML representing result</returns>
/// <preconditions>Valid inputs</preconditions>
/// <postconditions>String returned with Usage Cookie and message XML or SOAP failure</postconditions>
[WebMethod]
//[EncryptionExtension(Decrypt=DecryptMode.Request)]
public string NotifyCollaboratorUsage(
string vstrEnvUUID,
string vstrEnvName,
string vstrUsageType,
string vstrUsageValue)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.NotifyCollaboratorUsage(
arrContext,
vstrEnvUUID,
vstrEnvName,
vstrUsageType,
vstrUsageValue);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Checks to see if the Collaborator Environment is barred</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <returns type="string">XML representing result</returns>
/// <preconditions>Valid inputs</preconditions>
/// <postconditions>String returned with status response or SOAP failure</postconditions>
[WebMethod]
public string IsCollaboratorBarred(string vstrEnvUUID)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.IsCollaboratorBarred(
arrContext,
vstrEnvUUID);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Attempts to bar or unbar Environment</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <param name="vblnBarEnv" type="bool">true if request to bar, false to unbar</param>
/// <returns type="string">XML representing result</returns>
/// <preconditions>Valid inputs</preconditions>
/// <postconditions>String returned with status response or SOAP failure</postconditions>
[WebMethod]
//[EncryptionExtension(Decrypt=DecryptMode.Request)]
public string BarCollaborator(
string vstrEnvUUID,
bool vblnBarEnv)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.BarCollaborator(
arrContext,
vstrEnvUUID,
vblnBarEnv);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
// Not accessible by Web Access - only from Administrative console
/// <author>sgregory</author>
/// <date>01 May 2002</date>
/// <summary>Creates a Usage cookie for an Environment</summary>
/// <param name="vstrEnvUUID" type="string">Special Environment UUID (including hash)</param>
/// <returns type="string">String representing response</returns>
/// <preconditions>Valid inputs</preconditions>
/// <postconditions>String returned with Usage Cookie and message XML or SOAP failure</postconditions>
public string CreateUsageCookie(
string vstrEnvUUID)
{
string strRet = String.Empty;
EqosNameServiceCoreCOMPlus objRegSvcCore = null;
try
{
// Verify that a SOAP request was received, with valid credentials
// and a signature
WSCommon.ValidateCredentials(HttpSoapContext.RequestContext);
// Get the HTTP Context information we desire
string[] arrContext = new string[1];
WSCommon.BuildContextArray(this.Context);
arrContext[0] = WSCommon.BuildContextArrayAsXML(this.Context);
// Create a mid tier class to handle the workload
objRegSvcCore = new EqosNameServiceCoreCOMPlus();
// Make the call
strRet = objRegSvcCore.CreateUsageCookie(
arrContext,
vstrEnvUUID);
}
catch(Exception e)
{
// Error logging will already have been done lower down
strRet = WSCommon.ConstructFaultFromError(e, false);
}
finally
{
// Tidy up
if (objRegSvcCore != null)
objRegSvcCore.Dispose();
}
return strRet;
}
}
}