次の方法で共有


SoapDocumentMethodAttribute.ParameterStyle プロパティ

SOAP メッセージの XML 部分の Body 要素の下にある単一の XML 要素内に、パラメータをカプセル化するかどうかを示す値を取得または設定します。

Public Property ParameterStyle As SoapParameterStyle
[C#]
public SoapParameterStyle ParameterStyle {get; set;}
[C++]
public: __property SoapParameterStyle get_ParameterStyle();public: __property void set_ParameterStyle(SoapParameterStyle);
[JScript]
public function get ParameterStyle() : SoapParameterStyle;public function set ParameterStyle(SoapParameterStyle);

プロパティ値

XML Web サービス メソッドとの間で送受信される SOAP メッセージの SoapParameterStyle 。既定値は Wrapped です。

使用例

[Visual Basic, C#] PlaceOrder XML Web サービス メソッドとの間で送受信される SOAP メッセージで送信するパラメータを、1 つの XML 要素内にカプセル化しないように指定するコード例を次に示します。

 
<%@ WebService Language="VB" Class="ShoppingCart" %>
 
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System

Public Class ShoppingCart
        
    ' Specify that parameters are not encapsulated within one XML element.
    <SoapDocumentMethod(ParameterStyle:=SoapParameterStyle.Bare), _
     WebMethod()> _
    Public Sub PlaceOrder(OrderDetails 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

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

 public class ShoppingCart 
 {
       // Specify that parameters are not encapsulated within one XML element.
       [ SoapDocumentMethod(ParameterStyle=SoapParameterStyle.Bare) ]
       [ WebMethod]
       public void PlaceOrder(OrderItem OrderDetails) 
       {
        // 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;
}

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

SoapDocumentMethodAttribute クラス | SoapDocumentMethodAttribute メンバ | System.Web.Services.Protocols 名前空間 | SoapParameterStyle | SOAP メッセージのカスタマイズ