Export (0) Print
Expand All

SoapFaultBinding Class

Represents an extensibility element added to a FaultBinding within an XML Web service.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)

public class SoapFaultBinding : ServiceDescriptionFormatExtension
public class SoapFaultBinding extends ServiceDescriptionFormatExtension
public class SoapFaultBinding extends ServiceDescriptionFormatExtension
Not applicable.

This class specifies the contents of any SOAP error message returned.

For more information about specifying protocols for XML Web services, see XML Web Services Using ASP.NET. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.

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);
      }
   }
}

import System.*;
import System.Web.Services.Description.*;

public class MySoapFaultBindingSample
{
    public static void main(String[] args)
    {
        try {
            // Input wsdl file.
            String myInputWsdlFile = "SoapFaultBindingInput_jsl.wsdl";
            // Output wsdl file.
            String myOutputWsdlFile = "SoapFaultBindingOutput_jsl.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.get_Bindings().
                get_Item("MyService1Soap");
            // Create a new instance of 'SoapFaultBinding' class.
            SoapFaultBinding mySoapFaultBinding = new SoapFaultBinding();
            // Encode fault message using rules specified by 'Encoding' 
            // property.
            mySoapFaultBinding.set_Use(SoapBindingUse.Encoded);
            // Set the URI representing the encoding style.
            mySoapFaultBinding.set_Encoding("http://tempuri.org/stockquote");
            // Set the URI representing the location of the specification
            // for encoding of content not defined by 'Encoding' property'.
            mySoapFaultBinding.set_Namespace("http://tempuri.org/stockquote");
            // Create a new instance of 'FaultBinding'.
            FaultBinding myFaultBinding = new FaultBinding();
            myFaultBinding.set_Name("AddFaultbinding");
            myFaultBinding.get_Extensions().Add(mySoapFaultBinding);
            // Get existing 'OperationBinding' object.
            OperationBinding myOperationBinding = myBinding.get_Operations().
                get_Item(0);
            myOperationBinding.get_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 (System.Exception e) {
            Console.WriteLine("Error occured : " + e.get_Message());
        }
    } //main
} //MySoapFaultBindingSample

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft