SoapClientMessage 클래스

정의

특정 SoapMessageStage에서 XML Web services 클라이언트가 보내는SOAP 요청이나 받는 SOAP 응답의 데이터를 나타냅니다. 이 클래스는 상속될 수 없습니다.

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
상속
SoapClientMessage

예제

다음 코드 조각에는 XML 웹 서비스 클라이언트에서 보내고 받는 SOAP 메시지를 기록 하는 SOAP 확장의 일부입니다. 이 특정 조각 처리를 SoapClientMessage 에 전달 합니다 SoapExtension.ProcessMessage 의 속성을 작성 하 여 SOAP 확장의 메서드는 SoapClientMessage 로그 파일에.

// 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
 
 
 ' 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

속성

Action

SOAP 요청이나 SOAP 응답에 대한 SOAPAction HTTP 요청 헤더 필드를 가져옵니다.

Client

SoapHttpClientProtocol에서 파생되는 클라이언트 프록시 클래스의 인스턴스를 가져옵니다.

ContentEncoding

Content-Encoding HTTP 헤더의 내용을 가져오거나 설정합니다.

(다음에서 상속됨 SoapMessage)
ContentType

SOAP 요청이나 SOAP 응답의 HTTP Content-Type을 가져오거나 설정합니다.

(다음에서 상속됨 SoapMessage)
Exception

XML Web services 메서드에 대한 호출에서 SoapException을 가져옵니다.

(다음에서 상속됨 SoapMessage)
Headers

현재 SOAP 요청이나 SOAP 응답에 적용된 SOAP 헤더의 컬렉션입니다.

(다음에서 상속됨 SoapMessage)
MethodInfo

해당 SOAP 요청을 위한 XML Web services 메서드의 메서드 프로토타입 표현을 가져옵니다.

OneWay

서버에서 XML Web services 메서드의 처리를 마칠 때까지 클라이언트가 대기하는지 여부를 나타내는 값을 가져옵니다.

SoapVersion

XML Web services와 통신하는 데 사용되는 SOAP 프로토콜의 버전을 가져옵니다.

SoapVersion

XML Web services와 통신하는 데 사용되는 SOAP 프로토콜의 버전을 가져옵니다.

(다음에서 상속됨 SoapMessage)
Stage

SoapMessageStageSoapMessage을 가져옵니다.

(다음에서 상속됨 SoapMessage)
Stream

SOAP 요청이나 SOAP 응답을 Stream 형식으로 표시되는 데이터를 가져옵니다.

(다음에서 상속됨 SoapMessage)
Url

해당 XML Web services의 URL을 가져옵니다.

메서드

EnsureInStage()

파생 클래스에서 재정의된 경우 현재 SoapMessageStage가 in 매개 변수를 사용할 수 있는 단계임을 어설션합니다.

(다음에서 상속됨 SoapMessage)
EnsureOutStage()

파생 클래스에서 재정의된 경우 현재 SoapMessageStage 단계가 out 매개 변수를 사용할 수 있는 단계임을 어설션합니다.

(다음에서 상속됨 SoapMessage)
EnsureStage(SoapMessageStage)

XML Web services 메서드에 대한 호출 SoapMessageStage가 통과한 단계인지 확인합니다. 현재 처리 중인 단계가 통과한 단계가 아니면 예외가 throw됩니다.

(다음에서 상속됨 SoapMessage)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetInParameterValue(Int32)

지정된 인덱스에 있는 XML Web services 메서드로 전달되는 매개 변수를 가져옵니다.

(다음에서 상속됨 SoapMessage)
GetOutParameterValue(Int32)

지정된 인덱스에 있는 XML Web services 메서드로 전달되는 out 매개 변수를 가져옵니다.

(다음에서 상속됨 SoapMessage)
GetReturnValue()

웹 서비스 메서드의 반환 값을 가져옵니다.

(다음에서 상속됨 SoapMessage)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상