Microsoft KB Archive/820125

= BUG: &quot;The document was understood, but it could not be processed&quot; error message occurs when you try to add a Web reference in Visual Studio .NET =

Article ID: 820125

Article Last Modified on 5/16/2007

-

APPLIES TO


 * Microsoft Web Services Enhancements for Microsoft .NET 1.1
 * Microsoft Web Services Enhancements for Microsoft .NET 2.0
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Professional Edition

-





SYMPTOMS
Visual Studio .NET 2003

You may type the URL of a local Web Services Description Language (WSDL) document and then click Go in the Add Web Reference dialog box. If the corresponding Web service contains a Web Service method that has a Typed Dataset as a parameter or as a return type, you may receive the following error message:

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 'http:// / /Service1.asmx?schema=Dataset1'.

- The request failed with HTTP status 401: Unauthorized.

Note You receive this error only if the WSDL document describes a Web service that uses Basic Authentication.

Visual Studio .NET 2002

You may type the URL of a local Web Services Description Language (WSDL) document and then click Go to in the Add Web Reference dialog box. If the corresponding Web service contains a Web Service method that has a Typed Dataset as a parameter or as a return type, you receive the previous error message. Additionally, you receive the following message:

Web Services

(none)

No Web References were found on this page.

Note You receive this error only if the WSDL document describes a Web service that uses Basic Authentication.



CAUSE
When you create a local WSDL document, documents that are related to the corresponding Web service (including XML Schemas that define Typed Datasets) are also created and then saved on your local disk. When you click Go or you click Go to in the Add Web Reference dialog box, Visual Studio .NET internally starts the Web Services Discovery Tool (Disco.exe). This is done to obtain information about documents that are related to the WSDL document with the URL that you typed. However, when you type the file path of a local WSDL document and then click Go or click Go to, instead of using the locally-saved related documents, Disco.exe incorrectly tries to obtain information from the Web server where the corresponding Web service resides. To access this Web service, Disco.exe must provide credentials that are required for Basic Authentication. However, Disco.exe does not have these credentials and cannot provide them. Therefore, Basic Authentication fails, and you may receive the error message in the &quot;Symptoms&quot; section of this article.



WORKAROUND
To work around this bug, you can modify your local WSDL document so that this document contains the file path of the local XML Schema instead of the URL of the XML Schema that is on the Web server. After you receive the error message in the &quot;Symptoms&quot; section, follow these steps:  In the Add Web Reference dialog box, click Cancel.  Open Service1.wsdl, and then change the location attribute of the import element that corresponds to the XML Schema. You can do this by replacing the URL of the XML Schema on the Web server with the file path of the local copy of the same XML Schema. For example, change the location attribute from http://WebServerName/%WebServicePath%/Service1.asmx?schema=Dataset1 to: %LocalCopyPath%\Dataset1.xsd Note is a placeholder for the name of a Web server, and   is a placeholder for the path of the previously mentioned Web server of a Web service that uses Basic Authentication and that contains a Web Service method that has a Typed Dataset as a parameter or as a return type.

Note Replace  with the path of the folder that contains Service1.wsdl.  Save Service1.wsdl, and then move to TestBasicAuth. On the Project menu, click Add Web Reference. In Visual Studio .NET 2003, type the file path of Service1.wsdl in the URL field of the Add Web Reference dialog box, and then click Go.

In Visual Studio .NET 2002, type the file path of Service1.wsdl in the Address field of the Add Web Reference dialog box and then click Go to.

Notice that you do not receive the error message in the &quot;Symptoms&quot; section. You can click Add Reference to add a Web reference to the local WSDL document of your project.

Note These steps are based on the sample from the &quot;More Information&quot; section of this article. Therefore, the code and the file names in these steps may differ from your code and your file names.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to Reproduce the Problem

 * 1) From the Visual Studio .NET command prompt, change the directory path of the location to a convenient folder where you can save local copies of documents that are related to a Web service.
 * 2) Run the following command from the command prompt:

Disco /u: /p:  http:// / /Service1.asmx

Note Replace  with the name of the Web server. Replace  with the path of the previously mentioned Web server. You must have a Web service that uses Basic Authentication and that contains a Web Service method that has a Typed Dataset as a parameter or as a return type. Replace  with the user name of a user who has local logon rights for the previously mentioned Web server. Replace  with the password of the user.

Note You must use the /u command-line option and the /p command-line option to provide credentials that are required for Basic Authentication.

Note Disco.exe creates files that correspond to Service1.disco, Service1.wsdl, Dataset1.xsd, Results.discomap.
 * 1) Start Visual Studio .NET. Create a Microsoft Windows application that is named TestBasicAuth.

You can use either Visual Basic .NET or Visual C# .NET.
 * 1) On the Project menu, click Add Web Reference.
 * 2) In Visual Studio .NET 2003, type the file path of Service1.wsdl (that Disco.exe created in step 2) in the URL field of the Add Web Reference dialog box. Click Go.

In Visual Studio .NET 2002, type the file path of Service1.wsdl (that Disco.exe created in step 3) in the Address field of the Add Web Reference dialog box. Click Go to.

You receive the error message in the &quot;Symptoms&quot; section.

<div class="references_section">