本文整理汇总了C#中System.Web.Services.Description.ConformanceCheckContext类的典型用法代码示例。如果您正苦于以下问题:C# ConformanceCheckContext类的具体用法?C# ConformanceCheckContext怎么用?C# ConformanceCheckContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConformanceCheckContext类属于System.Web.Services.Description命名空间,在下文中一共展示了ConformanceCheckContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckConformance
public static bool CheckConformance (WsiClaims claims, ServiceDescription service, BasicProfileViolationCollection violations)
{
ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
col.Add (service);
ConformanceCheckContext ctx = new ConformanceCheckContext (col, violations);
return Check (claims, ctx, col);
}
示例2: GetAbsoluteUri
/*
private string GetAbsoluteUri (string baseUri, string relativeUri)
{
string actualBaseUri = baseUri ?? Path.GetFullPath (".") + Path.DirectorySeparatorChar;
Uri uri = new Uri (new Uri (actualBaseUri), relativeUri);
return uri.ToString ();
}
*/
public override void Check (ConformanceCheckContext ctx, Import value)
{
if (value.Location == "" || value.Location == null) {
ctx.ReportRuleViolation (value, BasicProfileRules.R2007);
return;
}
if (!new Uri (value.Namespace, UriKind.RelativeOrAbsolute).IsAbsoluteUri)
ctx.ReportRuleViolation (value, BasicProfileRules.R2803);
// LAMESPEC: RetrievalUrl does not seem to help here (in .NET)
//ServiceDescription importer = value.ServiceDescription;
//string absUri = GetAbsoluteUri (importer != null ? importer.RetrievalUrl : null, value.Location);
object doc = ctx.GetDocument (/*absUri*/value.Location, value.Namespace);
if (doc == null) // and looks like .net ignores non-resolvable documentation... I dunno if it makes sense. I don't care :/
return; //ctx.ReportError (value, "Document '" + value.Location + "' not found");
if (doc is XmlSchema)
ctx.ReportRuleViolation (value, BasicProfileRules.R2002);
ServiceDescription imported = doc as ServiceDescription;
if (imported == null) {
ctx.ReportRuleViolation (value, BasicProfileRules.R2001);
return;
}
if (imported.TargetNamespace != value.Namespace)
ctx.ReportRuleViolation (value, BasicProfileRules.R2005);
}
示例3: Check
public override void Check (ConformanceCheckContext ctx, MessagePart value)
{
CheckWsdlQName (ctx, value, value.Type);
CheckWsdlQName (ctx, value, value.Element);
if (value.DefinedByElement && value.Element.Namespace == XmlSchema.Namespace)
ctx.ReportRuleViolation (value, BasicProfileRules.R2206);
}
示例4: Check
static bool Check (WsiClaims claims, ConformanceCheckContext ctx, IEnumerable documents)
{
ConformanceChecker[] checkers = GetCheckers (claims);
if (checkers == null) return true;
foreach (object doc in documents) {
if (!(doc is ServiceDescription)) continue;
foreach (ConformanceChecker c in checkers)
Check (ctx, c, (ServiceDescription)doc);
}
return ctx.Violations.Count == 0;
}
示例5: Check
internal static void Check (ConformanceCheckContext ctx, ConformanceChecker checker, Binding b)
{
checker.Check (ctx, b);
CheckExtensions (ctx, checker, b.Extensions);
foreach (OperationBinding oper in b.Operations) {
CheckExtensions (ctx, checker, oper.Extensions);
foreach (MessageBinding mb in oper.Faults) {
checker.Check (ctx, mb);
CheckExtensions (ctx, checker, mb.Extensions);
}
checker.Check (ctx, oper.Input);
CheckExtensions (ctx, checker, oper.Input.Extensions);
checker.Check (ctx, oper.Output);
CheckExtensions (ctx, checker, oper.Output.Extensions);
}
}
示例6: CheckObjects
static void CheckObjects (ConformanceCheckContext ctx, ConformanceChecker checker, Hashtable visitedObjects, XmlSchemaObjectCollection col)
{
foreach (XmlSchemaObject item in col)
Check (ctx, checker, visitedObjects, item);
}
示例7: CheckWsdlQName
// Helper methods
void CheckWsdlQName (ConformanceCheckContext ctx, object element, XmlQualifiedName name)
{
if (name == null || name == XmlQualifiedName.Empty) return;
if (name.Namespace == "" || name.Namespace == XmlSchema.Namespace) return;
if (ctx.ServiceDescription.Types != null && ctx.ServiceDescription.Types.Schemas != null)
{
foreach (XmlSchema s in ctx.ServiceDescription.Types.Schemas)
{
if (s.TargetNamespace == name.Namespace) return;
foreach (XmlSchemaObject i in s.Includes)
if ((i is XmlSchemaImport) && ((XmlSchemaImport)i).Namespace == name.Namespace) return;
}
}
ctx.ReportRuleViolation (element, BasicProfileRules.R2101);
}
示例8: CheckSchemaQName
void CheckSchemaQName (ConformanceCheckContext ctx, object element, XmlQualifiedName name)
{
if (name == null || name == XmlQualifiedName.Empty) return;
if (name.Namespace == "" || name.Namespace == XmlSchema.Namespace) return;
if (ctx.CurrentSchema.TargetNamespace == name.Namespace) return;
foreach (XmlSchemaObject i in ctx.CurrentSchema.Includes)
if ((i is XmlSchemaImport) && ((XmlSchemaImport)i).Namespace == name.Namespace) return;
ctx.ReportRuleViolation (element, BasicProfileRules.R2102);
}
示例9: CheckExtensions
static void CheckExtensions (ConformanceCheckContext ctx, ConformanceChecker checker, ServiceDescriptionFormatExtensionCollection extensions)
{
foreach (ServiceDescriptionFormatExtension ext in extensions)
checker.Check (ctx, ext);
}
示例10: ImportBinding
void ImportBinding (ServiceDescription desc, Service service, TypeStubInfo typeInfo, string url, BindingInfo binfo)
{
port = new Port ();
port.Name = portNames.AddUnique (binfo.Name, port);
bool bindingFull = true;
if (binfo.Namespace != desc.TargetNamespace)
{
if (binfo.Location == null || binfo.Location == string.Empty)
{
ServiceDescription newDesc = new ServiceDescription();
newDesc.TargetNamespace = binfo.Namespace;
newDesc.Name = binfo.Name;
bindingFull = ImportBindingContent (newDesc, typeInfo, url, binfo);
if (bindingFull) {
int id = ServiceDescriptions.Add (newDesc);
AddImport (desc, binfo.Namespace, GetWsdlUrl (url,id));
}
}
else {
AddImport (desc, binfo.Namespace, binfo.Location);
bindingFull = true;
}
}
else
bindingFull = ImportBindingContent (desc, typeInfo, url, binfo);
if (bindingFull)
{
port.Binding = new XmlQualifiedName (binding.Name, binfo.Namespace);
int n = 0;
string name = binfo.Name;
bool found;
do {
found = false;
foreach (Port p in service.Ports)
if (p.Name == name) { found = true; n++; name = binfo.Name + n; break; }
}
while (found);
port.Name = name;
service.Ports.Add (port);
}
if (binfo.WebServiceBindingAttribute != null && binfo.WebServiceBindingAttribute.ConformsTo != WsiProfiles.None && String.IsNullOrEmpty (binfo.WebServiceBindingAttribute.Name)) {
BasicProfileViolationCollection violations = new BasicProfileViolationCollection ();
desc.Types.Schemas.Add (Schemas);
ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
col.Add (desc);
ConformanceCheckContext ctx = new ConformanceCheckContext (col, violations);
ctx.ServiceDescription = desc;
ConformanceChecker[] checkers = WebServicesInteroperability.GetCheckers (binfo.WebServiceBindingAttribute.ConformsTo);
foreach (ConformanceChecker checker in checkers) {
ctx.Checker = checker;
WebServicesInteroperability.Check (ctx, checker, binding);
if (violations.Count > 0)
throw new InvalidOperationException (violations [0].ToString ());
}
}
}