Click here to Skip to main content
15,883,705 members
Articles / Programming Languages / C#

WCF Support for WSDL 2.0

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
12 Feb 2011CPOL3 min read 43.9K   457   5  
A command line utility to generate WCF proxies from WSDL 2.0 documents.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Web;
using System.Xml;
using WsdlConverter;

namespace svcutil2
{
    class Program
    {
        private const string prefix = "http://localhost:8765/wsdl2wsdl/";

        public static void Main(string[] args)
        {

            Console.WriteLine("");
            Console.WriteLine("Generated by wsdl2wsdl");
            Console.WriteLine("Yaron Naveh http://webservices20.blogspot.com/");
            Console.WriteLine("=============================================");
            Console.WriteLine("");

            var listener = new Wsdl2Listener(prefix);
            listener.Start();

            try
            {
                RunSvcUtil(args);
            }
            finally
            {
                listener.Stop();
            }


            Console.WriteLine("");
            Console.WriteLine("=============================================");
            Console.WriteLine("Generated by wsdl2wsdl");
            Console.WriteLine("Yaron Naveh http://webservices20.blogspot.com/");
            Console.WriteLine("");
        }

        private static void RunSvcUtil(string[] args)
        {
            var newArgs = new string[args.Length];
            Array.Copy(args, newArgs, args.Length);
            newArgs[newArgs.Length-1] = String.Format(
                "{0}?{1}", 
                prefix, 
                newArgs[newArgs.Length-1]);
            Utils.RunExe(@"svcutil.exe", newArgs);
        }


        
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Israel Israel
Web services interoperability expert.

http://webservices20.blogspot.com/

Comments and Discussions