Freigeben über


MimePart-Klasse

Stellt ein Erweiterbarkeitselement dar, das einem MimeMultipartRelatedBinding hinzugefügt wurde, das den konkreten MIME-Typ für den MessagePart angibt, auf den der MimePart angewendet wird. Diese Klasse kann nicht geerbt werden.

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

Syntax

'Declaration
Public NotInheritable Class MimePart
    Inherits ServiceDescriptionFormatExtension
'Usage
Dim instance As MimePart
public sealed class MimePart : ServiceDescriptionFormatExtension
public ref class MimePart sealed : public ServiceDescriptionFormatExtension
public final class MimePart extends ServiceDescriptionFormatExtension
public final class MimePart extends ServiceDescriptionFormatExtension

Hinweise

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

Beispiel

Das folgende Beispiel veranschaulicht die Verwendung der durch die MimePart-Klasse verfügbar gemachten Eigenschaften und Methoden.

Imports System
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 'Main
End Class 'MyMimePart
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."); 
   }
}
#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." );
}
import System.*;
import System.Xml.*;
import System.Web.Services.Description.*;

public class MyMimePart
{
    public static void main(String[] args)
    {
        ServiceDescription myServiceDescription = 
            ServiceDescription.Read("MimePart_3_Input_jsl.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.get_Operations().get_Count(); i++) {
            if (myBinding.get_Operations().get_Item(i).get_Name().
                Equals("AddNumbers")) {
                myOperationBinding = myBinding.get_Operations().get_Item(i);
            }
        }

        // Create the OutputBinding.
        OutputBinding myOutputBinding = myOperationBinding.get_Output();
        MimeXmlBinding myMimeXmlBinding = new MimeXmlBinding();
        myMimeXmlBinding.set_Part("body");

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

        // Add the MimePart to the MimePartRelatedBinding.
        myMimePartRelatedBinding.get_Parts().Add(myMimePart);
        myOutputBinding.get_Extensions().Add(myMimePartRelatedBinding);

        myServiceDescription.Write("MimePart_3_Output_JSL.wsdl");
        Console.WriteLine("MimePart_3_Output_JSL.wsdl has been generated "
            + "successfully.");
    } //main
} //MyMimePart

Vererbungshierarchie

System.Object
   System.Web.Services.Description.ServiceDescriptionFormatExtension
    System.Web.Services.Description.MimePart

Threadsicherheit

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

Plattformen

Windows 98, Windows 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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

MimePart-Member
System.Web.Services.Description-Namespace