コード例 #1
0
        public static XmlQualifiedName EnsureProbeMatchSchema(DiscoveryVersion discoveryVersion, XmlSchemaSet schemaSet)
        {
            Fx.Assert(schemaSet != null, "The schemaSet must be non null.");
            Fx.Assert(discoveryVersion != null, "The discoveryVersion must be non null.");

            // ensure that EPR is added to the schema.
            if (discoveryVersion == DiscoveryVersion.WSDiscoveryApril2005 || discoveryVersion == DiscoveryVersion.WSDiscoveryCD1)
            {
                EndpointAddressAugust2004.GetSchema(schemaSet);
            }
            else if (discoveryVersion == DiscoveryVersion.WSDiscovery11)
            {
                EndpointAddress10.GetSchema(schemaSet);
            }
            else
            {
                Fx.Assert("The discoveryVersion is not supported.");
            }

            // do not add/find Probe related schema items
            SchemaTypes    typesFound    = SchemaTypes.ProbeType | SchemaTypes.ResolveType;
            SchemaElements elementsFound = SchemaElements.None;

            XmlSchema   discoverySchema  = null;
            ICollection discoverySchemas = schemaSet.Schemas(discoveryVersion.Namespace);

            if ((discoverySchemas == null) || (discoverySchemas.Count == 0))
            {
                discoverySchema = CreateSchema(discoveryVersion);
                AddImport(discoverySchema, discoveryVersion.Implementation.WsaNamespace);
                schemaSet.Add(discoverySchema);
            }
            else
            {
                foreach (XmlSchema schema in discoverySchemas)
                {
                    discoverySchema = schema;
                    if (schema.SchemaTypes.Contains(discoveryVersion.Implementation.QualifiedNames.ProbeMatchType))
                    {
                        typesFound |= SchemaTypes.ProbeMatchType;
                        break;
                    }

                    LocateSchemaTypes(discoveryVersion, schema, ref typesFound);
                    LocateSchemaElements(discoveryVersion, schema, ref elementsFound);
                }
            }

            if ((typesFound & SchemaTypes.ProbeMatchType) != SchemaTypes.ProbeMatchType)
            {
                AddSchemaTypes(discoveryVersion, typesFound, discoverySchema);
                AddElements(discoveryVersion, elementsFound, discoverySchema);
                schemaSet.Reprocess(discoverySchema);
            }

            return(discoveryVersion.Implementation.QualifiedNames.ProbeMatchType);
        }
コード例 #2
0
        public void GetSchema()
        {
            // actually it just returns null. That makes sense
            // since there's no way to include reasonable claim
            // schemas.
            EndpointAddress10.FromEndpointAddress(new EndpointAddress("http://localhost:8080"));
            XmlSchemaSet     xss = new XmlSchemaSet();
            XmlQualifiedName q   = EndpointAddress10.GetSchema(xss);

            Assert.AreEqual(1, xss.Count, "#1");
            Assert.AreEqual("EndpointReferenceType", q.Name, "#2");
            Assert.AreEqual("http://www.w3.org/2005/08/addressing", q.Namespace, "#2");
            foreach (XmlSchema xs in xss.Schemas())
            {
                Assert.AreEqual("http://www.w3.org/2005/08/addressing", xs.TargetNamespace, "#4");
            }
        }
コード例 #3
0
 public static XmlQualifiedName GetSchema(XmlSchemaSet schemaSet)
 {
     EndpointAddress10.GetSchema(schemaSet);
     schemaSet.Add(schema);
     return(new XmlQualifiedName("ResolveType", version.Namespace));
 }