Dieser Artikel wurde noch nicht bewertet - Dieses Thema bewerten.

MimeTextBinding-Klasse

Aktualisiert: November 2007

Stellt ein Erweiterbarkeitselement dar, das einem InputBinding, einem OutputBinding oder einem MimePart hinzugefügt wurde, wobei die Textmuster angegeben werden, nach denen die HTTP-Übertragung durchsucht werden soll. Diese Klasse kann nicht geerbt werden.

Namespace:  System.Web.Services.Description
Assembly:  System.Web.Services (in System.Web.Services.dll)
[XmlFormatExtensionAttribute("text", "http://microsoft.com/wsdl/mime/textMatching/", 
	typeof(InputBinding), typeof(OutputBinding), typeof(MimePart))]
[XmlFormatExtensionPrefixAttribute("tm", "http://microsoft.com/wsdl/mime/textMatching/")]
public sealed class MimeTextBinding : ServiceDescriptionFormatExtension
/** @attribute XmlFormatExtensionAttribute("text", "http://microsoft.com/wsdl/mime/textMatching/", InputBinding, OutputBinding, MimePart) */
/** @attribute XmlFormatExtensionPrefixAttribute("tm", "http://microsoft.com/wsdl/mime/textMatching/") */
public final class MimeTextBinding extends ServiceDescriptionFormatExtension
public final class MimeTextBinding extends ServiceDescriptionFormatExtension

Weitere Informationen zum Angeben von Protokollen für XML-Webdienste finden Sie unter XML-Webdienste, die ASP.NET verwenden. Weitere Informationen zu WSDL (Web Services Description Language) finden Sie in der Spezifikation unter http://www.w3.org/TR/wsdl/.

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


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

class MyTextBinding
{
    public static void main(String[] args)
    {
        try {
            ServiceDescription myServiceDescription = ServiceDescription.
                Read("MimeText_Binding_Match_8_Input_JSL.wsdl");

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

            // Initialize the Name property of the Binding.
            myBinding.set_Name("MimeText_Binding_MatchServiceHttpPost");

            XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
                "s0:MimeText_Binding_MatchServiceHttpPost");
            myBinding.set_Type(myXmlQualifiedName);

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

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

            // Create an OperationBinding.
            OperationBinding myOperationBinding = new OperationBinding();
            myOperationBinding.set_Name("AddNumbers");
            HttpOperationBinding myHttpOperationBinding = 
                new HttpOperationBinding();
            myHttpOperationBinding.set_Location("/AddNumbers");

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

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

            // Add the InputBinding to the OperationBinding.
            myOperationBinding.set_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.set_Name("Title");
            myMimeTextMatch.set_Type("*/*");
            myMimeTextMatch.set_Pattern("'TITLE>(.*?)<");
            myMimeTextMatch.set_IgnoreCase(true);

            // Initialize a MimeTextMatchCollection.
            myMimeTextMatchCollection = myMimeTextBinding.get_Matches();

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

            // Add the OutputBinding to the OperationBinding.
            myOperationBinding.set_Output(myOutputBinding);

            // Add the OutputBinding to the OperationBinding.
            myOperationBinding.set_Output(myOutputBinding);

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

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

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


Alle öffentlichen static (Shared in Visual Basic)-Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

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

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

.NET Framework

Unterstützt in: 3.5, 3.0, 2.0, 1.1, 1.0
Fanden Sie dies hilfreich?
(1500 verbleibende Zeichen)

Community-Beiträge

HINZUFÜGEN
© 2013 Microsoft. Alle Rechte vorbehalten.