DekGenius.com
[ Team LiB ] Previous Section Next Section

SoapMessage

System.Web.Services.Protocols (system.web.services.dll)abstract class

This class represents a SOAP request or SOAP response used to communicate between a web service and proxy class. The SoapMessage class is used primarily for SOAP extensions. SOAP extensions, which derive from SoapExtension, receive a SoapMessage object at each SoapMessageStage as an argument to SoapExtension.ProcessMessage( ) method, which is called automatically by the ASP.NET framework.

The SoapMessage class provides methods that allow you to retrieve the web service method parameters and the return value encoded in the SOAP message. For a SoapClientMessage, you should use the GetInParameterValue( ) method if the SOAP message is in the SoapMessageStage.BeforeSerialize stage, or the GetOutParameterValue( ) method if it's in the SoapMessageStage.AfterSerialize stage. For a SoapServerMessage, the reverse is true.

To verify that the parameters are available, you can use the EnsureInStage( ) or EnsureOutStage( ) method (a System.InvalidOperationException will be thrown if the message is not in a compatible stage). Alternatively, you can use the Stage property to determine the state when the SoapMessage was generated.

public abstract class SoapMessage {
// Public Instance Properties
   public abstract string Action{get; }
   public string ContentEncoding{set; get; }
   public string ContentType{set; get; }
   public SoapException Exception{get; }
   public SoapHeaderCollection Headers{get; }
   public abstract LogicalMethodInfo MethodInfo{get; }
   public abstract bool OneWay{get; }
   public SoapMessageStage Stage{get; }
   public Stream Stream{get; }
   public abstract string Url{get; }
// Public Instance Methods
   public object GetInParameterValue(int index);
   public object GetOutParameterValue(int index);
   public object GetReturnValue( );
// Protected Instance Methods
   protected abstract void EnsureInStage( );
   protected abstract void EnsureOutStage( );
   protected void EnsureStage(SoapMessageStage stage);
}

Subclasses

SoapClientMessage, SoapServerMessage

Passed To

SoapExtension.ProcessMessage( )

    [ Team LiB ] Previous Section Next Section