Microsoft KB Archive/317807

= BUG: Compile Error Message When You Add a Web Reference to a Managed Extensions for C++ Application =

Article ID: 317807

Article Last Modified on 12/6/2003

-

APPLIES TO


 * Microsoft Visual C++ .NET 2002 Standard Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition

-



This article was previously published under Q317807



SYMPTOMS
When you add a Web reference to a .NET Web service (.asmx file) in a Managed Extensions for C++ application, you may receive a compile-time error message similar to the following:

Creating web service proxy file...

Error: Cannot find definition for http://test:test. Service Description with namespace http://test is missing.

Parameter name: name

If you would like more help, please type &quot;wsdl /?&quot;.

error CS2001: Source file 'Server.cs' could not be found

fatal error CS2008: No inputs specified

The system cannot find the file specified.

You do not experience this behavior when you add the Web reference in a Visual C# .NET application or in a Visual Basic .NET application.



RESOLUTION
To work around this issue, you have to generate the client proxy class (.cs file) that the error message shows as &quot;not found,&quot; and then generate an assembly (.dll file) to which you can reference. To do this, follow these steps:  To generate the client proxy class, use the Web Services Description Language tool (Wsdl.exe). Type the following command at a Visual Studio .NET command prompt, and then press ENTER. Verify that you are working in the same directory where the project is located.

wsdl http://localhost/WeblessService/WeblessService.asmx

 The following are two ways to generate an assembly from the client proxy class that you generated previously:  Generate an assembly manually by typing the following command at a Visual Studio .NET command prompt. This command generates the Server.dll assembly.

csc /t:library Server.cs

-or- Generate the assembly through the add webreference wizard. To do this, follow these steps:  Remove the .wsdl file (for example, Server.wsdl) from the project's Solution Explorer window. This file was added when you tried to add the Web reference earlier. If you do not remove the Server.wsdl file that was created earlier, the wizard will create Server1.wsdl and will look for Server1.cs proxy, and then you will receive an error message again. Try to add a Web reference from the Solution Explorer. Use the same procedure that you tried earlier. You do not receive an error message this time because you have already generated the client proxy class.</ol> </li></ul> </li> You have to add a reference to use this assembly. To do this, add a reference to the WebService.h header file (add #include &quot;WebService.h&quot; statement in the .cpp file) that was generated when you tried to add the Web reference through the wizard. This header file adds a reference to the Server.dll assembly.</li></ol>

<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 Behavior
To reproduce the problem, follow these steps: <ol>  Create a virual directory named WeblessService, copy the following sample code in the WeblessService.asmx file, and then save the file to a vitual directory: <%@WebService language=&quot;c#&quot; class=&quot;WebService1.Server&quot;%>

namespace WebService1 {

using System; using System.Web.Services; using System.Web.Services.Protocols;

[WebServiceBinding(&quot;test&quot;, &quot;http://test&quot;, &quot;http://localhost/test.wsdl&quot;)] public class Server {

public Server { }

[SoapDocumentMethod(Binding=&quot;test&quot;)] [WebMethod] public string HelloWorld { return &quot;Hello World!&quot;; }  }

}                   </li>  Copy the following sample code to Test.wsdl, and then save this file to $\inetpub\wwwroot: <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <definitions xmlns:s=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:http=&quot;http://schemas.xmlsoap.org/wsdl/http/&quot; xmlns:mime=&quot;http://schemas.xmlsoap.org/wsdl/mime/&quot; xmlns:tm=&quot;http://microsoft.com/wsdl/mime/textMatching/&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot; xmlns:soapenc=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:tns=&quot;http://test&quot; targetNamespace=&quot;http://test&quot; xmlns=&quot;http://schemas.xmlsoap.org/wsdl/&quot;> <xs:schema xmlns:tns=&quot;http://test&quot; elementFormDefault=&quot;qualified&quot; targetNamespace=&quot;http://test&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;> <xs:element name=&quot;testa&quot;> <xs:complexType /> </xs:element> <xs:element name=&quot;testaResponse&quot;> <xs:complexType /> </xs:element> </xs:schema> <message name=&quot;testaSoapIn&quot;> <part name=&quot;parameters&quot; element=&quot;tns:testa&quot; /> <message name=&quot;testaSoapOut&quot;> <part name=&quot;parameters&quot; element=&quot;tns:testaResponse&quot; /> <portType name=&quot;test&quot;> <operation name=&quot;testa&quot;> <input message=&quot;tns:testaSoapIn&quot; /> <output message=&quot;tns:testaSoapOut&quot; /> </portType> <binding name=&quot;test&quot; type=&quot;tns:test&quot;> <soap:binding transport=&quot;http://schemas.xmlsoap.org/soap/http&quot; style=&quot;document&quot; /> <operation name=&quot;testa&quot;> <soap:operation soapAction=&quot;http://tempuri.org/testa&quot; style=&quot;document&quot; /> <soap:body use=&quot;literal&quot; /> <soap:body use=&quot;literal&quot; />

</li> Create the default Managed Extensions for C++ Application.</li> Add a Web reference by pointing to the asmx that you created in step 1 (http://localhost/WeblessService/WeblessService.asmx ).</li></ol>

<div class="references_section">