This documentation is archived and is not being maintained.

SoapExtension.ProcessMessage Method

When overridden in a derived class, allows a SOAP extension to receive a SoapMessage to process at each SoapMessageStage.

[Visual Basic]
Public MustOverride Sub ProcessMessage( _
   ByVal message As SoapMessage _
)
[C#]
public abstract void ProcessMessage(
 SoapMessage message
);
[C++]
public: virtual void ProcessMessage(
 SoapMessage* message
) = 0;
[JScript]
public abstract function ProcessMessage(
   message : SoapMessage
);

Parameters

message
The SoapMessage to process.

Remarks

ProcessMessage is called at all SoapMessageStage stages for SOAP extensions applied to both XML Web services created using ASP.NET and their clients. At each SoapMessageStage, an instance of a class deriving from SoapMessage is passed to ProcessMessage. If the SOAP extension is running on the XML Web service client, then a SoapClientMessage object is passed into ProcessMessage; otherwise a SoapServerMessage object is passed in.

Example

[Visual Basic, C#, C++] The following example is the ProcessMessage portion of a SOAP extension that logs SOAP requests and SOAP responses. By logging the SoapMessage at the AfterSerialize SoapMessageStage, the SOAP extension accesses the Stream to be sent over the wire. If the SOAP extension is applied to an XML Web service method created using ASP.NET, then the Stream contains the SOAP response from the XML Web service method. If the SOAP extension is applied to an XML Web service client, the Stream contains the SOAP request to an XML Web service method.

[Visual Basic] 
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    


[C#] 
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");
        }
}


[C++] 
public:
    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(S"invalid stage");
        }
    }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

SoapExtension Class | SoapExtension Members | System.Web.Services.Protocols Namespace

Show: