SoapMessageStage SoapMessageStage SoapMessageStage SoapMessageStage Enum

定义

指定 SOAP 消息的处理阶段。Specifies the processing stage of a SOAP message.

public enum class SoapMessageStage
public enum SoapMessageStage
type SoapMessageStage = 
Public Enum SoapMessageStage
继承
SoapMessageStageSoapMessageStageSoapMessageStageSoapMessageStage

字段

AfterDeserialize AfterDeserialize AfterDeserialize AfterDeserialize 8

恰好在将 SoapMessage 从 SOAP 消息反序列化到对象之后的阶段。The stage just after a SoapMessage is deserialized from a SOAP message into an object.

AfterSerialize AfterSerialize AfterSerialize AfterSerialize 2

恰好在序列化 SoapMessage 之后,但在通过网络发送 SOAP 消息之前的阶段。The stage just after a SoapMessage is serialized, but before the SOAP message is sent over the wire.

BeforeDeserialize BeforeDeserialize BeforeDeserialize BeforeDeserialize 4

恰好在将 SoapMessage 从通过网络发送的 SOAP 消息反序列化到对象之前的阶段。The stage just before a SoapMessage is deserialized from the SOAP message sent across the network into an object.

BeforeSerialize BeforeSerialize BeforeSerialize BeforeSerialize 1

恰好在序列化 SoapMessage 之前的阶段。The stage just prior to a SoapMessage being serialized.

示例

下面的示例是 SOAP 扩展的片段, 它实现ProcessMessage方法。The following example is a fragment of a SOAP extension, which implements the ProcessMessage method. 在方法中, 处理SoapMessage是特定于的SoapMessageStageProcessMessageWithin the ProcessMessage method, processing of a SoapMessage is handled specific to the SoapMessageStage.

// Process the SOAP message received and write to log file.
void ProcessMessage( SoapMessage^ message )
{
   switch ( message->Stage )
   {
      case SoapMessageStage::BeforeSerialize:
         break;
      case SoapMessageStage::AfterSerialize:
         WriteOutput( message );
         break;
      case SoapMessageStage::BeforeDeserialize:
         WriteInput( message );
         break;
      case SoapMessageStage::AfterDeserialize:
         break;
      default:
         throw gcnew Exception( "invalid stage" );
   }
}
// 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( message );
         break;
      case SoapMessageStage.BeforeDeserialize:
         WriteInput( message );
         break;
      case SoapMessageStage.AfterDeserialize:
         break;
      default:
         throw new Exception("invalid stage");
   }
}
  ' 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(message)
        Case SoapMessageStage.BeforeDeserialize
           WriteInput(message)
        Case SoapMessageStage.AfterDeserialize
        Case Else
              Throw New Exception("invalid stage")
     End Select
End Sub

注解

ASP.NET 提供使用 SOAP 调用 Web 服务的扩展性机制。ASP.NET provides an extensibility mechanism for calling Web Services using SOAP. 扩展性机制围绕SoapExtension , 可以在客户端或服务器上的消息处理中的特定阶段检查或修改消息。The extensibility mechanism revolves around a SoapExtension that can inspect or modify a message at specific stages in message processing on either the client or the server. 此枚举指定的处理阶段SoapMessageThis enumeration specifies the processing stage of the SoapMessage.

下表显示了在 SOAP 客户端和服务器处理期间每个阶段发生的时间。The following table shows when each stage occurs during SOAP client and server processing.

SoapMessageStage 处理SoapClientMessage过程中During SoapClientMessage processing 处理SoapServerMessage过程中During SoapServerMessage processing
AfterDeserialize 在包含来自 XML Web service 方法调用的响应的 SOAP 消息反序列化为对象, 但在客户端收到反序列化的结果之前发生。Occurs after the SOAP message containing the response from an XML Web service method invocation has been deserialized into an object, but prior to the client receiving the deserialized results. 在包含表示 XML Web service 方法调用的 SOAP 消息的网络请求反序列化为对象之后发生, 但在调用表示 XML Web service 方法的对象上的方法之前发生。Occurs after a network request containing a SOAP message representing an XML Web service method invocation is deserialized into an object, but prior to the method on that object representing the XML Web service method is called.
AfterSerialize 在客户端调用 XML Web service 方法并将参数序列化为 XML 之后但在包含 XML 的 SOAP 消息通过网络发送之前发生。Occurs after a client invokes an XML Web service method and the parameters are serialized into XML, but prior to the SOAP message containing that XML is sent over the network. 在 XML Web service 方法返回后发生, 并且所有返回值都序列化为 XML, 但在包含 XML 的 SOAP 消息通过网络发送之前。Occurs after an XML Web service method returns and any return values are serialized into XML, but prior to the SOAP message containing that XML is sent over the network.
BeforeDeserialize 在收到来自 XML Web service 方法调用的网络响应之后、包含 SOAP 消息的响应被反序列化为对象之后发生。Occurs after the network response from an XML Web service method invocation has been received, but just before the response containing the SOAP message is deserialized into an object. 当 Web 服务器收到包含 XML Web service 方法调用的 SOAP 消息的网络请求, 但在将 SOAP 消息反序列化为对象之前发生。Occurs after a network request containing the SOAP message for an XML Web service method invocation is received by the Web server, but prior to the SOAP message being deserialized into an object.
BeforeSerialize 在客户端调用 XML Web service 方法之后但在序列化调用之前发生。Occurs after a client invokes an XML Web service method, but prior to the invocation being serialized. 在对 XML Web service 方法的调用返回之后、但在返回值被序列化并通过网络发送回客户端之前发生。Occurs after the invocation to the XML Web service method returns, but prior to the return values being serialized and sent over the wire back to the client.

适用于

另请参阅