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
public final class LogicalMethodInfo
public final class LogicalMethodInfo
Not applicable.

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 SOAP Message Modification Using SOAP Extensions.

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

// Process the SOAP message received and write to log file.
public void ProcessMessage(SoapMessage message) throws Exception
{
    switch(message.get_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");
    }
} //ProcessMessage
   
// 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.get_Now());
    myStreamWriter.WriteLine("The method that has been invoked is : ");
    myStreamWriter.WriteLine("\t" + message.get_MethodInfo().get_Name());
    myStreamWriter.WriteLine("The contents of the SOAP envelope are : ");
    myStreamWriter.Flush();
    newStream.set_Position(0);
    Copy(newStream, myFileStream);
    myFileStream.Close();
    newStream.set_Position(0);
} //WriteInput
   
// Write the contents of the outgoing SOAP message to the log file.
public void WriteOutput(SoapServerMessage message) 
{
    newStream.set_Position(0);
    FileStream myFileStream =  new FileStream(filename, FileMode.Append, 
        FileAccess.Write);
    StreamWriter myStreamWriter = new StreamWriter(myFileStream);
    myStreamWriter.WriteLine("---------------------------------- " 
        + "Response at "  + DateTime.get_Now());
    myStreamWriter.Flush();
    // Utility method to copy the contents of one stream to another. 
    Copy(newStream, myFileStream);
    myFileStream.Close();
    newStream.set_Position(0);
    Copy(newStream, oldStream);
} //WriteOutput
   

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft