SoapClientMessage SoapClientMessage SoapClientMessage SoapClientMessage Class

Definition

Stellt die Daten in einer von einem XML-Webdienstclient gesendeten SOAP-Anforderung oder in einer von diesem empfangenen SOAP-Antwort in einer bestimmten SoapMessageStage dar.Represents the data in a SOAP request sent or a SOAP response received by an XML Web service client at a specific SoapMessageStage. Diese Klasse kann nicht vererbt werden.This class cannot be inherited.

public ref class SoapClientMessage sealed : System::Web::Services::Protocols::SoapMessage
public sealed class SoapClientMessage : System.Web.Services.Protocols.SoapMessage
type SoapClientMessage = class
    inherit SoapMessage
Public NotInheritable Class SoapClientMessage
Inherits SoapMessage
Vererbung
SoapClientMessageSoapClientMessageSoapClientMessageSoapClientMessage

Beispiele

Das folgende Codefragment ist Teil einer SOAP-Erweiterung, die SOAP-Nachrichten von einer XML-Webdienstclient gesendet und empfangen protokolliert.The following code fragment is part of a SOAP extension that logs the SOAP messages sent and received by an XML Web service client. Dieses bestimmte Fragment verarbeitet die SoapClientMessage übergeben die SoapExtension.ProcessMessage Methode der SOAP-Erweiterung durch Schreiben von Eigenschaften der SoapClientMessage in die Protokolldatei.This specific fragment processes the SoapClientMessage passed into the SoapExtension.ProcessMessage method of the SOAP extension by writing properties of the SoapClientMessage to the log file.

// Process the SOAP message received and write to a log file.
void ProcessMessage( SoapMessage^ message )
{
   switch ( message->Stage )
   {
      case SoapMessageStage::BeforeSerialize:
         break;
      case SoapMessageStage::AfterSerialize:
         WriteOutput( dynamic_cast<SoapClientMessage^>(message) );
         break;
      case SoapMessageStage::BeforeDeserialize:
         WriteInput( dynamic_cast<SoapClientMessage^>(message) );
         break;
      case SoapMessageStage::AfterDeserialize:
         break;
      default:
         throw gcnew Exception( "invalid stage" );
   }
}

// Write the contents of the outgoing SOAP message to the log file.
void WriteOutput( SoapClientMessage^ message )
{
   newStream->Position = 0;
   FileStream^ myFileStream = gcnew FileStream( filename, FileMode::Append,
      FileAccess::Write );
   StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream );
   myStreamWriter->WriteLine(
      "================================== Request at {0}", DateTime::Now );
   
   // Print to the log file the request header field for SoapAction header.
   myStreamWriter->WriteLine( "The SoapAction Http request header field is: " );
   myStreamWriter->WriteLine( "\t{0}", message->Action );
   
   // Print to the log file the type of the client that invoked 
   // the XML Web service method.
   myStreamWriter->WriteLine( "The type of the client is: " );
   if ( (message->Client->GetType())->Equals( typeid<MathSvc^> ) )
   {
      myStreamWriter->WriteLine( "\tMathSvc" );
   }
   
   // Print to the log file the method invoked by the client.
   myStreamWriter->WriteLine(
      "The method that has been invoked by the client is:" );
   myStreamWriter->WriteLine( "\t{0}", message->MethodInfo->Name );
   
   // Print to the log file if the method invoked is OneWay.
   if ( message->OneWay )
   {
      myStreamWriter->WriteLine(
         "The client doesn't wait for the server to finish processing" );
   }
   else
   {
      myStreamWriter->WriteLine(
      "The client waits for the server to finish processing" );
   }
   
   // Print to the log file the URL of the site that provides 
   // implementation of the method.
   myStreamWriter->WriteLine(
      "The URL of the XML Web service method that has been requested is: " );
   myStreamWriter->WriteLine( "\t{0}", message->Url );
   myStreamWriter->WriteLine( "The contents of the SOAP envelope are: " );
   myStreamWriter->Flush();
   
   // Copy the contents of one stream to another. 
   Copy( newStream, myFileStream );
   myFileStream->Close();
   newStream->Position = 0;
   
   // Copy the contents of one stream to another. 
   Copy( newStream, oldStream );
}

// Process the SOAP message received and write to a log file.
public override void ProcessMessage(SoapMessage message) 
{
   switch (message.Stage) 
   {
      case SoapMessageStage.BeforeSerialize:
         break;
      case SoapMessageStage.AfterSerialize:
         WriteOutput((SoapClientMessage)message);
         break;
      case SoapMessageStage.BeforeDeserialize:
         WriteInput((SoapClientMessage)message);
         break;
      case SoapMessageStage.AfterDeserialize:
         break;
      default:
         throw new Exception("invalid stage");
   }
}

// Write the contents of the outgoing SOAP message to the log file.
public void WriteOutput(SoapClientMessage message)
{
   newStream.Position = 0;
   FileStream myFileStream = new FileStream(filename, FileMode.Append,
      FileAccess.Write);
   StreamWriter myStreamWriter = new StreamWriter(myFileStream);
   myStreamWriter.WriteLine(
      "================================== Request at "
      + DateTime.Now);

   // Print to the log file the request header field for SoapAction header.
   myStreamWriter.WriteLine("The SoapAction Http request header field is: ");
   myStreamWriter.WriteLine("\t" + message.Action);

   // Print to the log file the type of the client that invoked 
   // the XML Web service method.
   myStreamWriter.WriteLine("The type of the client is: ");
   if((message.Client.GetType()).Equals(typeof(MathSvc)))
      myStreamWriter.WriteLine("\tMathSvc");

   // Print to the log file the method invoked by the client.
   myStreamWriter.WriteLine(
      "The method that has been invoked by the client is:");
   myStreamWriter.WriteLine("\t" + message.MethodInfo.Name);

   // Print to the log file if the method invoked is OneWay.
   if(message.OneWay)
      myStreamWriter.WriteLine(
        "The client doesn't wait for the server to finish processing");
   else
      myStreamWriter.WriteLine(
        "The client waits for the server to finish processing");

   // Print to the log file the URL of the site that provides 
   // implementation of the method.
   myStreamWriter.WriteLine(
      "The URL of the XML Web service method that has been requested is: ");
   myStreamWriter.WriteLine("\t" + message.Url);
   myStreamWriter.WriteLine("The contents of the SOAP envelope are: ");
   myStreamWriter.Flush();

   // Copy the contents of one stream to another. 
   Copy(newStream, myFileStream);
   myFileStream.Close();
   newStream.Position = 0;

   // Copy the contents of one stream to another. 
   Copy(newStream, oldStream);
}
 ' Process the SOAP message received and write to a log file.
 Public Overrides Sub ProcessMessage(message As SoapMessage)
    Select Case message.Stage
       Case SoapMessageStage.BeforeSerialize
       Case SoapMessageStage.AfterSerialize
          WriteOutput(CType(message, SoapClientMessage))
       Case SoapMessageStage.BeforeDeserialize
          WriteInput(CType(message, SoapClientMessage))
       Case SoapMessageStage.AfterDeserialize
       Case Else
             Throw New Exception("invalid stage")
    End Select
 End Sub 'ProcessMessage
 
 
 ' Write the contents of the outgoing SOAP message to the log file.
 Public Sub WriteOutput(message As SoapClientMessage)
    newStream.Position = 0
    Dim myFileStream As New FileStream(filename, FileMode.Append, _
       FileAccess.Write)
    Dim myStreamWriter As New StreamWriter(myFileStream)
    myStreamWriter.WriteLine( _
       "================================== Request at " & DateTime.Now)

    ' Print to the log file the request header field for SoapAction header.
    myStreamWriter.WriteLine("The SoapAction Http request header field is: ")
    myStreamWriter.WriteLine(ControlChars.Tab & message.Action)

    ' Print to the log file the type of the client that invoked
    ' the XML Web service method.
    myStreamWriter.WriteLine("The type of the client is: ")
    If message.Client.GetType().Equals(GetType(MathSvc)) Then
       myStreamWriter.WriteLine(ControlChars.Tab & "MathSvc")
    End If

   ' Print to the log file the method invoked by the client.
    myStreamWriter.WriteLine( _
       "The method that has been invoked by the client is:")
    myStreamWriter.WriteLine(ControlChars.Tab & message.MethodInfo.Name)

    ' Print to the log file if the method invoked is OneWay.
    If message.OneWay Then
       myStreamWriter.WriteLine( _
          "The client doesn't wait for the server to finish processing")
    Else
       myStreamWriter.WriteLine( _
          "The client waits for the server to finish processing")
    End If 

    ' Print to the log file the URL of the site that provides 
    ' implementation of the method.
    myStreamWriter.WriteLine( _
       "The url of the XML Web service method that has been requested is: ")
    myStreamWriter.WriteLine(ControlChars.Tab & message.Url)
    myStreamWriter.WriteLine("The contents of the SOAP envelope are: ")
    myStreamWriter.Flush()

    ' Copy the contents of one stream to another. 
    Copy(newStream, myFileStream)
    myStreamWriter.Close()
    myFileStream.Close()
    newStream.Position = 0

    ' Copy the contents of one stream to another. 
    Copy(newStream, oldStream)
End Sub 'WriteOutput

Eigenschaften

Action Action Action Action

Ruft das SOAPAction-HTTP-Anforderungsheaderfeld für die SOAP-Anforderung oder die SOAP-Antwort ab.Gets the SOAPAction HTTP request header field for the SOAP request or SOAP response.

Client Client Client Client

Ruft eine Instanz der Clientproxyklasse ab, die von SoapHttpClientProtocol abgeleitet ist.Gets an instance of the client proxy class, which derives from SoapHttpClientProtocol.

ContentEncoding ContentEncoding ContentEncoding ContentEncoding

Ruft die Inhalte des Content-Encoding-HTTP-Headers ab oder legt diese fest.Gets or sets the contents of the Content-Encoding HTTP header.

(Inherited from SoapMessage)
ContentType ContentType ContentType ContentType

Ruft den HTTP-Content-Type der SOAP-Anforderung oder der SOAP-Antwort ab oder legt diesen fest.Gets or sets the HTTP Content-Type of the SOAP request or SOAP response.

(Inherited from SoapMessage)
Exception Exception Exception Exception

Ruft die SoapException aus dem Aufruf an die XML-Webdienstmethode ab.Gets the SoapException from the call to the XML Web service method.

(Inherited from SoapMessage)
Headers Headers Headers Headers

Eine Auflistung der auf die aktuelle SOAP-Anforderung oder SOAP-Antwort angewendeten SOAP-Header.A collection of the SOAP headers applied to the current SOAP request or SOAP response.

(Inherited from SoapMessage)
MethodInfo MethodInfo MethodInfo MethodInfo

Ruft eine Darstellung des Methodenprototyps der XML-Webdienstmethode ab, für die die SOAP-Anforderung bestimmt ist.Gets a representation of the method prototype of the XML Web service method for which the SOAP request is intended.

OneWay OneWay OneWay OneWay

Ruft einen Wert ab, der angibt, ob der Client den Abschluss der Verarbeitung einer XML-Webdienstmethode durch den Server abwartet.Gets a value indicating whether the client waits for the server to finish processing an XML Web service method.

SoapVersion SoapVersion SoapVersion SoapVersion

Ruft die Version des für die Kommunikation mit dem XML-Webdienst verwendeten SOAP-Protokolls ab.Gets the version of the SOAP protocol used to communicate with the XML Web service.

Stage Stage Stage Stage

Ruft den SoapMessageStage von SoapMessage ab.Gets the SoapMessageStage of the SoapMessage.

(Inherited from SoapMessage)
Stream Stream Stream Stream

Ruft die Daten ab, die die SOAP-Anforderung oder die SOAP-Antwort in Form eines Stream darstellen.Gets the data representing the SOAP request or SOAP response in the form of a Stream.

(Inherited from SoapMessage)
Url Url Url Url

Ruft die URL des XML-Webdiensts ab.Gets the URL of the XML Web service.

Methoden

EnsureInStage() EnsureInStage() EnsureInStage() EnsureInStage()

Bestimmt beim Überschreiben in einer abgeleiteten Klasse, dass auf der aktuellen SoapMessageStage In-Parameter verfügbar sind.When overridden in a derived class, asserts that the current SoapMessageStage is a stage where in parameters are available.

(Inherited from SoapMessage)
EnsureOutStage() EnsureOutStage() EnsureOutStage() EnsureOutStage()

Bestimmt beim Überschreiben in einer abgeleiteten Klasse, dass auf der aktuellen SoapMessageStage Out-Parameter verfügbar sind.When overridden in a derived class, asserts that the current SoapMessageStage stage is a stage where out parameters are available.

(Inherited from SoapMessage)
EnsureStage(SoapMessageStage) EnsureStage(SoapMessageStage) EnsureStage(SoapMessageStage) EnsureStage(SoapMessageStage)

Gewährleistet, dass SoapMessageStage des Aufrufs der XML-Webdienstmethode die Stufe oder Stufen sind, die übergeben wurden.Ensures that the SoapMessageStage of the call to the XML Web service method is the stage or stages passed in. Wenn die aktuelle Verarbeitungsstufe keine der übergebenen Stufen ist, wird eine Ausnahme ausgelöst.If the current processing stage is not one of the stages passed in, an exception is thrown.

(Inherited from SoapMessage)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Bestimmt, ob das angegebene Objekt mit dem aktuellen Objekt identisch ist.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Fungiert als Standardhashfunktion.Serves as the default hash function.

(Inherited from Object)
GetInParameterValue(Int32) GetInParameterValue(Int32) GetInParameterValue(Int32) GetInParameterValue(Int32)

Ruft den am angegebenen Index an die XML-Webdienstmethode übergebenen Parameter ab.Gets the parameter passed into the XML Web service method at the specified index.

(Inherited from SoapMessage)
GetOutParameterValue(Int32) GetOutParameterValue(Int32) GetOutParameterValue(Int32) GetOutParameterValue(Int32)

Ruft den am angegebenen Index an die XML-Webdienstmethode übergebenen Out-Parameter ab.Gets the out parameter passed into the XML Web service method at the specified index.

(Inherited from SoapMessage)
GetReturnValue() GetReturnValue() GetReturnValue() GetReturnValue()

Ruft den Rückgabewert einer XML-Webdienstmethode ab.Gets the return value of an XML Web service method.

(Inherited from SoapMessage)
GetType() GetType() GetType() GetType()

Ruft den Type der aktuellen Instanz ab.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.Returns a string that represents the current object.

(Inherited from Object)

Gilt für: