Using Designer with the Package for Microsoft .NET
Overview
With the Package for Microsoft .NET installed, you can use the webMethods for Microsoft Plug-in to scan existing .NET assemblies to determine what methods they contain and then import the methods into Designer. In Designer, you can create services that call those methods. Once a .NET service exists within Designer, it can become part of a flow, just like any other service.
To take advantage of this feature, you must have the Microsoft .NET Framework, which includes the Common Language Runtime (CLR) installed on the same computer as the instance of Integration Server to which Designer is connected. In addition, the location of the .NET assembly must be known to Integration Server. For example, assume that you have used Designer to create the service addInt to call the addInt method in mathAssembly.dll. When you invoke the addInt service on Integration Server, the service calls the addInt method through the CLR.

Using Designer, you can perform the following actions:
You can do this... | Described here... |
---|---|
Import .NET assembly methods into Designer | Importing .NET Methods into Designer. |
Modify information about a .NET method associated with a service | Configuring .NET Assembly Information. |
Manage the way the CLR maintains instance data | Managing Class Lifetimes. |
Importing .NET Methods into Designer
About this task
You can import methods from Microsoft .NET assemblies and use them to create .NET services. webMethods services can consume these .NET services.
To create a .NET service from a .NET method using Designer
Procedure
Results
Input Variables
The trace variable allows you to perform method invocation tracing for a specific service. For more information, see Method Invocation Tracing.
The domain name mentions the name of the domain from where you want this method to be invoked.
The marshallingType variable identifies the marshalling type to be used for a specific service, as described in Marshalling Data. To use a reference ID to marshall data, choose refid. To actually send data in the form of an XML file, choose xml.
The instanceID variable identifies a particular session for object instances using a Session class lifetime, as described in Managing Class Lifetimes. On the first invocation, the instanceID variable should be set to a value zero. If a Session lifetime is configured for an object instance, on subsequent invocations, you should set the variable to the instance ID returned from the first invocation of the method.
Output Variables
As mentioned in Input Variables instanceID is present as an output variable. This variable identifies the instance of the session object and can be used as input for subsequent invocations of the object.
A return variable is also present. The return variable contains the value returned by the method upon completion of its invocation.
Importing COM Objects into Designer
The Microsoft Type Library Importer (TLBIMP) generates a Primary Interop Assembly, which is a .NET assembly, from a COM object. Once an assembly is generated using TLBIMP, you can import the methods from that assembly into Designer as you would any .NET assembly.
In broad overview, these are the steps to import COM objects into Designer as services:
- If you have not already done so, use the
regsvr32
command to register the COM object on the computer where you will make the conversion. - Use TLBIMP to generate the assembly, as in this simple example:
tlbimp COM_object_name /out:output_name
- Use the output file as though it were a .NET assembly and import it into Designer, as described in Importing .NET Methods into Designer.
Configuring .NET Assembly Information
About this task
When you create a service to call a Microsoft .NET method, Integration Server stores information needed by the .NET CLR to load the method into its processing space. If you change the location or name of the .NET assembly in which the method resides, you need to use Designer to modify that information; otherwise, any attempt to call that method from Integration Server will fail.
Information about a particular .NET method resides with the service you have created to call it. In Designer, you can see this information in the .NET Properties tab for the specified service.
The Shared Properties panel of the .NET Properties tab consists of information that is common to all .NET services created from the same assembly:
Property | Description |
---|---|
Domain Name | The name of the application domain in which the service is to run. Editable. |
Assembly Path | The location of the directory that holds the .NET assembly in which the method called by this service resides. Editable. Changing the assembly path of a .NET service applies to all the .NET services in the assembly. |
Assembly Name | The name of the .NET assembly in which the method called by this service resides. Editable. Changing the assembly name of a .NET service applies to all the .NET services in the assembly. |
Domain Configuration File | The configuration file associated with the domain. The file must be located in the Assembly Path. Enter only the file name. For more information about domain configuration file, see Managing Domain Configuration File |
Class Name | The fully qualified name of the class of which the method called by this service is a part. Not editable |
Class Lifetime | The lifetime setting assigned to the class that owns the method called by this service. Editable. For information about valid class lifetime settings, see Managing Class Lifetimes. |
Class Timeout (mins) | The timeout setting assigned to the class that owns the method called by this service. Valid only for a Session lifetime. Editable. See The Class Timeout Value. |
Another property in the .NET Properties tab is unique to the specific .NET service:
Property | Description |
---|---|
Method Name | The name of the method called by this service. |
To change information about a .NET method :
Procedure
Managing Domain Configuration File
The Domain Configuration File is typically used for any configurations associated with the domain, that need to be accessed at the time of service invocation. For example, the information required to access a database, or an input to the service, can be provided in the configuration file.
You must keep the domain configuration file in the same location as the assembly path. Also, enter only the name of the file. The domain configuration file is tightly associated with the particular domain. If you want to run the same service under the same domain with a different configuration file, you must first destroy the domain to remove association with the earlier configuration file. After destroying, recreate the domain, and associate another domain configuration file with the domain.
Ensure that the configuration file has a key named as WhitelistDirectories and that the white-listed directories are specified as value for the key. For more information on white-listed directories, see Specifying white-listed directories.
Managing Class Lifetimes
.NET classes running on the CLR can maintain instance data, which are variables containing information used across multiple invocations of methods on the class. A class instance can maintain instance data according to one of four Class Lifetime settings, described in the following table. All .NET services associated with a class have the same lifetime. When you change the class lifetime for a particular .NET service, Designer modifies the lifetimes of all services associated with the same class.
In Designer, you can manage the class lifetime for a particular .NET service in the .NET Properties tab for that service. The Class Lifetime property has the following valid settings:
Lifetime Setting | Description |
---|---|
Global | The Package for Microsoft .NET creates a single instance of the class, or object, which has an unlimited lifetime. The class shares instance data among all sessions. Use this setting where it is appropriate to gather data to be retrieved by multiple users. You can create only one instance of a global object of a given type. |
Session | The Package for Microsoft .NET creates a separate object for each user. The object exists until the user session is closed or until the object times out. The default is three minutes. See The Class Timeout Value. |
Single-Use | The Package for Microsoft .NET creates and destroys an object each time a .NET service calls a method in the class. Data may be kept during the lifetime of the object. |
Static | The .NET service calls a method that does not require any session data to be kept. All methods of the class are static and the Package for Microsoft .NET does not create an object. |
Use the Static lifetime setting only for static methods.
Modifying Class Lifetime
About this task
The following procedure describes how to modify the Class Lifetime setting for a .NET service.
To modify the Class Lifetime for a .NET service
Procedure
The Class Timeout Value
About this task
The Class Timeout value applies only to .NET services having a Class Lifetime setting of Session. The clock starts when the Package for Microsoft .NET creates an instance of the class. The clock is reset whenever a .NET service accesses the class. If time expires, the object is destroyed. The default value is three minutes. You must choose a different value if you know that the default timeout value would cause the object to be destroyed prematurely under normal usage.
To modify the Class Timeout value for a .NET service
Procedure
- In the Navigation panel, double-click the service for which you want to change the Class Timeout setting.
- Click the .NET Properties tab to bring it to the front.
- In the Class Lifetime list, make sure the Session setting is selected.
- In the Class Timeout field, type the correct timeout value, in minutes.
- On the File menu, click Save.
Invoking a .NET Service from Designer
To test a .NET service using Designer as the client, you use the Run command on the Run menu. Before you attempt to test .NET services, you should understand application domains and the forms of data marshalling available for .NET services. For information on application domains, see Application Domains.
Managing Application Domains
You can create and destroy application domains as explained below.
Using Services to Start and Destroy Application Domains
The first way is through the startDomain and destroyDomain services, which you can find in the WmDotNet package in the Navigation panel of Designer:
WmDotNet/wm/dotnet/Runtime
One advantage of using the startDomain service is that you can assign a .NET configuration file to modify the behavior of the application domain.
Using Integration Server Administratorto Destroy Application Domains
At the time you run a .NET service in Designer, you can specify an application domain in which to run it. If the application domain does not already exist, Integration Server creates it. This dynamic creation feature makes it easy to add application domains as you need them. For more information, see Running a .NET Service in Designer.
Using Integration Server Administrator, you can destroy an application domain on the Manage Application Domain page. This method is easier than using the destroyDomain service because you can find the application domain within a table and click the Destroy link.
For more information, see The Manage Application Domains Page.
Marshalling Data
Marshalling is the process of packing one or more items of data into a message buffer prior to transmitting that message buffer over a communication channel.
If Integration Server were to call a .NET method and it returned an object, such as a SQL connection, Integration Server could not process the object because it has meaning only within .NET. There are two ways to marshall data across the division between Integration Server and .NET. The first way is to use a reference ID, or an instance ID. Instead of bringing the object over, Integration Server assigns an ID. If it is necessary to make another method call that uses that object as an input, Integration Server uses the reference ID. If you want to keep using the same object, such as SQL connection, you should use the reference ID. Note that the reference ID is valid only for the same application domain.
The other way to marshall data is by passing XML. .NET has a built-in XML serializer that takes that object, examines it, and turns it into an XML string. Integration Server can manipulate the XML string and modify data, and then use that XML string as input to another method. If you need to manipulate the object in Java in some way, use XML, but you should be aware of the possible drawbacks. The use of XML is inefficient because you are passing a large string instead of a single ID. Also you need to be careful in designing the manipulation of data within Integration Server because the .NET XML serializer may create an invalid object upon its return. For information on how to choose the marshalling type, see Running a .NET Service in Designer next in this chapter.
Running a .NET Service in Designer
About this task
To run a .NET service in Designer, do the following:
To run a .NET service in Designer