SoapMessageStage Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the processing stage of a SOAP message.
public enum class SoapMessageStage
public enum SoapMessageStage
type SoapMessageStage =
Public Enum SoapMessageStage
- Inheritance
Fields
Name | Value | Description |
---|---|---|
BeforeSerialize | 1 | The stage just prior to a SoapMessage being serialized. |
AfterSerialize | 2 | The stage just after a SoapMessage is serialized, but before the SOAP message is sent over the wire. |
BeforeDeserialize | 4 | The stage just before a SoapMessage is deserialized from the SOAP message sent across the network into an object. |
AfterDeserialize | 8 | The stage just after a SoapMessage is deserialized from a SOAP message into an object. |
Examples
The following example is a fragment of a SOAP extension, which implements the ProcessMessage method. Within 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
Remarks
ASP.NET provides an extensibility mechanism for calling Web Services using SOAP. 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. This enumeration specifies the processing stage of the SoapMessage.
The following table shows when each stage occurs during SOAP client and server processing.
SoapMessageStage |
During SoapClientMessage processing | During SoapServerMessage processing |
---|---|---|
AfterDeserialize |
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. | 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 |
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. | 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 |
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. | 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 |
Occurs after a client invokes an XML Web service method, but prior to the invocation being serialized. | 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. |