MimePart Classe

Définition

Représente un élément d'extensibilité ajouté à MimeMultipartRelatedBinding, spécifiant le type MIME concret pour MessagePart auquel MimePart s'applique. Cette classe ne peut pas être héritée.

public ref class MimePart sealed : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class MimePart : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type MimePart = class
    inherit ServiceDescriptionFormatExtension
Public NotInheritable Class MimePart
Inherits ServiceDescriptionFormatExtension
Héritage
Attributs

Exemples

L’exemple suivant illustre l’utilisation des méthodes et des propriétés exposées par la MimePart classe .

#using <System.Web.Services.dll>
#using <System.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Xml;
using namespace System::Web::Services::Description;

int main()
{
   ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePart_3_Input_cpp.wsdl" );
   ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection;
   myServiceDescriptionCol->Add( myServiceDescription );
   XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" );

   // Create the Binding.
   Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName );
   OperationBinding^ myOperationBinding = nullptr;
   for ( int i = 0; i < myBinding->Operations->Count; i++ )
   {
      if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) )
      {
         myOperationBinding = myBinding->Operations[ i ];
      }
   }

   // Create the OutputBinding.
   OutputBinding^ myOutputBinding = myOperationBinding->Output;
   MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding;
   myMimeXmlBinding->Part = "body";

   // Create the MimePart.
   MimePart^ myMimePart = gcnew MimePart;
   myMimePart->Extensions->Add( myMimeXmlBinding );
   MimeMultipartRelatedBinding^ myMimePartRelatedBinding = gcnew MimeMultipartRelatedBinding;

   // Add the MimePart to the MimePartRelatedBinding.
   myMimePartRelatedBinding->Parts->Add( myMimePart );
   myOutputBinding->Extensions->Add( myMimePartRelatedBinding );

   myServiceDescription->Write( "MimePart_3_Output_CPP.wsdl" );
   Console::WriteLine( "MimePart_3_Output_CPP.wsdl has been generated successfully." );
}
using System;
using System.Xml;
using System.Web.Services.Description;

public class MyMimePart
{
   public static void Main()
   {
      ServiceDescription myServiceDescription  =
         ServiceDescription.Read("MimePart_3_Input_cs.wsdl");
      ServiceDescriptionCollection myServiceDescriptionCol =
         new ServiceDescriptionCollection();
      myServiceDescriptionCol.Add(myServiceDescription);
      XmlQualifiedName myXmlQualifiedName =
         new XmlQualifiedName("MimeServiceHttpPost","http://tempuri.org/");

      // Create the Binding.
      Binding myBinding =
         myServiceDescriptionCol.GetBinding(myXmlQualifiedName);
      OperationBinding myOperationBinding= null;
      for(int i=0; i< myBinding.Operations.Count; i++)
      {
         if(myBinding.Operations[i].Name.Equals("AddNumbers"))
         {
            myOperationBinding = myBinding.Operations[i];
         }
      }
      // Create the OutputBinding.
      OutputBinding myOutputBinding = myOperationBinding.Output;
      MimeXmlBinding myMimeXmlBinding = new MimeXmlBinding();
      myMimeXmlBinding.Part = "body";

      // Create the MimePart.
      MimePart myMimePart = new MimePart();
      myMimePart.Extensions.Add(myMimeXmlBinding);
      MimeMultipartRelatedBinding myMimePartRelatedBinding =
         new MimeMultipartRelatedBinding();

      // Add the MimePart to the MimePartRelatedBinding.
      myMimePartRelatedBinding.Parts.Add(myMimePart);
      myOutputBinding.Extensions.Add(myMimePartRelatedBinding);
      myServiceDescription.Write("MimePart_3_Output_CS.wsdl");
      Console.WriteLine(
         "MimePart_3_Output_CS.wsdl has been generated successfully.");
   }
}
Imports System.Xml
Imports System.Web.Services.Description

Public Class MyMimePart
   Public Shared Sub Main()
      Dim myServiceDescription As ServiceDescription = _
         ServiceDescription.Read("MimePart_3_Input_vb.wsdl")
      Dim myServiceDescriptionCol As New ServiceDescriptionCollection()
      myServiceDescriptionCol.Add(myServiceDescription)
      Dim myXmlQualifiedName As _
         New XmlQualifiedName("MimeServiceHttpPost", "http://tempuri.org/")

      ' Create the Binding.
      Dim myBinding As Binding = _
         myServiceDescriptionCol.GetBinding(myXmlQualifiedName)
      Dim myOperationBinding As OperationBinding = Nothing
      Dim i As Integer
      For i = 0 To myBinding.Operations.Count - 1
         If myBinding.Operations(i).Name.Equals("AddNumbers") Then
            myOperationBinding = myBinding.Operations(i)
         End If
      Next i
      ' Create the OutputBinding.
      Dim myOutputBinding As OutputBinding = myOperationBinding.Output
      Dim myMimeXmlBinding As New MimeXmlBinding()
      myMimeXmlBinding.Part = "body"

      ' Create the MimePart.
      Dim myMimePart As New MimePart()
      myMimePart.Extensions.Add(myMimeXmlBinding)
      Dim myMimePartRelatedBinding As New MimeMultipartRelatedBinding()

      ' Add the MimePart to the MimePartRelatedBinding.
      myMimePartRelatedBinding.Parts.Add(myMimePart)
      myOutputBinding.Extensions.Add(myMimePartRelatedBinding)
      myServiceDescription.Write("MimePart_3_Output_vb.wsdl")
      Console.WriteLine( _
         "MimePart_3_Output_vb.wsdl has been generated successfully.")
   End Sub
End Class

Remarques

Pour plus d’informations sur la spécification de protocoles pour les services Web XML, consultez Services Web XML à l’aide de ASP.NET. Pour plus d’informations sur WSDL (Web Services Description Language), consultez la spécification WSDL .

Constructeurs

MimePart()

Initialise une nouvelle instance de la classe MimePart.

Propriétés

Extensions

Obtient la collection des éléments d'extensibilité MIME pour la partie de MimeMultipartRelatedBinding dont MimePart est membre.

Handled

Obtient ou définit une valeur indiquant si ServiceDescriptionFormatExtension est utilisé par le processus d'importation lors de l'importation de l'élément d'extensibilité.

(Hérité de ServiceDescriptionFormatExtension)
Parent

Obtient le parent du ServiceDescriptionFormatExtension.

(Hérité de ServiceDescriptionFormatExtension)
Required

Obtient ou définit une valeur indiquant si ServiceDescriptionFormatExtension est nécessaire pour l'action à laquelle il fait référence.

(Hérité de ServiceDescriptionFormatExtension)

Méthodes

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
ToString()

Retourne une chaîne qui représente l'objet actuel.

(Hérité de Object)

S’applique à