none
schemalocation missing from Wsdl inported for MEX endpoint, how to load xsd in this case. RRS feed

  • Question

  • I have used SVCUtil.exe to download wsdl file for MEX endpoint. Though all schemas linked to wsdl are downloaded but Schemalocation attribute is missing from wsdl file and therefore I could not parse it using Service Description class. It throws null for 

    XmlSchemaxmlSchema = serviceDescription.Types.Schemas[0].;

    Please help me how to add schemalocation attribute programmatically.

    Thanks,

    Mamta

    Thursday, April 9, 2015 12:53 PM

Answers

  • SchemaLocation is only a hint, so it is not required and its processing is up to specific XSD processors: some will use it, some will ignore it. Svcutil.exe does not put schemaLocation attributes when processing assemblies, try add this to your generated C# class:

    [XmlAttribute("schemaLocation", Namespace = XmlSchema.InstanceNamespace)]
    public string xsiSchemaLocation = "http://www.topografix.com/GPX/1/1 " +
                                      "http://www.topografix.com/GPX/1/1/gpx.xsd";

    Friday, April 10, 2015 5:23 AM