次の方法で共有


SoapBodyBinding クラス

InputBinding または OutputBinding に追加された機能拡張要素を表します。

この型のすべてのメンバの一覧については、SoapBodyBinding メンバ を参照してください。

System.Object
   System.Web.Services.Description.ServiceDescriptionFormatExtension
      System.Web.Services.Description.SoapBodyBinding

Public Class SoapBodyBinding
   Inherits ServiceDescriptionFormatExtension
[C#]
public class SoapBodyBinding : ServiceDescriptionFormatExtension
[C++]
public __gc class SoapBodyBinding : public
   ServiceDescriptionFormatExtension
[JScript]
public class SoapBodyBinding extends
   ServiceDescriptionFormatExtension

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

このクラスは、メッセージが伝送時の SOAP 本体要素でどのように表示されるか、つまり抽象型定義または具象スキーマ定義のどちらで表すかを指定します。

XML Web サービスのプロトコルの指定の詳細については、「 ASP.NET を使用した XML Web サービスの作成 」を参照してください。Web サービス記述言語 (WSDL: Web Services Description Language) の詳細については、http://www.w3.org/TR/wsdl/ の仕様を参照してください。

使用例

 
Imports System
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MySoapClass
   Public Shared Sub Main()
      Dim myDescription As ServiceDescription = _
                     ServiceDescription.Read("AddNumbersInput_vb.wsdl")
      ' Create a 'Binding' object for the 'SOAP' protocol.
      Dim myBinding As New Binding()
      myBinding.Name = "Service1Soap"
      Dim qualifiedName As New XmlQualifiedName("s0:Service1Soap")
      myBinding.Type = qualifiedName

      Dim mySoapBinding As New SoapBinding()
      mySoapBinding.Transport = SoapBinding.HttpTransport
      mySoapBinding.Style = SoapBindingStyle.Document

      ' Add the 'SoapBinding' object to the 'Binding' object.
      myBinding.Extensions.Add(mySoapBinding)

      ' Create the 'OperationBinding' object for the 'SOAP' protocol.
      Dim myOperationBinding As New OperationBinding()
      myOperationBinding.Name = "AddNumbers"

      ' Create the 'SoapOperationBinding' object for the 'SOAP' protocol.
      Dim mySoapOperationBinding As New SoapOperationBinding()
      mySoapOperationBinding.SoapAction = "http://tempuri.org/AddNumbers"
      mySoapOperationBinding.Style = SoapBindingStyle.Document
      ' Add the 'SoapOperationBinding' object to 'OperationBinding' object.
      myOperationBinding.Extensions.Add(mySoapOperationBinding)

      ' Create the 'InputBinding' object for the 'SOAP' protocol.
      Dim myInput As New InputBinding()
      Dim mySoapBinding1 As New SoapBodyBinding()
      mySoapBinding1.Use = SoapBindingUse.Literal
      myInput.Extensions.Add(mySoapBinding1)
      ' Assign the 'InputBinding' to 'OperationBinding'.
      myOperationBinding.Input = myInput
      ' Create the 'OutputBinding' object' for the 'SOAP' protocol.
      Dim myOutput As New OutputBinding()
      myOutput.Extensions.Add(mySoapBinding1)
      ' Assign the 'OutPutBinding' to 'OperationBinding'.
      myOperationBinding.Output = myOutput

      ' Add the 'OperationBinding' to 'Binding'.
      myBinding.Operations.Add(myOperationBinding)

      ' Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
      myDescription.Bindings.Add(myBinding)

      Dim soapPort As New Port()
      soapPort.Name = "Service1Soap"
      soapPort.Binding = New XmlQualifiedName("s0:Service1Soap")

      ' Create a 'SoapAddressBinding' object for the 'SOAP' protocol.
      Dim mySoapAddressBinding As New SoapAddressBinding()
      mySoapAddressBinding.Location = "https://localhost/AddNumbers.vb.asmx"

      ' Add the 'SoapAddressBinding' to the 'Port'.
      soapPort.Extensions.Add(mySoapAddressBinding)

      ' Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
      myDescription.Services(0).Ports.Add(soapPort)

      ' Write the 'ServiceDescription' as a WSDL file.
      myDescription.Write("AddNumbersOut_vb.wsdl")
      Console.WriteLine(" 'AddNumbersOut_vb.Wsdl' file was generated")
   End Sub 'Main
End Class 'MySoapClass

[C#] 

using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

   class MySoapClass
   {
      public static void Main()
      {
         ServiceDescription myDescription =
                     ServiceDescription.Read("AddNumbersInput_cs.wsdl");
         // Create a 'Binding' object for the 'SOAP' protocol.
         Binding myBinding = new Binding();
         myBinding.Name = "Service1Soap";
         XmlQualifiedName qualifiedName =
                     new XmlQualifiedName("s0:Service1Soap");
         myBinding.Type = qualifiedName;

         SoapBinding mySoapBinding = new SoapBinding();
         mySoapBinding.Transport = SoapBinding.HttpTransport;
         mySoapBinding.Style = SoapBindingStyle.Document;
         // Add the 'SoapBinding' object to the 'Binding' object.
         myBinding.Extensions.Add(mySoapBinding);

         // Create the 'OperationBinding' object for the 'SOAP' protocol.
         OperationBinding myOperationBinding = new OperationBinding();
         myOperationBinding.Name = "AddNumbers";

         // Create the 'SoapOperationBinding' object for the 'SOAP' protocol.
         SoapOperationBinding mySoapOperationBinding =
                                          new SoapOperationBinding();
         mySoapOperationBinding.SoapAction  = "http://tempuri.org/AddNumbers";
         mySoapOperationBinding.Style = SoapBindingStyle.Document;
         // Add the 'SoapOperationBinding' object to 'OperationBinding' object.
         myOperationBinding.Extensions.Add(mySoapOperationBinding);

         // Create the 'InputBinding' object for the 'SOAP' protocol.
         InputBinding myInput = new InputBinding();
         SoapBodyBinding mySoapBinding1 = new SoapBodyBinding();
         mySoapBinding1.Use= SoapBindingUse.Literal;
         myInput.Extensions.Add(mySoapBinding1);
         // Assign the 'InputBinding' to 'OperationBinding'.
         myOperationBinding.Input = myInput;
         // Create the 'OutputBinding' object' for the 'SOAP' protocol..
         OutputBinding myOutput = new OutputBinding();
         myOutput.Extensions.Add(mySoapBinding1);
          // Assign the 'OutPutBinding' to 'OperationBinding'.
         myOperationBinding.Output = myOutput; 

         // Add the 'OperationBinding' to 'Binding'.
         myBinding.Operations.Add(myOperationBinding);

          // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
         myDescription.Bindings.Add(myBinding);

         Port soapPort = new Port();
         soapPort.Name = "Service1Soap";
         soapPort.Binding = new XmlQualifiedName("s0:Service1Soap");

         // Create a 'SoapAddressBinding' object for the 'SOAP' protocol.
         SoapAddressBinding mySoapAddressBinding = 
                                       new SoapAddressBinding();
         mySoapAddressBinding.Location = "https://localhost/AddNumbers.cs.asmx";

         // Add the 'SoapAddressBinding' to the 'Port'.
         soapPort.Extensions.Add(mySoapAddressBinding);

         // Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
         myDescription.Services[0].Ports.Add(soapPort);

         // Write the 'ServiceDescription' as a WSDL file.
         myDescription.Write("AddNumbersOut_cs.wsdl");
         Console.WriteLine(" 'AddNumbersOut_cs.Wsdl' file was generated");
    }
}

[C++] 

#using <mscorlib.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;

int main()
{
   ServiceDescription* myDescription =
      ServiceDescription::Read(S"AddNumbersInput_cs.wsdl");
   // Create a 'Binding' object for the 'SOAP' protocol.
   Binding* myBinding = new Binding();
   myBinding->Name = S"Service1Soap";
   XmlQualifiedName* qualifiedName =
      new XmlQualifiedName(S"s0:Service1Soap");
   myBinding->Type = qualifiedName;

   SoapBinding* mySoapBinding = new SoapBinding();
   mySoapBinding->Transport = SoapBinding::HttpTransport;
   mySoapBinding->Style = SoapBindingStyle::Document;
   // Add the 'SoapBinding' object to the 'Binding' object.
   myBinding->Extensions->Add(mySoapBinding);

   // Create the 'OperationBinding' object for the 'SOAP' protocol.
   OperationBinding* myOperationBinding = new OperationBinding();
   myOperationBinding->Name = S"AddNumbers";

   // Create the 'SoapOperationBinding' object for the 'SOAP' protocol.
   SoapOperationBinding* mySoapOperationBinding =
      new SoapOperationBinding();
   mySoapOperationBinding->SoapAction  = S"http://tempuri.org/AddNumbers";
   mySoapOperationBinding->Style = SoapBindingStyle::Document;
   // Add the 'SoapOperationBinding' object to 'OperationBinding' object.
   myOperationBinding->Extensions->Add(mySoapOperationBinding);

   // Create the 'InputBinding' object for the 'SOAP' protocol.
   InputBinding* myInput = new InputBinding();
   SoapBodyBinding* mySoapBinding1 = new SoapBodyBinding();
   mySoapBinding1->Use= SoapBindingUse::Literal;
   myInput->Extensions->Add(mySoapBinding1);
   // Assign the 'InputBinding' to 'OperationBinding'.
   myOperationBinding->Input = myInput;
   // Create the 'OutputBinding' object' for the 'SOAP' protocol..
   OutputBinding* myOutput = new OutputBinding();
   myOutput->Extensions->Add(mySoapBinding1);
   // Assign the 'OutPutBinding' to 'OperationBinding'.
   myOperationBinding->Output = myOutput; 

   // Add the 'OperationBinding' to 'Binding'.
   myBinding->Operations->Add(myOperationBinding);

   // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
   myDescription->Bindings->Add(myBinding);

   Port* soapPort = new Port();
   soapPort->Name = S"Service1Soap";
   soapPort->Binding = new XmlQualifiedName(S"s0:Service1Soap");

   // Create a 'SoapAddressBinding' object for the 'SOAP' protocol.
   SoapAddressBinding* mySoapAddressBinding = 
      new SoapAddressBinding();
   mySoapAddressBinding->Location = S"https://localhost/AddNumbers.cs.asmx";

   // Add the 'SoapAddressBinding' to the 'Port'.
   soapPort->Extensions->Add(mySoapAddressBinding);

   // Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
   myDescription->Services->Item[0]->Ports->Add(soapPort);

   // Write the 'ServiceDescription' as a WSDL file.
   myDescription->Write(S"AddNumbersOut_cs.wsdl");
   Console::WriteLine(S" 'AddNumbersOut_cs.Wsdl' file was generated");
}

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

必要条件

名前空間: System.Web.Services.Description

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

アセンブリ: System.Web.Services (System.Web.Services.dll 内)

参照

SoapBodyBinding メンバ | System.Web.Services.Description 名前空間