LogicalMethodInfo Class (System.Web.Services.Protocols)

Switch View :
ScriptFree
.NET Framework Class Library
LogicalMethodInfo Class

Represents the attributes and metadata for an XML Web service method. This class cannot be inherited.

Inheritance Hierarchy

System.Object
  System.Web.Services.Protocols.LogicalMethodInfo

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)
Syntax

Visual Basic
Public NotInheritable Class LogicalMethodInfo
C#
public sealed class LogicalMethodInfo
Visual C++
public ref class LogicalMethodInfo sealed
F#
[<Sealed>]
type LogicalMethodInfo =  class end

The LogicalMethodInfo type exposes the following members.

Constructors

  Name Description
Public method LogicalMethodInfo Initializes a new instance of the LogicalMethodInfo class with the MethodInfo passed in.
Top
Properties

  Name Description
Public property AsyncCallbackParameter Gets the parameter information for the AsyncCallback parameter of a Begin method in an asynchronous invocation.
Public property AsyncResultParameter Gets the return value of a Begin asynchronous method invocation.
Public property AsyncStateParameter Gets the parameter information for the AsyncState parameter of a Begin method in an asynchronous invocation.
Public property BeginMethodInfo Gets the attributes and metadata for a Begin method in an asynchronous invocation.
Public property CustomAttributeProvider Gets the custom attributes applied to the method.
Public property DeclaringType Gets the class that declares the method represented by the current LogicalMethodInfo.
Public property EndMethodInfo Gets the attributes and metadata for an End method of an asynchronous invocation to a method.
Public property InParameters Gets the parameters passed into the method represented by the instance of LogicalMethodInfo.
Public property IsAsync Gets a value indicating whether the method represented by the instance of LogicalMethodInfo is invoked asynchronously.
Public property IsVoid Gets a value indicating whether the return type for the method represented by the instance of LogicalMethodInfo is void.
Public property MethodInfo Gets the attributes and metadata for a synchronous method.
Public property Name Gets the name of the method represented by this LogicalMethodInfo.
Public property OutParameters Gets the out parameters for the method.
Public property Parameters Gets the parameters for the method.
Public property ReturnType Gets the return type of this method.
Public property ReturnTypeCustomAttributeProvider Gets the custom attributes for the return type.
Top
Methods

  Name Description
Public method BeginInvoke Begins an asynchronous invocation of the method represented by this LogicalMethodInfo.
Public method Static member Create(MethodInfo[]) Given an array of MethodInfo that can contain information about both asynchronous and synchronous methods, creates an array of LogicalMethodInfo.
Public method Static member Create(MethodInfo[], LogicalMethodTypes) Given an array of MethodInfo, where the returned array of LogicalMethodInfo can be restricted to only asynchronous or synchronous methods, creates an array of LogicalMethodInfo.
Public method EndInvoke Ends an asynchronous invocation of the method represented by the current LogicalMethodInfo.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetCustomAttribute Returns the first custom attribute applied to the type, if any custom attributes are applied to the type.
Public method GetCustomAttributes Returns the custom attributes applied to the specified type.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Invoke Invokes the method represented by the current LogicalMethodInfo.
Public method Static member IsBeginMethod Returns a value indicating whether the method passed in represents a Begin method of an asynchronous invocation.
Public method Static member IsEndMethod Returns a value indicating whether the method passed in represents an End method of an asynchronous invocation.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current LogicalMethodInfo. (Overrides Object.ToString().)
Top
Remarks

LogicalMethodInfo is used primarily by a SOAP extension to interrogate the details of the XML Web service method with which the SOAP extension is configured to run. Depending on how the SOAP extension is configured, it can find out details about the XML Web service method in the GetInitializer method of SoapExtension that takes a LogicalMethodInfo. The LogicalMethodInfo provides details such as the XML Web service method's parameters by accessing the Parameters property and any custom attributes applied to the XML Web service method using the GetCustomAttributes property.

For more details on SOAP extensions see the SoapExtension class or [<topic://cpconAlteringSOAPMessageUsingSOAPExtensions>].

Examples

Visual Basic

' Process the SOAP message received and write to log file.
Public Overrides Sub ProcessMessage(message As SoapMessage)
   Select Case message.Stage
      Case SoapMessageStage.BeforeSerialize
      Case SoapMessageStage.AfterSerialize
         WriteOutput(CType(message, SoapServerMessage))
      Case SoapMessageStage.BeforeDeserialize
         WriteInput(CType(message, SoapServerMessage))
      Case SoapMessageStage.AfterDeserialize
      Case Else
            Throw New Exception("invalid stage")
   End Select
End Sub 'ProcessMessage

' Write the contents of the incoming SOAP message to the log file.
Public Sub WriteInput(message As SoapServerMessage)
   ' Utility method to copy the contents of one stream to another.
   Copy(oldStream, newStream)
   Dim myFileStream As New FileStream(filename, FileMode.Append, FileAccess.Write)
   Dim myStreamWriter As New StreamWriter(myFileStream)
   myStreamWriter.WriteLine("================================== Request at " + _
                             DateTime.Now)
   myStreamWriter.WriteLine("The method that has been invoked is : ")
   myStreamWriter.WriteLine(ControlChars.Tab + message.MethodInfo.Name)
   myStreamWriter.WriteLine("The contents of the SOAP envelope are : ")
   myStreamWriter.Flush()
   newStream.Position = 0
   Copy(newStream, myFileStream)
   myFileStream.Close()
   newStream.Position = 0
End Sub 'WriteInput

' Write the contents of the outgoing SOAP message to the log file.
Public Sub WriteOutput(message As SoapServerMessage)
   newStream.Position = 0
   Dim myFileStream As New FileStream(filename, FileMode.Append, FileAccess.Write)
   Dim myStreamWriter As New StreamWriter(myFileStream)
   myStreamWriter.WriteLine("---------------------------------- Response at " + _
                             DateTime.Now)
   myStreamWriter.Flush()
   ' Utility method to copy the contents of one stream to another.
   Copy(newStream, myFileStream)
   myFileStream.Close()
   newStream.Position = 0
   Copy(newStream, oldStream)
End Sub 'WriteOutput


C#

// Process the SOAP message received and write to log file.
public override void ProcessMessage(SoapMessage message) 
{
   switch (message.Stage) 
   {
      case SoapMessageStage.BeforeSerialize:
         break;
      case SoapMessageStage.AfterSerialize:
         WriteOutput((SoapServerMessage)message);
         break;
      case SoapMessageStage.BeforeDeserialize:
         WriteInput((SoapServerMessage)message);
         break;
      case SoapMessageStage.AfterDeserialize:
         break;
      default:
         throw new Exception("invalid stage");
   }
}

// Write the contents of the incoming SOAP message to the log file.
public void WriteInput(SoapServerMessage message)
{
   // Utility method to copy the contents of one stream to another. 
   Copy(oldStream, newStream);
   FileStream myFileStream = new FileStream(filename, FileMode.Append, FileAccess.Write);
   StreamWriter myStreamWriter = new StreamWriter(myFileStream);
   myStreamWriter.WriteLine("================================== Request at "
      + DateTime.Now);
   myStreamWriter.WriteLine("The method that has been invoked is : ");
   myStreamWriter.WriteLine("\t" + message.MethodInfo.Name);
   myStreamWriter.WriteLine("The contents of the SOAP envelope are : ");
   myStreamWriter.Flush();
   newStream.Position = 0;
   Copy(newStream, myFileStream);
   myFileStream.Close();
   newStream.Position = 0;
}

// Write the contents of the outgoing SOAP message to the log file.
public void WriteOutput(SoapServerMessage message)
{
   newStream.Position = 0;
   FileStream myFileStream = new FileStream(filename, FileMode.Append, FileAccess.Write);
   StreamWriter myStreamWriter = new StreamWriter(myFileStream);
   myStreamWriter.WriteLine("---------------------------------- Response at " 
                                       + DateTime.Now);
   myStreamWriter.Flush();
   // Utility method to copy the contents of one stream to another. 
   Copy(newStream, myFileStream);
   myFileStream.Close();
   newStream.Position = 0;
   Copy(newStream, oldStream);
}


Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Reference