SoapHttpClientProtocol 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
SOAP를 사용할 때 프록시가 파생되는 클래스 클라이언트를 지정합니다.
public ref class SoapHttpClientProtocol : System::Web::Services::Protocols::HttpWebClientProtocol
public class SoapHttpClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol
[System.Runtime.InteropServices.ComVisible(true)]
public class SoapHttpClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol
type SoapHttpClientProtocol = class
inherit HttpWebClientProtocol
[<System.Runtime.InteropServices.ComVisible(true)>]
type SoapHttpClientProtocol = class
inherit HttpWebClientProtocol
Public Class SoapHttpClientProtocol
Inherits HttpWebClientProtocol
- 상속
- 특성
예제
다음 코드 예제는 XML 웹 서비스에 대 Math 한 Wsdl.exe 의해 생성 된 프록시 클래스입니다. 프록시 클래스는 추상 SoapHttpClientProtocol 클래스에서 WebClientProtocol파생되는 파생 클래스입니다.
#using <System.Web.Services.dll>
#using <System.Xml.dll>
#using <System.dll>
using namespace System::Diagnostics;
using namespace System::Xml::Serialization;
using namespace System;
using namespace System::Web::Services::Protocols;
using namespace System::Web::Services;
namespace MyMath
{
[System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")]
public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol
{
public:
[System::Diagnostics::DebuggerStepThroughAttribute]
MyMath()
{
this->Url = "http://www.contoso.com/math.asmx";
}
[System::Diagnostics::DebuggerStepThroughAttribute]
[System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add",
RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/",
Use=System::Web::Services::Description::SoapBindingUse::Literal,
ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)]
int Add( int num1, int num2 )
{
array<Object^>^temp0 = {num1,num2};
array<Object^>^results = this->Invoke( "Add", temp0 );
return *dynamic_cast<int^>(results[ 0 ]);
}
[System::Diagnostics::DebuggerStepThroughAttribute]
System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState )
{
array<Object^>^temp1 = {num1,num2};
return this->BeginInvoke( "Add", temp1, callback, asyncState );
}
[System::Diagnostics::DebuggerStepThroughAttribute]
int EndAdd( System::IAsyncResult^ asyncResult )
{
array<Object^>^results = this->EndInvoke( asyncResult );
return *dynamic_cast<int^>(results[ 0 ]);
}
};
}
namespace MyMath {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="MyMathSoap", Namespace="http://www.contoso.com/")]
public class MyMath : System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public MyMath() {
this.Url = "http://www.contoso.com/math.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contoso.com/Add", RequestNamespace="http://www.contoso.com/", ResponseNamespace="http://www.contoso.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Add(int num1, int num2) {
object[] results = this.Invoke("Add", new object[] {num1,
num2});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int num1, int num2, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Add", new object[] {num1,
num2}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
Option Strict On
Option Explicit On
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Namespace MyMath
<System.Web.Services.WebServiceBindingAttribute(Name:="MyMathSoap", [Namespace]:="http://www.contoso.com/")> _
Public Class MyMath
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
<System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New
Me.Url = "http://www.contoso.com/math.asmx"
End Sub
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contoso.com/Add", RequestNamespace:="http://www.contoso.com/", ResponseNamespace:="http://www.contoso.com/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function Add(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim results() As Object = Me.Invoke("Add", New Object() {num1, num2})
Return CType(results(0),Integer)
End Function
<System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Function BeginAdd(ByVal num1 As Integer, ByVal num2 As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
Return Me.BeginInvoke("Add", New Object() {num1, num2}, callback, asyncState)
End Function
<System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Function EndAdd(ByVal asyncResult As System.IAsyncResult) As Integer
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0),Integer)
End Function
End Class
End Namespace
다음 코드 예제는 이전 프록시 클래스가 생성 된 XML 웹 서비스입니다 Math .
Important
이 예제에는 잠재적인 보안 위협인 사용자 입력을 허용하는 텍스트 상자가 있습니다. 기본적으로 ASP.NET 웹 페이지는 사용자 입력에 스크립트 또는 HTML 요소가 포함되지 않는지 확인합니다. 자세한 내용은 스크립트 악용 개요를 참조하세요.
<%@ WebService Language="C#" Class="MyMath"%>
using System.Web.Services;
using System;
[WebService(Namespace="http://www.contoso.com/")]
public class MyMath {
[ WebMethod ]
public int Add(int num1, int num2) {
return num1+num2;
}
}
<%@ WebService Language="VB" Class="MyMath"%>
Imports System.Web.Services
Imports System
<WebService(Namespace:="http://www.contoso.com/")> _
Public Class MyMath
<WebMethod()> _
Public Function Add(num1 As Integer, num2 As Integer) As Integer
Return num1 + num2
End Function 'Add
End Class 'Math
설명
XML 웹 서비스 클라이언트를 빌드하는 경우 XML 웹 서비스에 대해 간접 또는 직접 WebClientProtocol 파생되는 프록시 클래스를 만들어야 합니다. XML 웹 서비스 클라이언트가 SOAP를 사용하여 호출하는 경우 프록시 클래스는 파생되는 에서 SoapHttpClientProtocol파생 HttpWebClientProtocol되어야 합니다. HttpWebClientProtocol, 차례로에서 파생됩니다 WebClientProtocol.
XML 웹 서비스와 통신하려면 호출하려는 XML 웹 서비스에 대해 간접 또는 직접 WebClientProtocol 파생되는 프록시 클래스를 만듭니다. 프록시 클래스를 수동으로 만드는 대신 웹 서비스 설명 언어 도구(Wsdl.exe)를 사용하여 지정된 XML 웹 서비스의 서비스 설명에 대한 프록시 클래스를 만듭니다. SOAP 프로토콜에 대한 프록시 클래스가 생성되면 메서드를 통해 Invoke XML 웹 서비스 메서드에 대한 동기 호출이 이루어지는 반면 메서드와 BeginInvoke 메서드를 사용하여 EndInvoke 비동기 호출이 이루어집니다.
상속자 참고
이 클래스를 재정의하는 경우 특정 유형의 XML 웹 서비스와 관련된 파생 클래스에 메서드를 도입할 수 있습니다. 메서드는 매개 변수를 캡처하고 기본 클래스를 호출하여 XML 웹 서비스와 통신하는 작업을 수행합니다. 도입된 메서드가 비동기인 경우 메서드와 메서드를 BeginInvoke(String, Object[], AsyncCallback, Object) 호출합니다 EndInvoke(IAsyncResult) . 도입된 메서드가 동기적이면 메서드를 호출합니다 Invoke(String, Object[]) . 재정의된 생성자는 일반적으로 XML 웹 서비스 메서드의 URL로 속성을 설정합니다 Url .
생성자
| Name | Description |
|---|---|
| SoapHttpClientProtocol() |
SoapHttpClientProtocol 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| AllowAutoRedirect |
클라이언트가 서버 리디렉션을 자동으로 따르는지 여부를 가져오거나 설정합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| CanRaiseEvents |
구성 요소가 이벤트를 발생시키는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 Component) |
| ClientCertificates |
클라이언트 인증서의 컬렉션을 가져옵니다. (다음에서 상속됨 HttpWebClientProtocol) |
| ConnectionGroupName |
요청에 대한 연결 그룹의 이름을 가져오거나 설정합니다. (다음에서 상속됨 WebClientProtocol) |
| Container |
를 IContainer 포함하는 값을 가져옵니다 Component. (다음에서 상속됨 Component) |
| CookieContainer |
쿠키 컬렉션을 가져오거나 설정합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| Credentials |
XML 웹 서비스 클라이언트 인증에 대한 보안 자격 증명을 가져오거나 설정합니다. (다음에서 상속됨 WebClientProtocol) |
| DesignMode |
현재 디자인 모드인지 여부를 Component 나타내는 값을 가져옵니다. (다음에서 상속됨 Component) |
| EnableDecompression |
압축 HttpWebClientProtocol해제를 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| Events |
이 Component에 연결된 이벤트 처리기 목록을 가져옵니다. (다음에서 상속됨 Component) |
| PreAuthenticate |
사전 인증을 사용할 수 있는지 여부를 가져오거나 설정합니다. (다음에서 상속됨 WebClientProtocol) |
| Proxy |
방화벽을 통해 XML 웹 서비스 요청을 만들기 위한 프록시 정보를 가져오거나 설정합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| RequestEncoding |
Encoding XML 웹 서비스에 대한 클라이언트 요청을 만드는 데 사용됩니다. (다음에서 상속됨 WebClientProtocol) |
| Site |
ISite를 가져오거나 Component의 값을 설정합니다. (다음에서 상속됨 Component) |
| SoapVersion |
XML 웹 서비스에 대한 SOAP 요청을 만드는 데 사용되는 SOAP 프로토콜의 버전을 가져오거나 설정합니다. |
| Timeout |
XML 웹 서비스 클라이언트가 동기 XML 웹 서비스 요청에 대한 회신이 도착할 때까지 대기하는 시간을 나타냅니다(밀리초). (다음에서 상속됨 WebClientProtocol) |
| UnsafeAuthenticatedConnectionSharing |
클라이언트가 NTLM 인증을 사용하여 XML 웹 서비스를 호스트하는 웹 서버에 연결할 때 연결 공유를 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| Url |
클라이언트가 요청하는 XML 웹 서비스의 기본 URL을 가져오거나 설정합니다. (다음에서 상속됨 WebClientProtocol) |
| UseDefaultCredentials |
속성을 속성 값으로 설정할 Credentials 지 여부를 나타내는 값을 DefaultCredentials 가져오거나 설정합니다. (다음에서 상속됨 WebClientProtocol) |
| UserAgent |
각 요청과 함께 전송되는 사용자 에이전트 헤더의 값을 가져오거나 설정합니다. (다음에서 상속됨 HttpWebClientProtocol) |
메서드
| Name | Description |
|---|---|
| Abort() |
XML 웹 서비스 메서드에 대한 요청을 취소합니다. (다음에서 상속됨 WebClientProtocol) |
| BeginInvoke(String, Object[], AsyncCallback, Object) |
SOAP를 사용하여 XML 웹 서비스 메서드의 비동기 호출을 시작합니다. |
| CancelAsync(Object) |
호출이 이미 완료되지 않은 경우 XML 웹 서비스 메서드에 대한 비동기 호출을 취소합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| CreateObjRef(Type) |
원격 개체와 통신하는 데 사용되는 프록시를 생성하는 데 필요한 모든 관련 정보를 포함하는 개체를 만듭니다. (다음에서 상속됨 MarshalByRefObject) |
| Discover() |
에서 검색 문서에 Url설명된 XML 웹 서비스에 동적으로 바인딩합니다. |
| Dispose() |
에서 사용하는 모든 리소스를 Component해제합니다. (다음에서 상속됨 Component) |
| Dispose(Boolean) |
관리되지 않는 리소스를 Component 해제하고 관리되는 리소스를 선택적으로 해제합니다. (다음에서 상속됨 Component) |
| EndInvoke(IAsyncResult) |
SOAP를 사용하여 XML 웹 서비스 메서드의 비동기 호출을 종료합니다. |
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetLifetimeService() |
사용되지 않음.
이 인스턴스의 수명 정책을 제어하는 현재 수명 서비스 개체를 검색합니다. (다음에서 상속됨 MarshalByRefObject) |
| GetReaderForMessage(SoapClientMessage, Int32) |
매개 변수의 XmlReader 속성을 사용하여 Stream 초기화된 값을 반환합니다 SoapClientMessage . |
| GetService(Type) |
또는 해당 서비스에서 제공하는 서비스를 나타내는 개체를 Component 반환합니다 Container. (다음에서 상속됨 Component) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| GetWebRequest(Uri) |
지정된 WebRequest에 대한 a |
| GetWebResponse(WebRequest, IAsyncResult) |
XML 웹 서비스 메서드에 대한 비동기 요청의 응답을 반환합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| GetWebResponse(WebRequest) |
XML 웹 서비스 메서드에 대한 동기 요청의 응답을 반환합니다. (다음에서 상속됨 HttpWebClientProtocol) |
| GetWriterForMessage(SoapClientMessage, Int32) |
매개 변수의 속성을 사용하여 XmlWriterStream 초기화된 값을 반환합니다 SoapClientMessage . |
| InitializeLifetimeService() |
사용되지 않음.
이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다. (다음에서 상속됨 MarshalByRefObject) |
| Invoke(String, Object[]) |
SOAP를 사용하여 XML 웹 서비스 메서드를 동기적으로 호출합니다. |
| InvokeAsync(String, Object[], SendOrPostCallback, Object) |
지정된 메서드를 비동기적으로 호출합니다. |
| InvokeAsync(String, Object[], SendOrPostCallback) |
지정된 메서드를 비동기적으로 호출합니다. |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| MemberwiseClone(Boolean) |
현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다. (다음에서 상속됨 MarshalByRefObject) |
| ToString() |
String(있는 경우)의 Component이름을 포함하는 값을 반환합니다. 이 메서드는 재정의해서는 안 됩니다. (다음에서 상속됨 Component) |
이벤트
| Name | Description |
|---|---|
| Disposed |
구성 요소가 메서드 호출에 Dispose() 의해 삭제될 때 발생합니다. (다음에서 상속됨 Component) |
적용 대상
스레드 보안
이 형식은 스레드로부터 안전합니다.