MimePart Klasa

Definicja

Reprezentuje element rozszerzalności dodany do MimeMultipartRelatedBindingelementu , określając konkretny typ MIME dla MessagePart elementu, do którego MimePart ma zastosowanie. Klasa ta nie może być dziedziczona.

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
Dziedziczenie
Atrybuty

Przykłady

W poniższym przykładzie pokazano użycie metod i właściwości uwidocznionych przez klasę MimePart .

#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

Uwagi

Aby uzyskać więcej informacji na temat określania protokołów dla usług sieci Web XML, zobacz XML Web Services Using ASP.NET (Usługi sieci Web XML przy użyciu ASP.NET). Aby uzyskać więcej informacji na temat języka opisu usług sieci Web (WSDL), zobacz specyfikację języka WSDL .

Konstruktory

MimePart()

Inicjuje nowe wystąpienie klasy MimePart.

Właściwości

Extensions

Pobiera kolekcję elementów rozszerzalności MIME dla części, MimeMultipartRelatedBinding MimePart której element jest elementem członkowskim.

Handled

Pobiera lub ustawia wartość wskazującą, czy ServiceDescriptionFormatExtension jest używana przez proces importowania podczas importowania elementu rozszerzalności.

(Odziedziczone po ServiceDescriptionFormatExtension)
Parent

Pobiera element nadrzędny obiektu ServiceDescriptionFormatExtension .

(Odziedziczone po ServiceDescriptionFormatExtension)
Required

Pobiera lub ustawia wartość wskazującą, czy ServiceDescriptionFormatExtension jest to wymagane dla akcji, do której się odwołuje.

(Odziedziczone po ServiceDescriptionFormatExtension)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy