Condividi tramite


MimeXmlBinding Classe

Definizione

Rappresenta un elemento di estensibilità aggiunto a un oggetto MimePart, InputBinding o OutputBinding. Specifica lo schema per i messaggi XML non conformi a SOAP. La classe non può essere ereditata.

public ref class MimeXmlBinding sealed : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("mimeXml", "http://schemas.xmlsoap.org/wsdl/mime/", typeof(System.Web.Services.Description.MimePart), typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))]
public sealed class MimeXmlBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("mimeXml", "http://schemas.xmlsoap.org/wsdl/mime/", typeof(System.Web.Services.Description.MimePart), typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))>]
type MimeXmlBinding = class
    inherit ServiceDescriptionFormatExtension
Public NotInheritable Class MimeXmlBinding
Inherits ServiceDescriptionFormatExtension
Ereditarietà
Attributi

Esempio

Nell'esempio seguente viene illustrato un uso tipico della MimeXmlBinding classe.

#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^ myDescription = ServiceDescription::Read( "MimeXmlBinding_Part_3_Input_CPP.wsdl" );

      // Create the 'Binding' object.
      Binding^ myBinding = gcnew Binding;

      // Initialize 'Name' property of 'Binding' class.
      myBinding->Name = "MimeXmlBinding_Part_3_ServiceHttpPost";
      XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeXmlBinding_Part_3_ServiceHttpPost" );
      myBinding->Type = myXmlQualifiedName;

      // Create the 'HttpBinding' object.
      HttpBinding^ myHttpBinding = gcnew HttpBinding;
      myHttpBinding->Verb = "POST";

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

      // Create the 'OperationBinding' object.
      OperationBinding^ myOperationBinding = gcnew OperationBinding;
      myOperationBinding->Name = "AddNumbers";
      HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding;
      myHttpOperationBinding->Location = "/AddNumbers";

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

      // Create the 'InputBinding' object.
      InputBinding^ myInputBinding = gcnew InputBinding;
      MimeContentBinding^ myMimeContentBinding = gcnew MimeContentBinding;
      myMimeContentBinding->Type = "application/x-www-form-urlencoded";
      myInputBinding->Extensions->Add( myMimeContentBinding );

      // Add the 'InputBinding' to 'OperationBinding'.
      myOperationBinding->Input = myInputBinding;

      // Create an OutputBinding.
      OutputBinding^ myOutputBinding = gcnew OutputBinding;
      MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding;

      // Initialize the Part property of the MimeXmlBinding.
      myMimeXmlBinding->Part = "Body";

      // Add the MimeXmlBinding to the OutputBinding.
      myOutputBinding->Extensions->Add( myMimeXmlBinding );

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

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

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

      // Write the 'ServiceDescription' as a WSDL file.
      myDescription->Write( "MimeXmlBinding_Part_3_Output_CPP.wsdl" );
      Console::WriteLine( "WSDL file with name 'MimeXmlBinding_Part_3_Output_CPP.wsdl' is"
      " created successfully." );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

class MyXmlBinding
{
   public static void Main()
   {
      try
      {
         ServiceDescription myDescription =
            ServiceDescription.Read("MimeXmlBinding_Part_3_Input_CS.wsdl");
         // Create the 'Binding' object.
         Binding myBinding = new Binding();
         // Initialize 'Name' property of 'Binding' class.
         myBinding.Name = "MimeXmlBinding_Part_3_ServiceHttpPost";
         XmlQualifiedName
            myXmlQualifiedName = new XmlQualifiedName("s0:MimeXmlBinding_Part_3_ServiceHttpPost");
         myBinding.Type = myXmlQualifiedName;
         // Create the 'HttpBinding' object.
         HttpBinding myHttpBinding = new HttpBinding();
         myHttpBinding.Verb="POST";
         // Add the 'HttpBinding' to the 'Binding'.
         myBinding.Extensions.Add(myHttpBinding);
         // Create the 'OperationBinding' object.
         OperationBinding myOperationBinding = new OperationBinding();
         myOperationBinding.Name = "AddNumbers";
         HttpOperationBinding myHttpOperationBinding = new HttpOperationBinding();
         myHttpOperationBinding.Location="/AddNumbers";
         // Add the 'HttpOperationBinding' to 'OperationBinding'.
         myOperationBinding.Extensions.Add(myHttpOperationBinding);
         // Create the 'InputBinding' object.
         InputBinding myInputBinding = new InputBinding();
         MimeContentBinding myMimeContentBinding = new MimeContentBinding();
         myMimeContentBinding.Type="application/x-www-form-urlencoded";
         myInputBinding.Extensions.Add(myMimeContentBinding);
         // Add the 'InputBinding' to 'OperationBinding'.
         myOperationBinding.Input = myInputBinding;
         // Create an OutputBinding.
         OutputBinding myOutputBinding = new OutputBinding();
         MimeXmlBinding myMimeXmlBinding = new MimeXmlBinding();

         // Initialize the Part property of the MimeXmlBinding.
         myMimeXmlBinding.Part="Body";

         // Add the MimeXmlBinding to the OutputBinding.
         myOutputBinding.Extensions.Add(myMimeXmlBinding);
         // Add the 'OutPutBinding' to 'OperationBinding'.
         myOperationBinding.Output = myOutputBinding;
         // Add the 'OperationBinding' to 'Binding'.
         myBinding.Operations.Add(myOperationBinding);
         // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
         myDescription.Bindings.Add(myBinding);
         // Write the 'ServiceDescription' as a WSDL file.
         myDescription.Write("MimeXmlBinding_Part_3_Output_CS.wsdl");
         Console.WriteLine("WSDL file with name 'MimeXmlBinding_Part_3_Output_CS.wsdl' is"
                                                           + " created successfully.");
      }
      catch(Exception e)
      {
         Console.WriteLine( "Exception: {0}", e.Message );
      }
    }
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MyXmlBinding
   
   Public Shared Sub Main()
      Try
         Dim myDescription As ServiceDescription = ServiceDescription.Read _
                                       ("MimeXmlBinding_Part_3_Input_VB.wsdl")
         ' Create the 'Binding' object.
         Dim myBinding As New Binding()
         ' Initialize 'Name' property of 'Binding' class.
         myBinding.Name = "MimeXmlBinding_Part_3_ServiceHttpPost"
         Dim myXmlQualifiedName As New XmlQualifiedName("s0:MimeXmlBinding_Part_3_ServiceHttpPost")
         myBinding.Type = myXmlQualifiedName
         ' Create the 'HttpBinding' object.
         Dim myHttpBinding As New HttpBinding()
         myHttpBinding.Verb = "POST"
         ' Add the 'HttpBinding' to the 'Binding'.
         myBinding.Extensions.Add(myHttpBinding)
         ' Create the 'OperationBinding' object.
         Dim myOperationBinding As New OperationBinding()
         myOperationBinding.Name = "AddNumbers"
         Dim myHttpOperationBinding As New HttpOperationBinding()
         myHttpOperationBinding.Location = "/AddNumbers"
         ' Add the 'HttpOperationBinding' to 'OperationBinding'.
         myOperationBinding.Extensions.Add(myHttpOperationBinding)
         ' Create the 'InputBinding' object.
         Dim myInputBinding As New InputBinding()
         Dim myMimeContentBinding As New MimeContentBinding()
         myMimeContentBinding.Type = "application/x-www-form-urlencoded"
         myInputBinding.Extensions.Add(myMimeContentBinding)
         ' Add the 'InputBinding' to 'OperationBinding'.
         myOperationBinding.Input = myInputBinding
         ' Create an OutputBinding.
         Dim myOutputBinding As New OutputBinding()
         Dim myMimeXmlBinding As New MimeXmlBinding()

         ' Initialize the Part property of the MimeXmlBinding. 
         myMimeXmlBinding.Part = "Body"

         ' Add the MimeXmlBinding to the OutputBinding.
         myOutputBinding.Extensions.Add(myMimeXmlBinding)
         ' Add the 'OutPutBinding' to 'OperationBinding'.
         myOperationBinding.Output = myOutputBinding
         ' Add the 'OperationBinding' to 'Binding'.
         myBinding.Operations.Add(myOperationBinding)
         ' Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
         myDescription.Bindings.Add(myBinding)
         ' Write the 'ServiceDescription' as a WSDL file.
         myDescription.Write("MimeXmlBinding_Part_3_Output_VB.wsdl")
         Console.WriteLine("WSDL file with name 'MimeXmlBinding_Part_3_Output_VB.wsdl' is" + _
                                                                     " created successfully.")
      Catch e As Exception
         Console.WriteLine("Exception: {0}", e.Message)
      End Try
   End Sub
End Class

Commenti

Per altre informazioni sulla specifica dei protocolli per i servizi Web XML, vedere Servizi Web XML tramite ASP.NET. Per altre informazioni su Web Services Description Language (WSDL), vedere la specifica WSDL .

Costruttori

MimeXmlBinding()

Inizializza una nuova istanza della classe MimeXmlBinding.

Proprietà

Handled

Ottiene o imposta un valore che indica se l'oggetto ServiceDescriptionFormatExtension viene utilizzato dal processo di importazione quando vengono importati gli elementi di estensibilità.

(Ereditato da ServiceDescriptionFormatExtension)
Parent

Ottiene l'elemento padre dell'oggetto ServiceDescriptionFormatExtension.

(Ereditato da ServiceDescriptionFormatExtension)
Part

Ottiene o imposta il nome dell'oggetto MessagePart a cui si applica MimeXmlBinding.

Required

Ottiene o imposta un valore che indica se l'oggetto ServiceDescriptionFormatExtension è necessario per l'azione a cui fa riferimento.

(Ereditato da ServiceDescriptionFormatExtension)

Metodi

Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene l'oggetto Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a