Share via


SoapDocumentMethodAttribute.Use プロパティ

定義

SOAP メッセージの XML 部分内にある XML Web サービス メソッドのパラメーターの書式を取得または設定します。

public:
 property System::Web::Services::Description::SoapBindingUse Use { System::Web::Services::Description::SoapBindingUse get(); void set(System::Web::Services::Description::SoapBindingUse value); };
public System.Web.Services.Description.SoapBindingUse Use { get; set; }
member this.Use : System.Web.Services.Description.SoapBindingUse with get, set
Public Property Use As SoapBindingUse

プロパティ値

XML Web サービス メソッドの SoapBindingUse。 既定値は、Literal です。

次のコード例では、SOAP メッセージを Document / Encoded XML Web サービス メソッドに送信する PlaceOrder 必要があることを指定します。

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

 public class ShoppingCart 
 {
       [ SoapDocumentMethod(Use=SoapBindingUse.Encoded) ]
       [ WebMethod]
       public void PlaceOrder(OrderItem O) 
       {
        // Process the order on the back end.
       }      
 }

public class OrderItem
{
  public int Count;
  public int Description;
  public DateTime OrderDate;
  public long CustomerID;
  public Decimal Cost;
}
<%@ WebService Language="VB" Class="ShoppingCart" %>
 
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Services.Description
Imports System

Public Class ShoppingCart
        
    ' Specify that the XML Web service method uses encoded SOAP messages.
    <SoapDocumentMethod(Use:=SoapBindingUse.Encoded), _
     WebMethod()> _
    Public Sub PlaceOrder(O as OrderItem)
        
        ' Process the order on the back end.
    End Sub
End Class

Public Class OrderItem
  Public Count As Integer
  Public Description as String
  Public OrderDate as DateTime
  Public CustomerID as Long
  Public Cost as Decimal

End Class

注釈

Web サービス記述言語 (WSDL) では、パラメーター EncodedLiteralを書式設定するための 2 つのメソッドと を定義します。 Encoded は、セクション 5 の SOAP 仕様で説明されているように、SOAP エンコードを使用した書式設定パラメーターを指します。 Literal は、各パラメーターに対して定義済みの XSD スキーマを使用してパラメーターを書式設定することを指します。

詳細については、「 SOAP メッセージの書式設定のカスタマイズ」を参照してください。

適用対象

こちらもご覧ください