SoapClientMessage 클래스

정의

특정 XML 웹 서비스 클라이언트 SoapMessageStage에서 보낸 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 로그 파일에 속성을 작성하여 SOAP 확장의 메서드로 전달 SoapExtension.ProcessMessage 되는 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

속성

Name Description
Action

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

Client

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

ContentEncoding

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

(다음에서 상속됨 SoapMessage)
ContentType

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

(다음에서 상속됨 SoapMessage)
Exception

SoapException XML 웹 서비스 메서드 호출에서 가져옵니다.

(다음에서 상속됨 SoapMessage)
Headers

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

(다음에서 상속됨 SoapMessage)
MethodInfo

SOAP 요청이 의도된 XML 웹 서비스 메서드의 메서드 프로토타입 표현을 가져옵니다.

OneWay

클라이언트가 서버가 XML 웹 서비스 메서드 처리를 완료할 때까지 대기하는지 여부를 나타내는 값을 가져옵니다.

SoapVersion

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

Stage

의 값을 SoapMessageStageSoapMessage가져옵니다.

(다음에서 상속됨 SoapMessage)
Stream

SOAP 요청 또는 SOAP 응답을 나타내는 데이터를 형식으로 Stream가져옵니다.

(다음에서 상속됨 SoapMessage)
Url

XML 웹 서비스의 URL을 가져옵니다.

메서드

Name Description
EnsureInStage()

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

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

파생 클래스에서 재정의되는 경우 현재 SoapMessageStage 스테이지가 아웃 매개 변수를 사용할 수 있는 단계라고 어설션합니다.

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

SoapMessageStage XML 웹 서비스 메서드에 대한 호출이 전달된 단계 또는 단계인지 확인합니다. 현재 처리 단계가 전달된 단계 중 하나가 아니면 예외가 throw됩니다.

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

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

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

기본 해시 함수로 사용됩니다.

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

지정된 인덱스에서 XML 웹 서비스 메서드에 전달된 매개 변수를 가져옵니다.

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

지정된 인덱스에서 XML 웹 서비스 메서드에 전달된 out 매개 변수를 가져옵니다.

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

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

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

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

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

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

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

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

(다음에서 상속됨 Object)

적용 대상