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 _
)
[C#]
protected void EnsureStage(
 SoapMessageStage stage
);
[C++]
protected: void EnsureStage(
 SoapMessageStage stage
);
[JScript]
protected function EnsureStage(
   stage : SoapMessageStage
);

Parameters

stage
The SoapMessageStage asserted.

Exceptions

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

Remarks

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.

Example

[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

[C#] 
EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize);

[C++] 
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.

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

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

Show:
© 2014 Microsoft