Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

MimeXmlBinding Class

Represents an extensibility element added to a MimePart, an InputBinding or an OutputBinding. It specifies the schema for XML messages that are not SOAP compliant. This class cannot be inherited.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)
public sealed class MimeXmlBinding : ServiceDescriptionFormatExtension
public final class MimeXmlBinding extends ServiceDescriptionFormatExtension
public final class MimeXmlBinding extends ServiceDescriptionFormatExtension
Not applicable.

For more information about specifying protocols for XML Web services, see XML Web Services Using ASP.NET. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.

The following example demonstrates a typical use of the MimeXmlBinding class.

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

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

class MyXmlBinding
{
    public static void main(String[] args)
    {
        try {
            ServiceDescription myDescription = ServiceDescription.Read(
                "MimeXmlBinding_Part_3_Input_JSL.wsdl");

            // Create the 'Binding' object.
            Binding myBinding = new Binding();

            // Initialize 'Name' property of 'Binding' class.
            myBinding.set_Name("MimeXmlBinding_Part_3_ServiceHttpPost");

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

            // Create the 'HttpBinding' object.
            HttpBinding myHttpBinding = new HttpBinding();
            myHttpBinding.set_Verb("POST");

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

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

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

            // Create the 'InputBinding' object.
            InputBinding myInputBinding = new InputBinding();
            MimeContentBinding myMimeContentBinding = new MimeContentBinding();
            myMimeContentBinding.set_Type("application/x-www-form-urlencoded");
            myInputBinding.get_Extensions().Add(myMimeContentBinding);

            // Add the 'InputBinding' to 'OperationBinding'.
            myOperationBinding.set_Input(myInputBinding);

            // Create an OutputBinding.
            OutputBinding myOutputBinding = new OutputBinding();
            MimeXmlBinding myMimeXmlBinding = new MimeXmlBinding();

            // Initialize the Part property of the MimeXmlBinding. 
            myMimeXmlBinding.set_Part("Body");

            // Add the MimeXmlBinding to the OutputBinding.
            myOutputBinding.get_Extensions().Add(myMimeXmlBinding);

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

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

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

            // Write the 'ServiceDescription' as a WSDL file.
            myDescription.Write("MimeXmlBinding_Part_3_Output_JSL.wsdl");
            Console.WriteLine("WSDL file with name "
                + "'MimeXmlBinding_Part_3_Output_JSL.wsdl' is" 
                + " created successfully.");
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception: {0}", e.get_Message());
        }
    } //main
} //MyXmlBinding

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.