// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+using System.IO;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Xml;
get { return WsiProfiles.BasicProfile1_1; }
}
+ /*
+ 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) {
if (!new Uri (value.Namespace, UriKind.RelativeOrAbsolute).IsAbsoluteUri)
ctx.ReportRuleViolation (value, BasicProfileRules.R2803);
-
- object doc = ctx.GetDocument (value.Location);
- if (doc == null) ctx.ReportError (value, "Document '" + value.Location + "' not found");
+
+ // 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);
public override void Check (ConformanceCheckContext ctx, BindingCollection value) {
foreach (Binding b in value)
- foreach (ServiceDescriptionFormatExtension ext in b.Extensions)
+ foreach (object ext in b.Extensions)
if (ext.GetType () == typeof (SoapBinding))
return;
foreach (OperationMessage om in op.Messages) {
Message msg = ctx.Services.GetMessage (om.Message);
foreach (MessagePart part in msg.Parts)
- parts.Add (part,part);
+ parts [part] = part; // do not use Add() - there could be the same MessagePart instance.
}
}
void CheckR2305 (ConformanceCheckContext ctx, Operation value)
{
string [] order = value.ParameterOrder;
- if (order == null || order.Length == 0)
- return;
- bool omitted = false;
- bool violation = false;
- for (int i = 0; i < value.Messages.Count; i++) {
- OperationMessage msg = value.Messages [i];
- if (msg.Name == null) {
- if (omitted)
- violation = true;
- else
- omitted = true;
+ ServiceDescription sd = value.PortType.ServiceDescription;
+ Message omitted = null;
+ foreach (OperationMessage m in value.Messages) {
+ if (m.Name == null)
+ continue; // it is doubtful, but R2305 is not to check such cases anyways.
+ Message msg = sd.Messages [m.Name];
+ if (msg == null)
+ continue; // it is doubtful, but R2305 is not to check such cases anyways.
+ foreach (MessagePart p in msg.Parts) {
+ if (order != null && Array.IndexOf (order, p.Name) >= 0)
+ continue;
+ if (omitted == null) {
+ omitted = msg;
+ continue;
+ }
+ ctx.ReportRuleViolation (value, BasicProfileRules.R2305);
+ return;
}
- else if (order [omitted ? i - 1 : i] != msg.Name)
- violation = true;
}
- if (violation)
- ctx.ReportRuleViolation (value, BasicProfileRules.R2305);
}
public override void Check (ConformanceCheckContext ctx, OperationMessage value) { }
public override void Check (ConformanceCheckContext ctx, XmlSchemaImport value)
{
- XmlSchema doc = ctx.GetDocument (value.SchemaLocation) as XmlSchema;
+ // LAMESPEC: same here to Check() for Import.
+ XmlSchema doc = ctx.GetDocument (value.SchemaLocation, value.Namespace) as XmlSchema;
if (doc == null) ctx.ReportError (value, "Schema '" + value.SchemaLocation + "' not found");
}
}
}
-#endif