Export (0) Print
Expand All

LogicalMethodInfo Class

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

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

public sealed class LogicalMethodInfo

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>].

// 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);
}

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

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft