コード例 #1
0
        public void CheckEmptyOutput()          // bug #6041
        {
            BasicProfileViolationCollection bc = new BasicProfileViolationCollection();

            WebServicesInteroperability.CheckConformance(
                WsiProfiles.BasicProfile1_1,
                ServiceDescription.Read(TestResourceHelper.GetFullPathOfResource("Test/System.Web.Services.Description/6041.wsdl")), bc);
        }
コード例 #2
0
        public void ResolveImport()          // should not result in an error
        {
            BasicProfileViolationCollection bc = new BasicProfileViolationCollection();

            WebServicesInteroperability.CheckConformance(
                WsiProfiles.BasicProfile1_1,
                ServiceDescription.Read(TestResourceHelper.GetFullPathOfResource("Test/System.Web.Services.Description/check-import.wsdl")), bc);
        }
コード例 #3
0
        public void CheckR2305_1()          // bug #443095
        {
            BasicProfileViolationCollection bc = new BasicProfileViolationCollection();

            WebServicesInteroperability.CheckConformance(
                WsiProfiles.BasicProfile1_1,
                ServiceDescription.Read("Test/System.Web.Services.Description/443095.wsdl"), bc);
        }
コード例 #4
0
        private static void CheckInteroperabilityConformance(WebReference reference, DiscoveryReference result)
        {
            var violations = new BasicProfileViolationCollection();

            WebServicesInteroperability.CheckConformance(WsiProfiles.BasicProfile1_1, reference, violations);
            if (violations.Count > 0)
            {
                result.Warn("This web reference does not conform to WS-I Basic Profile v1.1.");
                foreach (var v in violations)
                {
                    result.Warn(v.ToString());
                }
            }
        }
コード例 #5
0
ファイル: MonoWSDL2.cs プロジェクト: pmq20/mono_forked
        ///
        /// <summary>
        ///	Generate code for the specified ServiceDescription.
        /// </summary>
        ///
        public bool GenerateCode(WebReferenceCollection references, CodeCompileUnit codeUnit)
        {
            bool hasWarnings = false;

            CodeDomProvider provider = GetProvider();

            StringCollection    validationWarnings;
            WebReferenceOptions opts = new WebReferenceOptions();

            opts.CodeGenerationOptions = options;
            opts.Style         = style;
            opts.Verbose       = verbose;
            validationWarnings = ServiceDescriptionImporter.GenerateWebReferences(references, provider, codeUnit, opts);

            for (int n = 0; n < references.Count; n++)
            {
                WebReference wr = references [n];

                BasicProfileViolationCollection violations = new BasicProfileViolationCollection();
                if (String.Compare(protocol, "SOAP", StringComparison.OrdinalIgnoreCase) == 0 && !WebServicesInteroperability.CheckConformance(WsiProfiles.BasicProfile1_1, wr, violations))
                {
                    wr.Warnings |= ServiceDescriptionImportWarnings.WsiConformance;
                }

                if (wr.Warnings != 0)
                {
                    if (!hasWarnings)
                    {
                        WriteText("", 0, 0);
                        WriteText("There were some warnings while generating the code:", 0, 0);
                    }

                    WriteText("", 0, 0);
                    WriteText(urls[n], 2, 2);

                    if ((wr.Warnings & ServiceDescriptionImportWarnings.WsiConformance) > 0)
                    {
                        WriteText("- This web reference does not conform to WS-I Basic Profile v1.1", 4, 6);
                        foreach (BasicProfileViolation vio in violations)
                        {
                            WriteText(vio.NormativeStatement + ": " + vio.Details, 8, 8);
                            foreach (string ele in vio.Elements)
                            {
                                WriteText("* " + ele, 10, 12);
                            }
                        }
                    }

                    if ((wr.Warnings & ServiceDescriptionImportWarnings.NoCodeGenerated) > 0)
                    {
                        WriteText("- WARNING: No proxy class was generated", 4, 6);
                    }
                    if ((wr.Warnings & ServiceDescriptionImportWarnings.NoMethodsGenerated) > 0)
                    {
                        WriteText("- WARNING: The proxy class generated includes no methods", 4, 6);
                    }
                    if ((wr.Warnings & ServiceDescriptionImportWarnings.OptionalExtensionsIgnored) > 0)
                    {
                        WriteText("- WARNING: At least one optional extension has been ignored", 4, 6);
                    }
                    if ((wr.Warnings & ServiceDescriptionImportWarnings.RequiredExtensionsIgnored) > 0)
                    {
                        WriteText("- WARNING: At least one necessary extension has been ignored", 4, 6);
                    }
                    if ((wr.Warnings & ServiceDescriptionImportWarnings.UnsupportedBindingsIgnored) > 0)
                    {
                        WriteText("- WARNING: At least one binding is of an unsupported type and has been ignored", 4, 6);
                    }
                    if ((wr.Warnings & ServiceDescriptionImportWarnings.UnsupportedOperationsIgnored) > 0)
                    {
                        WriteText("- WARNING: At least one operation is of an unsupported type and has been ignored", 4, 6);
                    }

                    hasWarnings = true;
                }
            }

            if (hasWarnings)
            {
                WriteText("", 0, 0);
            }

            string filename    = outFilename;
            bool   hasBindings = false;

            foreach (object doc in references[0].Documents.Values)
            {
                ServiceDescription desc = doc as ServiceDescription;
                if (desc == null)
                {
                    continue;
                }

                if (desc.Services.Count > 0 && filename == null)
                {
                    filename = desc.Services[0].Name + "." + provider.FileExtension;
                }

                if (desc.Bindings.Count > 0 || desc.Services.Count > 0)
                {
                    hasBindings = true;
                }
            }

            if (filename == null)
            {
                filename = "output." + provider.FileExtension;
            }

            if (hasBindings)
            {
                WriteText("Writing file '" + filename + "'", 0, 0);
                StreamWriter writer = new StreamWriter(filename);

                CodeGeneratorOptions compilerOptions = new CodeGeneratorOptions();
                provider.GenerateCodeFromCompileUnit(codeUnit, writer, compilerOptions);
                writer.Close();
            }

            return(hasWarnings);
        }