BUG: "No Classes Were Generated" Warning Message or "Error When Reading File" Error Message May Occur When an XML Web Services Proxy File Is Created by Using the Web Services Description Language Tool (Wsdl.exe) (820123)



The information in this article applies to:

  • Microsoft Web Services (included with the .NET Framework 1.1)
  • Microsoft Web Services (included with the .NET Framework) 1.0

SYMPTOMS

When you try to create an XML Web services proxy file for a Web Services Description Language (WSDL) file by using the Web Services Description Language Tool (Wsdl.exe), you may receive the following warning message or the following error message:

Warning: no classes were generated.

Error: Error when reading file 'Service1.wsdl'.
- There is an error in XML document (3, 23).
- 'Element' is an invalid node type. Line 3, position 23.

CAUSE

WSDL uses the documentation element (<documentation>) to make human-readable documentation. The human-readable documentation may include HTML tags. However, when your WSDL file has HTML tags in documentation elements, and then you try to create an XML Web services proxy file for your WSDL file by using Wsdl.exe, you may receive the warning message or the error message in the "Symptoms" section.

WORKAROUND

To work around this problem, you must contain the documentation elements in annotation elements (<annotation>). To do this, follow these steps:
  1. Open Service1.wsdl.
  2. Locate, and then replace
       <documentation>
    with the following code:
       <annotation>
       <documentation>
  3. Locate and then replace
       </documentation>
    with the following code:
       </documentation>
       </annotation>
  4. Service1.wsdl now contains the following code:
    <?xml version="1.0" encoding="utf-8"?>
    <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://tempuri.org/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
       <annotation>
        <documentation><B>Hello!</B>
        </documentation>
       </annotation>
       <types>
          <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
             <s:element name="HelloWorld">
                <s:complexType />
             </s:element>
             <s:element name="HelloWorldResponse">
                <s:complexType>
                   <s:sequence>
                      <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
                   </s:sequence>
                </s:complexType>
             </s:element>
          </s:schema>
       </types>
       <message name="HelloWorldSoapIn">
          <part name="parameters" element="s0:HelloWorld" />
       </message>
       <message name="HelloWorldSoapOut">
          <part name="parameters" element="s0:HelloWorldResponse" />
       </message>
       <portType name="Service1Soap">
          <operation name="HelloWorld">
             <input message="s0:HelloWorldSoapIn" />
             <output message="s0:HelloWorldSoapOut" />
          </operation>
       </portType>
       <binding name="Service1Soap" type="s0:Service1Soap">
          <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
          <operation name="HelloWorld">
             <soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
             <input>
                <soap:body use="literal" />
             </input>
             <output>
                <soap:body use="literal" />
             </output>
          </operation>
       </binding>
       <service name="Service1">
          <port name="Service1Soap" binding="s0:Service1Soap">
             <soap:address location="http://localhost/MyWebService/Service1.asmx" />
          </port>
       </service>
    </definitions>
  5. From the Microsoft Visual Studio .NET command prompt, change the directory path of the location of Service1.wsdl.
  6. Run the following command from the command prompt:

    wsdl Service1.wsdl

    You may notice a message similar to the following:

    Writing file '%File Path%\Service1.cs'.

    An XML Web services proxy file that is named Service1.cs is created. The placeholder for the location of Service1.wsdl is %File Path%.
Note These steps are based on the sample from the "More Information" section of this article. Therefore, the code and the file names in the steps may differ from your code and your file names.

STATUS

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

MORE INFORMATION

Steps to Reproduce the Problem

  1. Open Notepad and then paste the following WSDL code:
    <?xml version="1.0" encoding="utf-8"?>
    <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://tempuri.org/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
       <documentation><B>Hello!</B>
       </documentation>
       <types>
          <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
             <s:element name="HelloWorld">
                <s:complexType />
             </s:element>
             <s:element name="HelloWorldResponse">
                <s:complexType>
                   <s:sequence>
                      <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" />
                   </s:sequence>
                </s:complexType>
             </s:element>
          </s:schema>
       </types>
       <message name="HelloWorldSoapIn">
          <part name="parameters" element="s0:HelloWorld" />
       </message>
       <message name="HelloWorldSoapOut">
          <part name="parameters" element="s0:HelloWorldResponse" />
       </message>
       <portType name="Service1Soap">
          <operation name="HelloWorld">
             <input message="s0:HelloWorldSoapIn" />
             <output message="s0:HelloWorldSoapOut" />
          </operation>
       </portType>
       <binding name="Service1Soap" type="s0:Service1Soap">
          <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
          <operation name="HelloWorld">
             <soap:operation soapAction="http://tempuri.org/HelloWorld" style="document" />
             <input>
                <soap:body use="literal" />
             </input>
             <output>
                <soap:body use="literal" />
             </output>
          </operation>
       </binding>
       <service name="Service1">
          <port name="Service1Soap" binding="s0:Service1Soap">
             <soap:address location="http://localhost/MyWebService/Service1.asmx" />
          </port>
       </service>
    </definitions>
  2. Save the file as Service1.wsdl.
  3. From the Visual Studio .NET command prompt, change the directory path to the location of Service1.wsdl that you created in step 2.
  4. Run the following command from the command prompt:

    wsdl Service1.wsdl

    You receive the warning message in the "Symptoms" section of this article.
  5. Open Service1.wsdl.
  6. Locate and then replace
       <documentation><B>Hello!</B>
       </documentation>
    
    with the following code:
       <documentation>Hello! <B>World</B>
       </documentation>
  7. Save Service1.wsdl and then run the following command from the command prompt.

    wsdl Service1.wsdl

    You receive the error message in the "Symptoms" section of this article.

REFERENCES

For more information about how you can create an XML Web services proxy and the Web Services Description Language Tool (Wsdl.exe), visit the following Microsoft Web sites:

http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcreatingwebserviceproxy.asp

http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfwebservicesdescriptionlanguagetoolwsdlexe.asp

For more information about Web Services Description Language (WSDL) 1.1, visit the following W3C Web site:

http://www.w3.org/TR/wsdl

Modification Type:MajorLast Reviewed:6/3/2003
Keywords:kbXML kbSchema kbCommandLine kbProxyDev kbCodeGen kbMiscTools kbDeployment kbConfig kbClient kberrmsg kbWebServices kbCompiler kbbug KB820123 kbAudDeveloper