This documentation is archived and is not being maintained.

MimeTextBinding Class

Represents an extensibility element added to an InputBinding, an OutputBinding, or a MimePart, specifying the text patterns for which to search the HTTP transmission. This class cannot be inherited.

For a list of all members of this type, see MimeTextBinding Members.

System.Object
   System.Web.Services.Description.ServiceDescriptionFormatExtension
      System.Web.Services.Description.MimeTextBinding

[Visual Basic]
NotInheritable Public Class MimeTextBinding
   Inherits ServiceDescriptionFormatExtension
[C#]
public sealed class MimeTextBinding :
   ServiceDescriptionFormatExtension
[C++]
public __gc __sealed class MimeTextBinding : public
   ServiceDescriptionFormatExtension
[JScript]
public class MimeTextBinding extends
   ServiceDescriptionFormatExtension

Thread Safety

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

Remarks

For more information about specifying protocols for XML Web services, see Building 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/.

Example

[Visual Basic] 
Imports System
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MyTextBinding
   Public Shared Sub Main()
      Try
         Dim myServiceDescription As ServiceDescription = _
               ServiceDescription.Read("MimeText_Binding_Match_8_Input_vb.wsdl")

         ' Create a Binding.
         Dim myBinding As New Binding()

         ' Initialize the Name property of the Binding.
         myBinding.Name = "MimeText_Binding_MatchServiceHttpPost"
         Dim myXmlQualifiedName As _
               New XmlQualifiedName("s0:MimeText_Binding_MatchServiceHttpPost")
         myBinding.Type = myXmlQualifiedName

         ' Create an HttpBinding.
         Dim myHttpBinding As New HttpBinding()
         myHttpBinding.Verb = "POST"

         ' Add the HttpBinding to the Binding.
         myBinding.Extensions.Add(myHttpBinding)

         ' Create an OperationBinding.
         Dim myOperationBinding As New OperationBinding()
         myOperationBinding.Name = "AddNumbers"

         Dim myHttpOperationBinding As New HttpOperationBinding()
         myHttpOperationBinding.Location = "/AddNumbers"

         ' Add the HttpOperationBinding to the OperationBinding.
         myOperationBinding.Extensions.Add(myHttpOperationBinding)

         ' Create an InputBinding.
         Dim myInputBinding As New InputBinding()
         Dim postMimeContentbinding As New MimeContentBinding()
         postMimeContentbinding.Type = "application/x-www-form-urlencoded"
         myInputBinding.Extensions.Add(postMimeContentbinding)

         ' Add the InputBinding to the OperationBinding.
         myOperationBinding.Input = myInputBinding
         ' Create an OutputBinding.
         Dim myOutputBinding As New OutputBinding()

         ' Create a MimeTextBinding.
         Dim myMimeTextBinding As New MimeTextBinding()

         ' Create a MimeTextMatch.
         Dim myMimeTextMatch As New MimeTextMatch()
         Dim myMimeTextMatchCollection As MimeTextMatchCollection

         ' Initialize properties of the MimeTextMatch.
         myMimeTextMatch.Name = "Title"
         myMimeTextMatch.Type = "*/*"
         myMimeTextMatch.Pattern = "'TITLE>(.*?)<"
         myMimeTextMatch.IgnoreCase = True

         ' Initialize a MimeTextMatchCollection.
         myMimeTextMatchCollection = myMimeTextBinding.Matches

         ' Add the MimeTextMatch to the MimeTextMatchCollection.
         myMimeTextMatchCollection.Add(myMimeTextMatch)
         myOutputBinding.Extensions.Add(myMimeTextBinding)

         ' Add the OutputBinding to the OperationBinding.
         myOperationBinding.Output = myOutputBinding
         ' Add the OutputBinding to the OperationBinding.
         myOperationBinding.Output = myOutputBinding

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

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

         ' Write the ServiceDescription as a WSDL file.
         myServiceDescription.Write("MimeText_Binding_Match_8_Output_vb.wsdl")
         Console.WriteLine("WSDL file named " & _
            "'MimeText_Binding_Match_8_Output_vb.wsdl' was" & _
            " created successfully.")
      Catch e As Exception
         Console.WriteLine("Exception: {0}", e.Message)
      End Try
   End Sub 'Main
End Class 'MyTextBinding

[C#] 
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

class MyTextBinding
{
   public static void Main()
   {
      try
      {
         ServiceDescription myServiceDescription = 
            ServiceDescription.Read("MimeText_Binding_Match_8_Input_CS.wsdl");

         // Create a Binding.
         Binding myBinding = new Binding();

         // Initialize the Name property of the Binding.
         myBinding.Name = "MimeText_Binding_MatchServiceHttpPost";
         XmlQualifiedName myXmlQualifiedName = 
            new XmlQualifiedName("s0:MimeText_Binding_MatchServiceHttpPost");
         myBinding.Type = myXmlQualifiedName;

         // Create an HttpBinding.
         HttpBinding myHttpBinding = new HttpBinding();
         myHttpBinding.Verb="POST";

         // Add the HttpBinding to the Binding.
         myBinding.Extensions.Add(myHttpBinding);

         // Create an OperationBinding.
         OperationBinding myOperationBinding = new OperationBinding();
         myOperationBinding.Name = "AddNumbers";

         HttpOperationBinding myHttpOperationBinding = 
            new HttpOperationBinding();
         myHttpOperationBinding.Location="/AddNumbers";

         // Add the HttpOperationBinding to the OperationBinding.
         myOperationBinding.Extensions.Add(myHttpOperationBinding);

         // Create an InputBinding.
         InputBinding myInputBinding = new InputBinding();
         MimeContentBinding postMimeContentbinding = new MimeContentBinding();
         postMimeContentbinding.Type = "application/x-www-form-urlencoded";
         myInputBinding.Extensions.Add(postMimeContentbinding);

         // Add the InputBinding to the OperationBinding.
         myOperationBinding.Input = myInputBinding;      
               // Create an OutputBinding.
               OutputBinding myOutputBinding = new OutputBinding();

               // Create a MimeTextBinding.
               MimeTextBinding myMimeTextBinding = new MimeTextBinding();

               // Create a MimeTextMatch.
               MimeTextMatch myMimeTextMatch = new MimeTextMatch();
               MimeTextMatchCollection myMimeTextMatchCollection ;

               // Initialize properties of the MimeTextMatch.
               myMimeTextMatch.Name = "Title";
               myMimeTextMatch.Type = "*/*";
               myMimeTextMatch.Pattern = "'TITLE>(.*?)<";
               myMimeTextMatch.IgnoreCase = true;

               // Initialize a MimeTextMatchCollection.
               myMimeTextMatchCollection = myMimeTextBinding.Matches;

               // Add the MimeTextMatch to the MimeTextMatchCollection.
               myMimeTextMatchCollection.Add( myMimeTextMatch );
               myOutputBinding.Extensions.Add( myMimeTextBinding );

               // Add the OutputBinding to the OperationBinding.
               myOperationBinding.Output = myOutputBinding; 
         // Add the OutputBinding to the OperationBinding.
         myOperationBinding.Output = myOutputBinding; 

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

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

         // Write the ServiceDescription as a WSDL file.
         myServiceDescription.Write("MimeText_Binding_Match_8_Output_CS.wsdl");
         Console.WriteLine(
            "WSDL file named 'MimeText_Binding_Match_8_Output_CS.wsdl' was"
            + " created successfully.");
      }
      catch(Exception e)
      {
         Console.WriteLine( "Exception: {0}", e.Message );
      }
    }
}

[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()
{
   try
   {
      ServiceDescription* myServiceDescription = 
         ServiceDescription::Read(S"MimeText_Binding_Match_8_Input_CS.wsdl");

      // Create a Binding.
      Binding* myBinding = new Binding();

      // Initialize the Name property of the Binding.
      myBinding->Name = S"MimeText_Binding_MatchServiceHttpPost";
      XmlQualifiedName* myXmlQualifiedName = 
         new XmlQualifiedName(S"s0:MimeText_Binding_MatchServiceHttpPost");
      myBinding->Type = myXmlQualifiedName;

      // Create an HttpBinding.
      HttpBinding* myHttpBinding = new HttpBinding();
      myHttpBinding->Verb=S"POST";

      // Add the HttpBinding to the Binding.
      myBinding->Extensions->Add(myHttpBinding);

      // Create an OperationBinding.
      OperationBinding* myOperationBinding = new OperationBinding();
      myOperationBinding->Name = S"AddNumbers";

      HttpOperationBinding* myHttpOperationBinding = 
         new HttpOperationBinding();
      myHttpOperationBinding->Location=S"/AddNumbers";

      // Add the HttpOperationBinding to the OperationBinding.
      myOperationBinding->Extensions->Add(myHttpOperationBinding);

      // Create an InputBinding.
      InputBinding* myInputBinding = new InputBinding();
      MimeContentBinding* postMimeContentbinding = new MimeContentBinding();
      postMimeContentbinding->Type = S"application/x-www-form-urlencoded";
      myInputBinding->Extensions->Add(postMimeContentbinding);

      // Add the InputBinding to the OperationBinding.
      myOperationBinding->Input = myInputBinding;      
      // Create an OutputBinding.
      OutputBinding* myOutputBinding = new OutputBinding();

      // Create a MimeTextBinding.
      MimeTextBinding* myMimeTextBinding = new MimeTextBinding();

      // Create a MimeTextMatch.
      MimeTextMatch* myMimeTextMatch = new MimeTextMatch();
      MimeTextMatchCollection* myMimeTextMatchCollection ;

      // Initialize properties of the MimeTextMatch.
      myMimeTextMatch->Name = S"Title";
      myMimeTextMatch->Type = S"*/*";
      myMimeTextMatch->Pattern = S"'TITLE&gt;(.*?)&lt;";
      myMimeTextMatch->IgnoreCase = true;

      // Initialize a MimeTextMatchCollection.
      myMimeTextMatchCollection = myMimeTextBinding->Matches;

      // Add the MimeTextMatch to the MimeTextMatchCollection.
      myMimeTextMatchCollection->Add( myMimeTextMatch );
      myOutputBinding->Extensions->Add( myMimeTextBinding );

      // Add the OutputBinding to the OperationBinding.
      myOperationBinding->Output = myOutputBinding; 
      // Add the OutputBinding to the OperationBinding.
      myOperationBinding->Output = myOutputBinding; 

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

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

      // Write the ServiceDescription as a WSDL file.
      myServiceDescription->Write(S"MimeText_Binding_Match_8_Output_CS.wsdl");
      Console::WriteLine(
         S"WSDL file named 'MimeText_Binding_Match_8_Output_CS.wsdl' was"
         S" created successfully.");
   }
   catch(Exception* e)
   {
      Console::WriteLine( S"Exception: {0}", e->Message );
   }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.Services.Description

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web.Services (in System.Web.Services.dll)

See Also

MimeTextBinding Members | System.Web.Services.Description Namespace

Show: