WebServiceAttribute.Namespace 속성

정의

XML Web services에 사용할 기본 XML 네임스페이스를 가져오거나 설정합니다.

public:
 property System::String ^ Namespace { System::String ^ get(); void set(System::String ^ value); };
public string Namespace { get; set; }
member this.Namespace : string with get, set
Public Property Namespace As String

속성 값

XML Web services에 사용할 기본 XML 네임스페이스입니다. 기본값은 DefaultNamespace 속성에 지정되어 있습니다.

예제

다음 예제에서는 Namespacehttp://www.contoso.com 및 해당 네임 스페이스에 대 한 재정의 Action 추가 하 여 속성을 SoapDocumentMethodAttributeTime XML 웹 서비스 메서드.

<%@ WebService Language="C#" class= "ServerVariables"%>
 
 using System;
 using System.Web.Services;
 using System.Web.Services.Protocols;
 
 [ WebService(Description="Server Variables",
 Namespace="http://www.contoso.com/")]
 public class ServerVariables: WebService {
    [ SoapDocumentMethod(Action="http://www.contoso.com/Time")]
    [ WebMethod(Description="Returns the time as stored on the Server",EnableSession=false)]
    public string Time() {
       return Context.Timestamp.TimeOfDay.ToString();
    }
 }
<%@ WebService Language="VB" class= "ServerVariables"%>
 
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Description := "Server Variables", _
    Namespace := "http://www.contoso.com/")> _
Public Class ServerVariables
    Inherits WebService

    <SoapDocumentMethod(Action := "http://www.contoso.com/Time"), _
        WebMethod(Description := "Returns the time as stored on the Server", _
        EnableSession := False)> _
    Public Function Time() As String
        
        Return Context.Timestamp.TimeOfDay.ToString()
    End Function
End Class

설명

XML 네임 스페이스에서 한 리소스 URI (Uniform Identifier)를 식별 되는 XML 문서의 이름을 만드는 방법을 제공 합니다. XML 네임 스페이스를 사용 하 여 요소 또는 XML 문서에서 특성을 고유 하 게 식별할 수 있습니다. XML 웹 서비스에 대 한 서비스 설명은 XML, 특히에서 WSDL 웹 서비스 설명 언어 ()에서 정의 됩니다.

XML 웹 서비스에 대 한 서비스 설명 내 Namespace XML 웹 서비스에 직접 관련 된 XML 요소에 대 한 기본 네임 스페이스로 사용 됩니다. 예를 들어, XML 웹 서비스 및 XML 웹 서비스 메서드 이름을 관련에 지정 된 네임 스페이스는 Namespace 속성입니다. WSDL에 관련 된 요소와 관련 된 http://schemas.xmlsoap.org/wsdl/ 네임 스페이스입니다.

클라이언트용 XML 웹 서비스 SOAP를 사용 하 여 XML 웹 서비스 호출을 추가할 수도 있습니다는 SoapDocumentMethodAttribute 또는 SoapRpcMethodAttribute XML 웹 서비스 메서드를 호출할 수 있습니다. 클라이언트 ASP.NET을 사용 하 여 만든 XML 웹 서비스를 호출 하는 경우는 RequestNamespace, ResponseNamespace 하 고 Action 속성에서 파생 된 모든는 Namespace 기본적으로 속성입니다. 예를 들어의 XML 웹 서비스 메서드 이름은 지정 된 TimeNamespace 속성을 http://www.contoso.com/Action 속성이 http://www.contoso.com/Time 기본적으로 합니다. 에 대 한 기본 설정을 변경 하려면 RequestNamespace, ResponseNamespace, 및 Action XML 웹 서비스 메서드를 추가할 수 있습니다를 SoapDocumentMethodAttribute XML 웹 서비스 메서드에 있습니다.

참고

XML 네임스페이스는 Windows SDK 측면에서 클래스가 상주하는 네임스페이스와 다릅니다. 참조 클래스에 대 한 네임 스페이스를 지정 하려면 Namespace 키워드 경우 C#으로 작성 합니다.

적용 대상

추가 정보