SoapDocumentMethodAttribute.RequestNamespace 属性

定义

获取或设置与 XML Web services 方法的 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 services 方法的 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 架构中。

适用于