ApplicationManifest
ApplicationManifest
The ApplicationManifest class defines the application manifest for a SIP application.
An application manifest is required for all Microsoft Lync Server 2010 applications, and provides the SIP message processing rules needed to correctly handle only those SIP messages of interest to the application. An application uses the ApplicationManifest object to register the application with Lync Server 2010 through the ServerAgent object. Most applications will use only one manifest, but multiple manifests are supported.
The application manifest is represented as an XML document available to the application, either within the source or as a separate file. The document structure of the application manifest is as follows:
<?xml version="1.0" ?>
<lc:applicationManifest
appUri="www.my_server_name_here.com/my_application_name_here"
xmlns:lc=https://schemas.microsoft.com/lcs/2006/05>
--application attributes here--
<lc:splScript>
--message filter script here--
]]></lc:splScript>
</lc:applicationManifest>
The application attributes must precede the message filter script. The lc:appUri attribute is a unique string containing the name of the running application, and is used to identify the application manifest to the server. An HTTP-style URI that contains the domain and the application name is required because it guarantees uniqueness. This URI must be registered upon installation with WMI using the MSFT_SIPApplicationSetting (Updated) WMI class.
The message filter script must be written in the MSPL Scripting Reference (Lync Server 2010 SDK) (MSPL).
For more information about creating and implementing an application manifest, as well as a complete list of application attributes and MSPL instructions, see SIP Application Manifests (Lync Server 2010 SDK).
The ApplicationManifest class is derived from the System.Object class.
Public Methods
The ApplicationManifest class has the following public methods.
Method |
Description |
---|---|
Parses the application manifest specified with the ApplicationManifest.CreateFromFile or ApplicationManifest.CreateFromString method and compiles the content. |
|
Static (Shared). Creates an instance of an ApplicationManifest object from a specified application manifest file. |
|
Static (Shared). Creates an instance of an ApplicationManifest object from a specified string containing an application manifest. |
|
Equals(Object) |
Inherited from System.Object. Determines whether the specified System.Object is equal to the current System.Object. |
GetHashCode() |
Inherited from System.Object. Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table. |
GetType() |
Inherited from System.Object. Gets the System.Type of the current instance. |
Indicates whether the compiled application should be displayed when Compile is called. |
|
ToString() |
Inherited from System.Object. Returns a System.String that represents the current System.Object. |
Public Properties
The ApplicationManifest class has the following public property.
Property |
Description |
---|---|
Data type: StringAccess type: Read-only Contains the application URI as defined in the application manifest. |
Example Code
The following code sample demonstrates the dynamic creation and compilation of an application manifest.
ServerAgent mySA;
string manifest = @"<?xml version=""1.0""?><lc:applicationManifest appUri=""" +
appURI + @""" xmlns:lc=""http://www.my_lc_server_here.com/lcs/2006/05"">" +
"\n" + @"<lc:requestFilter methodNames=""ALL"" strictRoute=""true""/>" +
"\n" + @"<lc:responseFilter reasonCodes=""ALL"" />" +
"\n" + @"<lc:proxyByDefault action=""true"" />" +
"\n" + @"<lc:splScript><![CDATA[" +
"\n" + @" if (sipRequest) { Dispatch (""OnRequest""); return; }" +
"\n" + @" if (sipResponse) { Dispatch (""OnResponse""); return; }" +
"\n" + @" ]]></lc:splScript>" +
"\n" + @"</lc:applicationManifest>";
ApplicationManifest myAppManifest = ApplicationManifest.CreateFromString(manifest);
bool success = true;
try
{
myAppManifest.Compile();
Console.WriteLine("The application manifest was compiled successfully.");
}
catch(CompilerErrorException e)
{
Console.WriteLine("The application manifest could not be compiled successfully:" + e.Message);
success = false;
}
if (success)
{
// Create a new ServerAgent, taking the object instance (presuming it has the dispatch handlers
// OnRequest and OnResponse implemented on it) and the application manifest as parameters.
mySA = new ServerAgent(this, myAppManifest);
}
Requirements
Redistributable: Microsoft Lync Server 2010.
Namespace:Microsoft.Rtc.Sip
Assembly: ServerAgent (in ServerAgent.dll)