SoapFaultBinding Class
Represents an extensibility element added to a FaultBinding within an XML Web service.
Assembly: System.Web.Services (in System.Web.Services.dll)
This class specifies the contents of any SOAP error message returned.
For more information about specifying protocols for XML Web services, see [<topic://cpconbuildingaspnetwebservices>]. For more information about Web Services Description Language (WSDL), see the specification at 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
#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);
}
}
System.Web.Services.Description.ServiceDescriptionFormatExtension
System.Web.Services.Description.SoapFaultBinding
System.Web.Services.Description.Soap12FaultBinding
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.