SoapDocumentMethodAttribute.ResponseElementName Proprietà

Definizione

Ottiene o imposta l'elemento XML associato alla risposta SOAP per un metodo di servizio Web XML.

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

Valore della proprietà

Elemento XML associato alla richiesta SOAP per un metodo di servizio Web XML. Il valore predefinito è WebServiceNameResult, dove WebServiceName è il nome del metodo del servizio Web XML.

Esempio

Nell'esempio di codice seguente viene impostato il nome dell'elemento XML associato al metodo del servizio Web XML nella risposta SOAP a MyCustomResponseElement.

<%@ 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

Commenti

ResponseElementName Definisce l'elemento XML utilizzato per eseguire il wrapping dei parametri sotto l'elemento Body della risposta SOAP quando ParameterStyle è Wrapped. Ciò si riflette nello schema XSD che rappresenta la risposta SOAP al metodo del servizio Web XML all'interno della descrizione del servizio Web XML.

Si applica a