SoapRpcMethodAttribute.Binding 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
XML 웹 서비스 메서드가 작업을 구현하는 바인딩을 가져오거나 설정합니다.
public:
property System::String ^ Binding { System::String ^ get(); void set(System::String ^ value); };
public string Binding { get; set; }
member this.Binding : string with get, set
Public Property Binding As String
속성 값
XML 웹 서비스 메서드의 바인딩은 작업을 구현합니다. 기본값은 "Soap"이 추가된 XML 웹 서비스의 이름입니다.
예제
다음 코드 예제에서는 XML 웹 서비스 내에서 여러 바인딩을 구현하는 방법을 보여 줍니다.
<%@ WebService Language="C#" class="BindingSample" %>
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
// Binding is defined in this XML Web service and uses the default namespace.
[ WebServiceBinding(Name="LocalBinding")]
// Binding is defined in this XML Web service, but not a part of the default namespace.
[ WebServiceBinding(Name="LocalBindingNonDefaultNamespace", Namespace="http://www.contoso.com/MyBinding")]
// Binding is defined on a remote server, but this XML Web service implements at least one operation in that binding.
[ WebServiceBinding(Name="RemoteBinding",Namespace="http://www.contoso.com/MyBinding",Location="http://www.contoso.com/MySevice.asmx?wsdl")]
public class BindingSample {
[ SoapRpcMethod(Binding="LocalBinding")]
[ WebMethod ]
public string LocalBindingMethod() {
return "Member of binding defined in this XML Web service and member of the default namespace";
}
[ SoapRpcMethodAttribute(Binding="LocalBindingNonDefaultNamespace")]
[ WebMethod ]
public string LocalBindingNonDefaultNamespaceMethod() {
return "Member of binding defined in this XML Web service, but a part of a different namespace";
}
[ SoapRpcMethodAttribute(Binding="RemoteBinding")]
[ WebMethod ]
public string RemoteBindingMethod() {
return "Member of a binding defined on another server";
}
[ WebMethod ]
public string DefaultBindingMethod() {
return "Member of the default binding";
}
}
<%@ WebService Language="VB" class="BindingSample" %>
Imports System.Web.Services
Imports System.Web.Services.Protocols
' Three bindings are defined
< WebServiceBinding(Name:="LocalBinding"), _
WebServiceBinding(Name:="LocalBindingNonDefaultNamespace",Namespace:="http://www.contoso.com/MyBinding"), _
WebServiceBinding(Name:="RemoteBinding",Namespace:="http://www.contoso.com/MyBinding",Location:="http://www.contoso.com/MySevice.asmx?wsdl")> _
Public class BindingSample
< SoapRpcMethod(Binding:="LocalBinding"), WebMethod > _
Public Function LocalBindingMethod() As String
Return "Member of binding defined in this XML Web service and member of the default namespace"
End Function
< SoapRpcMethodAttribute(Binding:="LocalBindingNonDefaultNamespace"), WebMethod > _
Public Function LocalBindingNonDefaultNamespaceMethod() As String
Return "Member of binding defined in this XML Web service, but a part of a different namespace"
End Function
< SoapRpcMethodAttribute(Binding:="RemoteBinding"), WebMethod > _
Public Function RemoteBindingMethod() As String
Return "Member of a binding defined on another server"
End Function
< WebMethod > _
Public Function DefaultBindingMethod() As String
Return "Member of the default binding"
End Function
End Class
설명
WSDL(Web Services Description Language)에서 정의한 바인딩은 구체적인 작업 집합을 정의한다는 측면에서 인터페이스와 비슷합니다. ASP.NET 관련하여 각 XML 웹 서비스 메서드는 바인딩 내의 작업입니다. XML 웹 서비스 메서드는 XML 웹 서비스에 대한 기본 바인딩의 멤버이거나 XML 웹 서비스에 적용되는 바인딩 내에 WebServiceBindingAttribute 지정된 바인딩입니다. XML 웹 서비스에 여러 특성이 적용되는 경우 XML 웹 서비스는 여러 WebServiceBindingAttribute 바인딩을 구현할 수 있습니다.
하나 이상의 WebServiceBindingAttribute 특성이 XML 웹 서비스에 SoapDocumentMethodAttribute 적용되면 개별 XML 웹 서비스 메서드에 적용하여 SoapRpcMethodAttribute 특정 XML 웹 서비스 메서드에 의해 구현된 바인딩 작업을 나타낼 수 있습니다. XML 웹 서비스 메서드가 Binding 작업을 구현하는 바인딩의 SoapDocumentMethodAttribute 속성을 설정하거나 SoapRpcMethodAttribute 지정합니다. 하나 SoapDocumentMethodAttribute 만 또는 SoapRpcMethodAttribute XML 웹 서비스 메서드에 적용할 수 있습니다. 따라서 XML 웹 서비스 메서드는 하나의 바인딩에 대한 작업만 구현할 수 있습니다.