Configuring Your .Net Application for iWay Explorer

How to:

Before you use iWay Explorer to create service schemas, you must configure each target .Net application to enable class and method exploration. iWay Explorer creates service schemas based on the classes and methods you expose in the application. The adapter defines .Net custom attributes that act as markers for which methods are to be exposed and provides the invocation specifications for each exposed method.

Note: You must configure each .Net application with which you want the adapter to exchange data.


Top of page

x
Procedure: How to Configure Your .Net Application for iWay Explorer
  1. Locate the assembly for the .Net application for which you must generate metadata.
  2. Open the assembly using the Microsoft Visual Studio .Net editor.
  3. Depending on your environment (32-bit or 64-bit), import the iwclr32.dll or iwclr64.dll file into the assembly.

    For example:

    using System; 
    using System.Xml;
    using System.Text;
    using iwclr32;
  4. Revise the code to add the custom attributes, including the location of the method.

    Note: All the custom attributes are packaged in iwclr32.dll and iwclr64.dll, which belong to the iwclr namespace. Adding a reference to iwclr32.dll or iwclr64.dll on the local machine makes the attributes available to any .Net project.

    For an example, see Adding the Custom Attributes.

  5. Save and recompile the assembly.


Example: Adding the Custom Attributes

The following is sample DLL code with the custom attributes added.

[AgentAttribute("Math Agent")]public class Math
{
const String ADD_INPUT_SCHEMA = "<xs:schema
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">" +
          "<xs:element name=\"add\">" +
          "<xs:complexType>" +
          "<xs:sequence>" +
          "<xs:element maxOccurs=\"unbounded\" name=\"parm\"
               type=\"xs:int\"/>" +
          "</xs:sequence>" +
          "</xs:complexType>" +
          "</xs:element>" +
          "</xs:schema>";
const String ADD_OUTPUT_SCHEMA = "<xs:schema
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">" +
          "<xs:element name=\"total\" type=\"xs:int\"/>" +
          "</xs:schema>";
public Math()[ParamsInParamsOutAttribute("Computes the Square Root of a Real Number")]      public double Sqrt (double number)
      {
         return System.Math.Sqrt(number);
      }[ParamsInParamsOutAttribute("Computes the sine of a decimal angle in 
degrees")]      public double Sine (double angle)
      {
      return System.Math.Sin(angle);
      }[ParamsInParamsOutAttribute("Computes the cosine of a decimal angle in 
degrees")]      public double Cosine (double angle)
      {
      return System.Math.Cos(angle);
      }
[ParamsInParamsOutAttribute("Computes the exponentiation a^b")] 
      public double Exponent (double a , double b)
      {
      return System.Math.Pow(a, b);
      }[ParamsInParamsOutAttribute("Multiplies two Integers")] 
      public int Multiply (int a , int b)
      {
      return a * b;
      }[ParamsInParamsOutAttribute("Multiplies two Floats")] 
      public float Multiply (float a , float b)
      {
      return a * b;
      }[XmlInXmlOutAttribute("Adds one or more integers", 
"add",ADD_INPUT_SCHEMA, "total", ADD_OUTPUT_SCHEMA)]      public XmlElement Add(XmlElement input)

where:

AgentAttribute

Is applied to classes that must be exposed.

ParamsInParamsOutAttribute

Is applied to methods that must be exposed, and have only primitive types or structures or arrays that only use primitive types, as input and output.

XMLInXMLOutAttribute

Is applied to methods that must be exposed and have only an XML element as input and an XML element as output.

ParameterAttribute

Is applied to give more descriptive information about parameters that are simple types. For example, in a class exposing a divide method, it makes sense to know which of a pair of input parameters of type System.Int32 is the denominator.

Note: For the above descriptions, simple types are any of the .Net primitive types (for example, System.Int32, System.Byte, and so on) and System.String. An XML document by definition is represented using an instance of the .Net System.Xml.XmlDocument class.


iWay Software