Unable to resolve Webservice XSD file if schema location as relative path in WSDL RRS feed

  • Question

  • I'm using WCF proxy generation code to parse WSDL file. In that WSDL schema location specified as relative path, and I hosted both WSDL and XSD files in same folder and configured in IIS under default web site. But the code throws below errors.

        The document was understood, but it could not be processed.
          - The WSDL document contains links that could not be resolved.
          - There was an error downloading 'file:///C:/Windows/TEMP/UserService.xsd'.
          - Could not find file 'C:\Windows\TEMP\UserService.xsd'.
          - Could not find file 'C:\Windows\TEMP\UserService.xsd'.
          - Could not find file 'C:\Windows\TEMP\UserService.xsd'.

    part of the WSDL looks like below

    In the WSDL file, it is referring to the external UserService.xsd using a relative location:

        <xsd:import namespace="" schemaLocation="UsweService.xsd">
    Code Snippet

    // First download the contracts if they are accessed over the web.

                    // Try to run RPC2DocumentLiteral converter.
                    MetadataSet metadataSet = new MetadataSet();
                    XmlDocument doc = new XmlDocument();
                    MetadataSection ms = new MetadataSection(null, null, doc);
                    ResolveImports(options, metadataSet);

                // Resolve metadata using a DiscoveryClientProtocol.
                DiscoveryClientProtocol dcp = new DiscoveryClientProtocol();
                    dcp.Credentials = options.Credentials;
                    dcp.AllowAutoRedirect = true;
                    dcp.DiscoverAny(options.MetadataLocation);   Code failing with above error


    But, even when the XSD file is in the same location as the WSDL file, it is not resolving the WSDL file.

    if I modify the schemaLocation without relative path, i am able to generate proxy dll.

    Can someone help me on this regard.


    • Edited by ramakfx Wednesday, June 20, 2018 1:04 PM code included
    Wednesday, June 20, 2018 10:20 AM

All replies

  • Hi Rama,

    It seems you manually generate the client code by wsdl, if you try svcutil.exe to generate the client code, will you receive this error?

    Could you share us the wsdl with xsd files? Then, we could try to reproduce your issue.

    Best Regards,

    Tao Zhou

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, June 21, 2018 6:56 AM