共用方式為


SoapDocumentMethodAttribute.RequestNamespace 屬性

定義

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

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

屬性值

String

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

範例

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

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

public class SoapDocumentMethodSample
{
   [WebMethod]
   [SoapDocumentMethod(RequestNamespace="http://www.contoso.com",RequestElementName="MyCustomElement")]
   public int[] RequestDocument(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(RequestNamespace :="http://www.contoso.com",RequestElementName := "MyCustomRequestElement")> _
   Public Function  RequestDocument(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

備註

RequestNamespace 用於 XML Web 服務方法在其服務描述內的 XSD 架構中。

適用於