Ejemplo n.º 1
0
        public static void GenerateFromWsdl(Uri uri, string wsdlFilename,
		                                     string xmlFilename, string xsdFilename)
        {
            var doc = Utils.LoadMetadata (uri, wsdlFilename);
            var importer = new WsdlImporter (doc);
            var endpoints = importer.ImportAllEndpoints ();

            var config = new Configuration ();
            foreach (var endpoint in endpoints)
                config.AddEndpoint (endpoint);

            Generator.Write (xmlFilename, xsdFilename, config);
        }
Ejemplo n.º 2
0
        public static void Run(string xmlFilename, string xsdFilename)
        {
            var http = new BasicHttpBinding ();
            http.OpenTimeout = TimeSpan.FromHours (3);
            http.MaxBufferSize = 8192;
            http.HostNameComparisonMode = HostNameComparisonMode.WeakWildcard;
            http.AllowCookies = true;
            http.Security.Mode = BasicHttpSecurityMode.Transport;
            http.TransferMode = TransferMode.StreamedRequest;

            #if !MOBILE || MOBILE_BAULIG
            var https = new BasicHttpsBinding ();
            https.MaxBufferSize = 32768;
            #endif

            #if !MOBILE_FIXME
            var netTcp = new NetTcpBinding ();
            #endif

            var custom = new CustomBinding ();
            custom.Name = "myCustomBinding";
            var text = new TextMessageEncodingBindingElement ();
            text.MessageVersion = MessageVersion.Soap12WSAddressingAugust2004;
            custom.Elements.Add (text);
            custom.Elements.Add (new HttpTransportBindingElement ());

            var root = new Configuration ();
            root.AddBinding (http);
            #if !MOBILE || MOBILE_BAULIG
            root.AddBinding (https);
            #endif
            #if !MOBILE_FIXME
            root.AddBinding (netTcp);
            #endif
            root.AddBinding (custom);

            var contract = new ContractDescription ("MyContract");
            var endpointUri = "custom://localhost:8888/MyService";
            var endpointAddress = new EndpointAddress (endpointUri);

            var endpoint = new ServiceEndpoint (contract, custom, endpointAddress);

            root.AddEndpoint (endpoint);

            Generator.Write (xmlFilename, xsdFilename, root);

            Utils.Dump (xsdFilename);
            Utils.Dump (xmlFilename);

            Utils.ValidateSchema (xmlFilename, xsdFilename);
        }