次の方法で共有


SoapFaultBinding クラス

XML Web サービス内の FaultBinding に追加された機能拡張要素を表します。

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

System.Object
   System.Web.Services.Description.ServiceDescriptionFormatExtension
      System.Web.Services.Description.SoapFaultBinding

Public Class SoapFaultBinding
   Inherits ServiceDescriptionFormatExtension
[C#]
public class SoapFaultBinding : ServiceDescriptionFormatExtension
[C++]
public __gc class SoapFaultBinding : public
   ServiceDescriptionFormatExtension
[JScript]
public class SoapFaultBinding 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

Public Class MySoapFaultBindingSample
   
   Public Shared Sub Main()
      Try
         ' Input wsdl file.
         Dim myInputWsdlFile As String = "SoapFaultBindingInput_vb.wsdl"
         ' Output wsdl file.
         Dim myOutputWsdlFile As String = "SoapFaultBindingOutput_vb.wsdl"
         ' Initialize an instance of a 'ServiceDescription' object.
         Dim myServiceDescription As ServiceDescription = ServiceDescription.Read(myInputWsdlFile)
         ' Get a SOAP binding object with binding name "MyService1Soap". 
         Dim myBinding As Binding = myServiceDescription.Bindings("MyService1Soap")
         ' Create a new instance of 'SoapFaultBinding' class.
         Dim mySoapFaultBinding As New SoapFaultBinding()
         ' Encode fault message using rules specified by 'Encoding' property.
         mySoapFaultBinding.Use = SoapBindingUse.Encoded
         ' Set the URI representing the encoding style.
         mySoapFaultBinding.Encoding = "http://tempuri.org/stockquote"
         ' Set the URI representing the location of the specification
         ' for encoding of content not defined by 'Encoding' property'.
         mySoapFaultBinding.Namespace = "http://tempuri.org/stockquote"
         ' Create a new instance of 'FaultBinding'.
         Dim myFaultBinding As New FaultBinding()
         myFaultBinding.Name = "AddFaultbinding"
         myFaultBinding.Extensions.Add(mySoapFaultBinding)
         ' Get existing 'OperationBinding' object.
         Dim myOperationBinding As OperationBinding = myBinding.Operations(0)
         myOperationBinding.Faults.Add(myFaultBinding)
         ' Create a new wsdl file.
         myServiceDescription.Write(myOutputWsdlFile)
         Console.WriteLine("The new wsdl file created is :" + myOutputWsdlFile)
         Console.WriteLine("Proxy could be created using command : wsdl /language:VB " + myOutputWsdlFile)
      Catch e As Exception
         Console.WriteLine("Error occured : " + e.Message.ToString())
      End Try
   End Sub 'Main
End Class 'MySoapFaultBindingSample

[C#] 
using System;
using System.Web.Services.Description;
public class MySoapFaultBindingSample
{
   public static void Main()
   {
      try
      {
         // Input wsdl file.
         string myInputWsdlFile="SoapFaultBindingInput_cs.wsdl";
         // Output wsdl file.
         string myOutputWsdlFile="SoapFaultBindingOutput_cs.wsdl";
         // Initialize an instance of a 'ServiceDescription' object.
         ServiceDescription myServiceDescription =
            ServiceDescription.Read(myInputWsdlFile);
         // Get a SOAP binding object with binding name "MyService1Soap". 
         Binding myBinding=myServiceDescription.Bindings["MyService1Soap"];
         // Create a new instance of 'SoapFaultBinding' class.
         SoapFaultBinding mySoapFaultBinding=new SoapFaultBinding();
         // Encode fault message using rules specified by 'Encoding' property.
         mySoapFaultBinding.Use=SoapBindingUse.Encoded;
         // Set the URI representing the encoding style.
         mySoapFaultBinding.Encoding="http://tempuri.org/stockquote";
         // Set the URI representing the location of the specification
         // for encoding of content not defined by 'Encoding' property'.
         mySoapFaultBinding.Namespace="http://tempuri.org/stockquote";
         // Create a new instance of 'FaultBinding'.
         FaultBinding myFaultBinding=new FaultBinding();
         myFaultBinding.Name="AddFaultbinding";
         myFaultBinding.Extensions.Add(mySoapFaultBinding);
         // Get existing 'OperationBinding' object.
         OperationBinding myOperationBinding=myBinding.Operations[0];
         myOperationBinding.Faults.Add(myFaultBinding);
         // Create a new wsdl file.
         myServiceDescription.Write(myOutputWsdlFile);
         Console.WriteLine("The new wsdl file created is :"
                           +myOutputWsdlFile);
         Console.WriteLine("Proxy could be created using command : wsdl "
                             + myOutputWsdlFile);
      }
      catch(Exception e)
      {
         Console.WriteLine("Error occured : "+e.Message);
      }
   }
}

[C++] 
#using <mscorlib.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Web::Services::Description;

int main() 
{
   try 
   {
      // Input wsdl file.
      String* myInputWsdlFile=S"SoapFaultBindingInput_cpp.wsdl";
      // Output wsdl file.
      String* myOutputWsdlFile=S"SoapFaultBindingOutput_cpp.wsdl";
      // Initialize an instance of a 'ServiceDescription' object.
      ServiceDescription* myServiceDescription =
         ServiceDescription::Read(myInputWsdlFile);
      // Get a SOAP binding object with binding name S"MyService1Soap".
      Binding* myBinding = myServiceDescription->Bindings->Item[S"MyService1Soap"];
      // Create a new instance of 'SoapFaultBinding' class.
      SoapFaultBinding* mySoapFaultBinding = new SoapFaultBinding();
      // Encode fault message using rules specified by 'Encoding' property.
      mySoapFaultBinding->Use=SoapBindingUse::Encoded;
      // Set the URI representing the encoding style.
      mySoapFaultBinding->Encoding=S"http://tempuri.org/stockquote";
      // Set the URI representing the location of the specification
      // for encoding of content not defined by 'Encoding' property'.
      mySoapFaultBinding->Namespace=S"http://tempuri.org/stockquote";
      // Create a new instance of 'FaultBinding'.
      FaultBinding* myFaultBinding = new FaultBinding();
      myFaultBinding->Name=S"AddFaultbinding";
      myFaultBinding->Extensions->Add(mySoapFaultBinding);
      // Get existing 'OperationBinding' object.
      OperationBinding* myOperationBinding=myBinding->Operations->Item[0];
      myOperationBinding->Faults->Add(myFaultBinding);
      // Create a new wsdl file.
      myServiceDescription->Write(myOutputWsdlFile);
      Console::WriteLine(S"The new wsdl file created is : {0}", myOutputWsdlFile);
      Console::WriteLine(S"Proxy could be created using command : wsdl {0}", myOutputWsdlFile);
   } 
   catch (Exception* e) 
   {
      Console::WriteLine(S"Error occured : {0}", e->Message);
   }
}

[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 内)

参照

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