Share via


SoapDocumentMethodAttribute.ResponseNamespace 屬性

定義

取得或設定與 XML Web Service 方法之 SOAP 回應關聯的 XML 命名空間。

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

屬性值

String

與 XML Web Service 方法之 SOAP 回應關聯的 XML 命名空間。 預設為 http://tempuri.org/。

範例

下列程式碼範例會將 ResponseNamespace 屬性設定為 http://www.contoso.com

<%@ WebService Language="C#" Class="SoapDocumentMethodSample" %>
    
using System.Web.Services;
using System.Web.Services.Protocols;

public class SoapDocumentMethodSample
{
   [WebMethod]
   [SoapDocumentMethod(ResponseNamespace="http://www.contoso.com",ResponseElementName="MyCustomResponseElement")]
   public int[] ResponseDocument(int numentries)
   {
    int[] intarray = new int[numentries];
        for (int i=0;i<numentries;i++)
        {
       intarray[i] = i;
        }
        return intarray;
   }
}
<%@ WebService Language="VB" Class="SoapDocumentMethodSample" %>
    
Imports System.Web.Services
Imports System.Web.Services.Protocols

Public Class SoapDocumentMethodSample

   <WebMethod(),SoapDocumentMethod(ResponseNamespace :="http://www.contoso.com",ResponseElementName := "MyCustomResponseElement")> _
   Public Function  ResponseDocument(numentries as Integer) As Integer()
    Dim intarray(numentries - 1) as Integer
        Dim i as Integer
        For i = 0 To numentries - 1
           intarray(i) = i
        Next
        Return intarray
   End Function
End Class

備註

屬性 ResponseNamespace 用於其服務描述中 XML Web 服務方法的 XSD 架構。

適用於