Export (0) Print
Expand All

SoapMessage.EnsureStage Method

Ensures that the SoapMessageStage of the call to the XML Web service method is the stage or stages passed in. If the current processing stage is not one of the stages passed in, an exception is thrown.

[Visual Basic]
Protected Sub EnsureStage( _
   ByVal stage As SoapMessageStage _
protected void EnsureStage(
 SoapMessageStage stage
protected: void EnsureStage(
 SoapMessageStage stage
protected function EnsureStage(
   stage : SoapMessageStage


The SoapMessageStage asserted.


Exception Type Condition
InvalidOperationException The current SoapMessageStage is not the asserted stage or stages.


Multiple stages can be asserted by performing a bitwise OR operation on multiple instances of the SoapMessageStage class.

EnsureStage can be called during any SoapMessageStage.


[Visual Basic, C#, C++] The following example asserts that the current SoapMessageStage is either BeforeSerialize or BeforeDeserialize; if it is not, an exception is thrown.

[Visual Basic] 
EnsureStage((SoapMessageStage.BeforeSerialize Or SoapMessageStage.BeforeDeserialize))
      End Sub 'Main

EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize);

EnsureStage(static_cast<SoapMessageStage>(SoapMessageStage::BeforeSerialize | SoapMessageStage::BeforeDeserialize));

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


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

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

© 2015 Microsoft