SoapFaultBinding 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示已加入至 XML Web Service 內的 FaultBinding 的擴充性項目。
public ref class SoapFaultBinding : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("fault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.FaultBinding))]
public class SoapFaultBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("fault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.FaultBinding))>]
type SoapFaultBinding = class
inherit ServiceDescriptionFormatExtension
Public Class SoapFaultBinding
Inherits ServiceDescriptionFormatExtension
- 繼承
- 衍生
- 屬性
範例
#using <System.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 = "SoapFaultBindingInput_cpp.wsdl";
// Output wsdl file.
String^ myOutputWsdlFile = "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[ "MyService1Soap" ];
// Create a new instance of 'SoapFaultBinding' class.
SoapFaultBinding^ mySoapFaultBinding = gcnew 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 = gcnew 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 : {0}", myOutputWsdlFile );
Console::WriteLine( "Proxy could be created using command : wsdl {0}", myOutputWsdlFile );
}
catch ( Exception^ e )
{
Console::WriteLine( "Error occurred : {0}", e->Message );
}
}
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 occurred : "+e.Message);
}
}
}
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 occurred : " + e.Message.ToString())
End Try
End Sub
End Class
備註
這個類別會指定傳回之任何 SOAP 錯誤訊息的內容。
如需指定 XML Web 服務的通訊協議的詳細資訊,請參閱 使用 ASP.NET 的 XML Web 服務。 如需 Web 服務描述語言 (WSDL) 的詳細資訊,請參閱 WSDL 規格。
建構函式
SoapFaultBinding() |
初始化 SoapFaultBinding 類別的執行個體。 |
屬性
Encoding |
取得或設定 URI,表示用來編碼 SOAP 錯誤訊息的編碼樣式。 |
Handled |
取得或設定值,指出 ServiceDescriptionFormatExtension 是否在擴充性項目匯入時由匯入處理序來使用。 (繼承來源 ServiceDescriptionFormatExtension) |
Name |
取得或設定名稱屬性的值,這個名稱屬性會將 soap 錯誤與為指定作業定義的 wsdl 錯誤產生關聯。 |
Namespace |
取得或設定 URI,表示未特別由 Encoding 屬性所定義的內容之編碼方式的規格位置。 |
Parent |
取得 ServiceDescriptionFormatExtension 的父系。 (繼承來源 ServiceDescriptionFormatExtension) |
Required |
取得或設定值,指出 ServiceDescriptionFormatExtension 對它所參考的動作是否是必要的。 (繼承來源 ServiceDescriptionFormatExtension) |
Use |
指定錯誤訊息是使用 Encoding 屬性所指定的規則來編碼,還是封裝於具體的 XML 結構描述 (Schema) 中。 |
方法
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
GetType() |
取得目前執行個體的 Type。 (繼承來源 Object) |
MemberwiseClone() |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
ToString() |
傳回代表目前物件的字串。 (繼承來源 Object) |