Example #1
0
    public static void Main()
    {
        ServiceDescription myDescription = ServiceDescription.Read("AddNumbers1.wsdl");

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

        myBinding.Name = "Service1HttpPost";
        XmlQualifiedName qualifiedName = new XmlQualifiedName("s0:Service1HttpPost");

        myBinding.Type = qualifiedName;

// <Snippet1>
// <Snippet2>

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

        myHttpBinding.Verb = "POST";
        // Add the 'HttpBinding' to the 'Binding'.
        myBinding.Extensions.Add(myHttpBinding);
// </Snippet2>
// </Snippet1>

        // Create the 'OperationBinding' object.
        OperationBinding myOperationBinding = new OperationBinding();

        myOperationBinding.Name = "AddNumbers";

        HttpOperationBinding myOperation = new HttpOperationBinding();

        myOperation.Location = "/AddNumbers";
        // Add the 'HttpOperationBinding' to 'OperationBinding'.
        myOperationBinding.Extensions.Add(myOperation);

        // Create the 'InputBinding' object.
        InputBinding       myInput = new InputBinding();
        MimeContentBinding postMimeContentbinding = new MimeContentBinding();

        postMimeContentbinding.Type = "application/x-www-form-urlencoded";
        myInput.Extensions.Add(postMimeContentbinding);
        // Add the 'InputBinding' to 'OperationBinding'.
        myOperationBinding.Input = myInput;
        // Create the 'OutputBinding' object.
        OutputBinding  myOutput           = new OutputBinding();
        MimeXmlBinding postMimeXmlbinding = new MimeXmlBinding();

        postMimeXmlbinding.Part = "Body";
        myOutput.Extensions.Add(postMimeXmlbinding);

        // Add the 'OutPutBinding' to 'OperationBinding'.
        myOperationBinding.Output = myOutput;

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

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

        // Create  a 'Port' object.
        Port postPort = new Port();

        postPort.Name    = "Service1HttpPost";
        postPort.Binding = new XmlQualifiedName("s0:Service1HttpPost");

// <Snippet3>
// <Snippet4>

        // Create the 'HttpAddressBinding' object.
        HttpAddressBinding postAddressBinding = new HttpAddressBinding();

        postAddressBinding.Location = "http://localhost/Service1.asmx";

        // Add the 'HttpAddressBinding' to the 'Port'.
        postPort.Extensions.Add(postAddressBinding);
// </Snippet4>
// </Snippet3>

        // Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
        myDescription.Services[0].Ports.Add(postPort);

        // Create a 'PortType' object.
        PortType postPortType = new PortType();

        postPortType.Name = "Service1HttpPost";

        Operation postOperation = new Operation();

        postOperation.Name = "AddNumbers";

        OperationMessage postInput = (OperationMessage) new OperationInput();

        postInput.Message = new XmlQualifiedName("s0:AddNumbersHttpPostIn");
        OperationMessage postOutput = (OperationMessage) new OperationOutput();

        postOutput.Message = new XmlQualifiedName("s0:AddNumbersHttpPostOut");

        postOperation.Messages.Add(postInput);
        postOperation.Messages.Add(postOutput);

        // Add the 'Operation' to 'PortType'.
        postPortType.Operations.Add(postOperation);

        // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'.
        myDescription.PortTypes.Add(postPortType);

        // Create the 'Message' object.
        Message postMessage1 = new Message();

        postMessage1.Name = "AddNumbersHttpPostIn";
        // Create the 'MessageParts'.
        MessagePart postMessagePart1 = new MessagePart();

        postMessagePart1.Name = "firstnumber";
        postMessagePart1.Type = new XmlQualifiedName("s:string");

        MessagePart postMessagePart2 = new MessagePart();

        postMessagePart2.Name = "secondnumber";
        postMessagePart2.Type = new XmlQualifiedName("s:string");
        // Add the 'MessagePart' objects to 'Messages'.
        postMessage1.Parts.Add(postMessagePart1);
        postMessage1.Parts.Add(postMessagePart2);

        // Create another 'Message' object.
        Message postMessage2 = new Message();

        postMessage2.Name = "AddNumbersHttpPostOut";

        MessagePart postMessagePart3 = new MessagePart();

        postMessagePart3.Name    = "Body";
        postMessagePart3.Element = new XmlQualifiedName("s0:int");
        // Add the 'MessagePart' to 'Message'
        postMessage2.Parts.Add(postMessagePart3);

        // Add the 'Message' objects to 'ServiceDescription'.
        myDescription.Messages.Add(postMessage1);
        myDescription.Messages.Add(postMessage2);

        // Write the 'ServiceDescription' as a WSDL file.
        myDescription.Write("AddNumbers.wsdl");
        Console.WriteLine("WSDL file with name 'AddNumber.Wsdl' file created Successfully");
    }
Example #2
0
    public static void Main()
    {
        try
        {
            ServiceDescription myServiceDescription =
                ServiceDescription.Read("MimeText_Binding_Match_8_Input_CS.wsdl");

            // Create a Binding.
            Binding myBinding = new Binding();

            // Initialize the Name property of the Binding.
            myBinding.Name = "MimeText_Binding_MatchServiceHttpPost";
            XmlQualifiedName myXmlQualifiedName =
                new XmlQualifiedName("s0:MimeText_Binding_MatchServiceHttpPost");
            myBinding.Type = myXmlQualifiedName;

            // Create an HttpBinding.
            HttpBinding myHttpBinding = new HttpBinding();
            myHttpBinding.Verb = "POST";

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

            // Create an OperationBinding.
            OperationBinding myOperationBinding = new OperationBinding();
            myOperationBinding.Name = "AddNumbers";

            HttpOperationBinding myHttpOperationBinding =
                new HttpOperationBinding();
            myHttpOperationBinding.Location = "/AddNumbers";

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

            // Create an InputBinding.
            InputBinding       myInputBinding         = new InputBinding();
            MimeContentBinding postMimeContentbinding = new MimeContentBinding();
            postMimeContentbinding.Type = "application/x-www-form-urlencoded";
            myInputBinding.Extensions.Add(postMimeContentbinding);

            // Add the InputBinding to the OperationBinding.
            myOperationBinding.Input = myInputBinding;
// <Snippet8>
// <Snippet7>
// <Snippet6>
// <Snippet5>
// <Snippet4>
// <Snippet3>
// <Snippet2>
            // Create an OutputBinding.
            OutputBinding myOutputBinding = new OutputBinding();

            // Create a MimeTextBinding.
            MimeTextBinding myMimeTextBinding = new MimeTextBinding();

            // Create a MimeTextMatch.
            MimeTextMatch           myMimeTextMatch = new MimeTextMatch();
            MimeTextMatchCollection myMimeTextMatchCollection;

            // Initialize properties of the MimeTextMatch.
            myMimeTextMatch.Name       = "Title";
            myMimeTextMatch.Type       = "*/*";
            myMimeTextMatch.Pattern    = "'TITLE&gt;(.*?)&lt;";
            myMimeTextMatch.IgnoreCase = true;

            // Initialize a MimeTextMatchCollection.
            myMimeTextMatchCollection = myMimeTextBinding.Matches;

            // Add the MimeTextMatch to the MimeTextMatchCollection.
            myMimeTextMatchCollection.Add(myMimeTextMatch);
            myOutputBinding.Extensions.Add(myMimeTextBinding);

            // Add the OutputBinding to the OperationBinding.
            myOperationBinding.Output = myOutputBinding;
// </Snippet2>
// </Snippet3>
// </Snippet4>
// </Snippet5>
// </Snippet6>
// </Snippet7>
// </Snippet8>
            // Add the OutputBinding to the OperationBinding.
            myOperationBinding.Output = myOutputBinding;

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

            // Add the Binding to the BindingCollection of the ServiceDescription.
            myServiceDescription.Bindings.Add(myBinding);

            // Write the ServiceDescription as a WSDL file.
            myServiceDescription.Write("MimeText_Binding_Match_8_Output_CS.wsdl");
            Console.WriteLine(
                "WSDL file named 'MimeText_Binding_Match_8_Output_CS.wsdl' was"
                + " created successfully.");
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception: {0}", e.Message);
        }
    }
    public static void Main()
    {
        try
        {
            ServiceDescription myDescription =
                ServiceDescription.Read("AddNumbersIn_cs.wsdl");

            // Add the ServiceHttpPost binding.
            Binding myBinding = new Binding();
            myBinding.Name = "ServiceHttpPost";
            XmlQualifiedName myXmlQualifiedName =
                new XmlQualifiedName("s0:ServiceHttpPost");
            myBinding.Type = myXmlQualifiedName;
            HttpBinding myHttpBinding = new HttpBinding();
            myHttpBinding.Verb = "POST";
            myBinding.Extensions.Add(myHttpBinding);

            // Add the operation name AddNumbers.
            OperationBinding myOperationBinding = new OperationBinding();
            myOperationBinding.Name = "AddNumbers";
            HttpOperationBinding myOperation = new HttpOperationBinding();
            myOperation.Location = "/AddNumbers";
            myOperationBinding.Extensions.Add(myOperation);

            // Add the input binding.
            InputBinding       myInput = new InputBinding();
            MimeContentBinding postMimeContentbinding =
                new MimeContentBinding();
            postMimeContentbinding.Type = "application/x-www-form-urlencoded";
            myInput.Extensions.Add(postMimeContentbinding);

            // Add the InputBinding to the OperationBinding.
            myOperationBinding.Input = myInput;

            // Add the ouput binding.
            OutputBinding  myOutput           = new OutputBinding();
            MimeXmlBinding postMimeXmlbinding = new MimeXmlBinding();
            postMimeXmlbinding.Part = "Body";
            myOutput.Extensions.Add(postMimeXmlbinding);

            // Add the OutPutBinding to the OperationBinding.
            myOperationBinding.Output = myOutput;

            myBinding.Operations.Add(myOperationBinding);
            myDescription.Bindings.Add(myBinding);

            // Add the port definition.
            Port postPort = new Port();
            postPort.Name    = "ServiceHttpPost";
            postPort.Binding = new XmlQualifiedName("s0:ServiceHttpPost");
            HttpAddressBinding postAddressBinding = new HttpAddressBinding();
            postAddressBinding.Location = "http://localhost/Service_cs.asmx";
            postPort.Extensions.Add(postAddressBinding);
            myDescription.Services[0].Ports.Add(postPort);

            // Add the post port type definition.
            PortType postPortType = new PortType();
            postPortType.Name = "ServiceHttpPost";
            Operation postOperation = new Operation();
            postOperation.Name = "AddNumbers";
            OperationMessage postInput =
                (OperationMessage) new OperationInput();
            postInput.Message =
                new XmlQualifiedName("s0:AddNumbersHttpPostIn");
// <Snippet2>
            OperationOutput postOutput = new OperationOutput();
            postOutput.Message =
                new XmlQualifiedName("s0:AddNumbersHttpPostOut");

            postOperation.Messages.Add(postInput);
            postOperation.Messages.Add(postOutput);
            postPortType.Operations.Add(postOperation);
// </Snippet2>
            myDescription.PortTypes.Add(postPortType);

            // Add the first message information.
            Message postMessage1 = new Message();
            postMessage1.Name = "AddNumbersHttpPostIn";
            MessagePart postMessagePart1 = new MessagePart();
            postMessagePart1.Name = "firstnumber";
            postMessagePart1.Type = new XmlQualifiedName("s:string");

            // Add the second message information.
            MessagePart postMessagePart2 = new MessagePart();
            postMessagePart2.Name = "secondnumber";
            postMessagePart2.Type = new XmlQualifiedName("s:string");
            postMessage1.Parts.Add(postMessagePart1);
            postMessage1.Parts.Add(postMessagePart2);
            Message postMessage2 = new Message();
            postMessage2.Name = "AddNumbersHttpPostOut";

            // Add the third message information.
            MessagePart postMessagePart3 = new MessagePart();
            postMessagePart3.Name    = "Body";
            postMessagePart3.Element = new XmlQualifiedName("s0:int");
            postMessage2.Parts.Add(postMessagePart3);

            myDescription.Messages.Add(postMessage1);
            myDescription.Messages.Add(postMessage2);

            // Write the ServiceDescription as a WSDL file.
            myDescription.Write("AddNumbersOut_cs.wsdl");
            Console.WriteLine("WSDL file named AddNumbersOut_cs.Wsdl" +
                              " created successfully.");
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception caught!!!");
            Console.WriteLine("Source : " + e.Source);
            Console.WriteLine("Message : " + e.Message);
        }
    }
Example #4
0
    public static void Main()
    {
        ServiceDescription myServiceDescription = ServiceDescription.Read("Operation_IsBoundBy_Input_CS.wsdl");
        // Create the 'Binding' object.
        Binding myBinding = new Binding();

        myBinding.Name = "MyOperationIsBoundByServiceHttpPost";
        XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName("s0:OperationServiceHttpPost");

        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 myPostMimeContentBinding = new MimeContentBinding();

        myPostMimeContentBinding.Type = "application/x-www-form-urlencoded";
        myInputBinding.Extensions.Add(myPostMimeContentBinding);
        // Add the 'InputBinding' to 'OperationBinding'.
        myOperationBinding.Input = myInputBinding;
        // Create the 'OutputBinding' object.
        OutputBinding  myOutputBinding      = new OutputBinding();
        MimeXmlBinding myPostMimeXmlBinding = new MimeXmlBinding();

        myPostMimeXmlBinding.Part = "Body";
        myOutputBinding.Extensions.Add(myPostMimeXmlBinding);

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

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

        // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
        myServiceDescription.Bindings.Add(myBinding);

        // Create a 'PortType' object.
        PortType myPostPortType = new PortType();

        myPostPortType.Name = "OperationServiceHttpPost";
// <Snippet1>
        Operation myPostOperation = new Operation();

        myPostOperation.Name = myOperationBinding.Name;
        Console.WriteLine("'Operation' instance uses 'OperationBinding': "
                          + myPostOperation.IsBoundBy(myOperationBinding));
// </Snippet1>
        OperationMessage myOperationMessage = (OperationMessage) new OperationInput();

        myOperationMessage.Message = new XmlQualifiedName("s0:AddNumbersHttpPostIn");
        OperationMessage myOperationMessage1 = (OperationMessage) new OperationOutput();

        myOperationMessage1.Message = new XmlQualifiedName("s0:AddNumbersHttpPostOut");

        myPostOperation.Messages.Add(myOperationMessage);
        myPostOperation.Messages.Add(myOperationMessage1);

        // Add the 'Operation' to 'PortType'.
        myPostPortType.Operations.Add(myPostOperation);

        // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'.
        myServiceDescription.PortTypes.Add(myPostPortType);

        // Write the 'ServiceDescription' as a WSDL file.
        myServiceDescription.Write("Operation_IsBoundBy_Output_CS.wsdl");
        Console.WriteLine("WSDL file with name 'Operation_IsBoundBy_Output_CS.wsdl' created Successfully");
    }
Example #5
0
    public static void Main()
    {
        try
        {
            ServiceDescription myDescription =
                ServiceDescription.Read("Operation_2_Input_CS.wsdl");
            Binding myBinding = new Binding();
            myBinding.Name = "Operation_2_ServiceHttpPost";
            XmlQualifiedName myQualifiedName =
                new XmlQualifiedName("s0:Operation_2_ServiceHttpPost");
            myBinding.Type = myQualifiedName;
            HttpBinding myHttpBinding = new HttpBinding();
            myHttpBinding.Verb = "POST";
            // Add the 'HttpBinding' to the 'Binding'.
            myBinding.Extensions.Add(myHttpBinding);
            OperationBinding myOperationBinding = new OperationBinding();
            myOperationBinding.Name = "AddNumbers";
            HttpOperationBinding myHttpOperationBinding = new HttpOperationBinding();
            myHttpOperationBinding.Location = "/AddNumbers";
            // Add the 'HttpOperationBinding' to 'OperationBinding'.
            myOperationBinding.Extensions.Add(myHttpOperationBinding);
            InputBinding       myInputBinding           = new InputBinding();
            MimeContentBinding myPostMimeContentbinding = new MimeContentBinding();
            myPostMimeContentbinding.Type = "application/x-www-form-urlencoded";
            myInputBinding.Extensions.Add(myPostMimeContentbinding);
            // Add the 'InputBinding' to 'OperationBinding'.
            myOperationBinding.Input = myInputBinding;
            OutputBinding  myOutputBinding      = new OutputBinding();
            MimeXmlBinding myPostMimeXmlbinding = new MimeXmlBinding();
            myPostMimeXmlbinding.Part = "Body";
            myOutputBinding.Extensions.Add(myPostMimeXmlbinding);
            // 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);
            Port myPostPort = new Port();
            myPostPort.Name    = "Operation_2_ServiceHttpPost";
            myPostPort.Binding = new XmlQualifiedName("s0:Operation_2_ServiceHttpPost");
            HttpAddressBinding myPostAddressBinding = new HttpAddressBinding();
            myPostAddressBinding.Location =
                "http://localhost/Operation_2/Operation_2_Service.cs.asmx";
            // Add the 'HttpAddressBinding' to the 'Port'.
            myPostPort.Extensions.Add(myPostAddressBinding);
            // Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
            myDescription.Services[0].Ports.Add(myPostPort);
            PortType myPostPortType = new PortType();
            myPostPortType.Name = "Operation_2_ServiceHttpPost";
            Operation myPostOperation = new Operation();
            myPostOperation.Name = "AddNumbers";
            OperationMessage myPostOperationInput = (OperationMessage) new OperationInput();
            myPostOperationInput.Message = new XmlQualifiedName("s0:AddNumbersHttpPostIn");
            OperationMessage myPostOperationOutput = (OperationMessage) new OperationOutput();
            myPostOperationOutput.Message = new XmlQualifiedName("s0:AddNumbersHttpPostout");
            myPostOperation.Messages.Add(myPostOperationInput);
            myPostOperation.Messages.Add(myPostOperationOutput);
            // Add the 'Operation' to 'PortType'.
            myPostPortType.Operations.Add(myPostOperation);
            // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'.
            myDescription.PortTypes.Add(myPostPortType);
            Message myPostMessage1 = new Message();
            myPostMessage1.Name = "AddNumbersHttpPostIn";
            MessagePart myPostMessagePart1 = new MessagePart();
            myPostMessagePart1.Name = "firstnumber";
            myPostMessagePart1.Type = new XmlQualifiedName("s:string");
            MessagePart myPostMessagePart2 = new MessagePart();
            myPostMessagePart2.Name = "secondnumber";
            myPostMessagePart2.Type = new XmlQualifiedName("s:string");
            // Add the 'MessagePart' objects to 'Messages'.
            myPostMessage1.Parts.Add(myPostMessagePart1);
            myPostMessage1.Parts.Add(myPostMessagePart2);
            Message myPostMessage2 = new Message();
            myPostMessage2.Name = "AddNumbersHttpPostout";
            MessagePart myPostMessagePart3 = new MessagePart();
            myPostMessagePart3.Name    = "Body";
            myPostMessagePart3.Element = new XmlQualifiedName("s0:int");
            // Add the 'MessagePart' to 'Message'.
            myPostMessage2.Parts.Add(myPostMessagePart3);
            // Add the 'Message' objects to 'ServiceDescription'.
            myDescription.Messages.Add(myPostMessage1);
            myDescription.Messages.Add(myPostMessage2);
            // Write the 'ServiceDescription' as a WSDL file.
            myDescription.Write("Operation_2_Output_CS.wsdl");
            Console.WriteLine(" 'Operation_2_Output_CS.wsdl' file created Successfully");
// <Snippet1>
// <Snippet2>
            string    myString    = null;
            Operation myOperation = new Operation();
            myDescription = ServiceDescription.Read("Operation_2_Input_CS.wsdl");
            Message[] myMessage = new Message[myDescription.Messages.Count];

            // Copy the messages from the service description.
            myDescription.Messages.CopyTo(myMessage, 0);
            for (int i = 0; i < myDescription.Messages.Count; i++)
            {
                MessagePart[] myMessagePart =
                    new MessagePart[myMessage[i].Parts.Count];

                // Copy the message parts into a MessagePart.
                myMessage[i].Parts.CopyTo(myMessagePart, 0);
                for (int j = 0; j < myMessage[i].Parts.Count; j++)
                {
                    myString += myMessagePart[j].Name;
                    myString += " ";
                }
            }
            // Set the ParameterOrderString equal to the list of
            // message part names.
            myOperation.ParameterOrderString = myString;
            string[] myString1 = myOperation.ParameterOrder;
            int      k         = 0;
            Console.WriteLine("The list of message part names is as follows:");
            while (k < 5)
            {
                Console.WriteLine(myString1[k]);
                k++;
            }
// </Snippet2>
// </Snippet1>
        }
        catch (Exception e)
        {
            Console.WriteLine("The following Exception is raised : " + e.Message);
        }
    }
Example #6
0
    public static void Main()
    {
        ServiceDescription myDescription = ServiceDescription.Read("HttpBinding_ctor_Input_CS.wsdl");
// <Snippet1>
// <Snippet2>
        // Create 'Binding' object.
        Binding myBinding = new Binding();

        myBinding.Name = "MyHttpBindingServiceHttpPost";
        XmlQualifiedName qualifiedName = new XmlQualifiedName("s0:MyHttpBindingServiceHttpPost");

        myBinding.Type = qualifiedName;
        // Create 'HttpBinding' object.
        HttpBinding myHttpBinding = new HttpBinding();

        myHttpBinding.Verb = "POST";
        Console.WriteLine("HttpBinding Namespace : " + HttpBinding.Namespace);
// </Snippet2>
        // Add 'HttpBinding' to 'Binding'.
        myBinding.Extensions.Add(myHttpBinding);
// </Snippet1>
        // Create 'OperationBinding' object.
        OperationBinding myOperationBinding = new OperationBinding();

        myOperationBinding.Name = "AddNumbers";
        HttpOperationBinding myOperation = new HttpOperationBinding();

        myOperation.Location = "/AddNumbers";
        // Add 'HttpOperationBinding' to 'OperationBinding'.
        myOperationBinding.Extensions.Add(myOperation);
        // Create 'InputBinding' object.
        InputBinding       myInput = new InputBinding();
        MimeContentBinding postMimeContentbinding = new MimeContentBinding();

        postMimeContentbinding.Type = "application/x-www-form-urlencoded";
        myInput.Extensions.Add(postMimeContentbinding);
        // Add 'InputBinding' to 'OperationBinding'.
        myOperationBinding.Input = myInput;
        // Create 'OutputBinding' object.
        OutputBinding  myOutput           = new OutputBinding();
        MimeXmlBinding postMimeXmlbinding = new MimeXmlBinding();

        postMimeXmlbinding.Part = "Body";
        myOutput.Extensions.Add(postMimeXmlbinding);
        // Add 'OutPutBinding' to 'OperationBinding'.
        myOperationBinding.Output = myOutput;
        // Add 'OperationBinding' to 'Binding'.
        myBinding.Operations.Add(myOperationBinding);
        // Add 'Binding' to 'BindingCollection' of 'ServiceDescription'.
        myDescription.Bindings.Add(myBinding);
// <Snippet3>
        // Create a 'Port' object.
        Port postPort = new Port();

        postPort.Name    = "MyHttpBindingServiceHttpPost";
        postPort.Binding = new XmlQualifiedName("s0:MyHttpBindingServiceHttpPost");
        // Create 'HttpAddressBinding' object.
        HttpAddressBinding postAddressBinding = new HttpAddressBinding();

        postAddressBinding.Location = "http://localhost/HttpBinding_ctor/HttpBinding_ctor_Service.cs.asmx";
        // Add 'HttpAddressBinding' to 'Port'.
        postPort.Extensions.Add(postAddressBinding);
// </Snippet3>
        // Add 'Port' to 'PortCollection' of 'ServiceDescription'.
        myDescription.Services[0].Ports.Add(postPort);
        // Write 'ServiceDescription' as a WSDL file.
        myDescription.Write("HttpBinding_ctor_Output_CS.wsdl");
        Console.WriteLine("WSDL file with name 'HttpBinding_ctor_Output_CS.wsdl' file created Successfully");
    }
    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;
// <Snippet2>
// <Snippet3>
            // 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);
// </Snippet3>
// </Snippet2>
            // 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);
        }
    }