Microsoft KB Archive/815258

= FIX: WSDL Tool Cannot Generate Web Service Proxies in Visual J# .NET =

Article ID: 815258

Article Last Modified on 4/18/2003

-

APPLIES TO


 * Microsoft Visual J# .NET 2003 Standard Edition

-



SYMPTOMS
When you use the Wsdl.exe tool (WSDL) to generate a Web service proxy in a specific language by using the /l or /language switch, you cannot specify the language for Microsoft Visual J# .NET. The language option permits you to specify CS for Microsoft Visual C# .NET, VB for Microsoft Visual Basic .NET, and JS for Microsoft JScript .NET. However, no value is available for Visual J# .NET. Therefore, you cannot generate the proxy file in Visual J# .NET.



WORKAROUND
To work around this problem in Microsoft Visual Studio .NET 2002, you can generate the proxy for JScript .NET, and then manually change the proxy file to make the classes compile by using the Visual J# .NET complier.

For the default HelloWorld Web service, you must make the following changes in the JScript .NET proxy to convert it to a JSharp .NET proxy:   Remove the following line in the class header: //@cc_on //@set @debug(off)   Change the Import statements. For example, replace import System; with the following code: import System.*;   Change the Attribute of class and methods. For example, replace /// public System.Diagnostics.DebuggerStepThroughAttribute System.ComponentModel.DesignerCategoryAttribute(&quot;code&quot;) System.Web.Services.WebServiceBindingAttribute(Name=&quot;Service1Soap&quot;, Namespace=&quot;http://tempuri.org/&quot;) with the following code: /** */ /** @attribute System.Diagnostics.DebuggerStepThroughAttribute*/ /** @attribute System.ComponentModel.DesignerCategoryAttribute(&quot;code&quot;)*/ /** @attribute System.Web.Services.WebServiceBindingAttribute(Name=&quot;Service1Soap&quot;, Namespace=&quot;http://tempuri.org/&quot;)*/   Add the public keyword before the class name as follows. public class Service1   In the constructor setting, change the URL. For example, replace this.Url = &quot;http://localhost/WebService/Service1.asmx&quot;; with the following code: this.set_Url(&quot;http://localhost/WebService/Service1.asmx&quot;);  Change the syntax of the method signature and the variable declaration to JSharp .NET style.

The following code describes a generated proxy in JScript .NET and the corresponding JSharp .NET version after manual changes:

JScript .NET Code //@cc_on //@set @debug(off)

import System.Diagnostics; import System.Xml.Serialization; import System; import System.Web.Services.Protocols; import System.ComponentModel; import System.Web.Services;

// // This source code was auto-generated by wsdl, Version=1.0.3705.0. //

/// public System.Diagnostics.DebuggerStepThroughAttribute System.ComponentModel.DesignerCategoryAttribute(&quot;code&quot;) System.Web.Services.WebServiceBindingAttribute(Name=&quot;Service1Soap&quot;, Namespace=&quot;http://tempuri.org/&quot;) class Service1 extends System.Web.Services.Protocols.SoapHttpClientProtocol { ///    public function Service1 { this.Url = &quot;http://localhost/WebService1/Service1.asmx&quot;; }   ///     public final System.Web.Services.Protocols.SoapDocumentMethodAttribute(&quot;http://tempuri.org/HelloWorld&quot;, RequestNamespace=&quot;http://tempuri.org/&quot;, ResponseNamespace=&quot;http://tempuri.org/&quot;, Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped) function HelloWorld : System.String { var results : System.Object[] = this.Invoke(&quot;HelloWorld&quot;, new System.Object[0]); return System.String(results[0]); }   ///     public final function BeginHelloWorld(callback : System.AsyncCallback, asyncState : System.Object) : System.IAsyncResult { return this.BeginInvoke(&quot;HelloWorld&quot;, new System.Object[0], callback, asyncState); }   ///     public final function EndHelloWorld(asyncResult : System.IAsyncResult) : System.String { var results : System.Object[] = this.EndInvoke(asyncResult); return System.String(results[0]); } } JSharp .NET Code import System.Diagnostics.*; import System.Xml.Serialization.*; import System.*; import System.Web.Services.Protocols.*; import System.ComponentModel.*; import System.Web.Services.*;

// // This source code was auto-generated by wsdl,

Version=1.0.3705.0. //

/** */ /** @attribute

System.Diagnostics.DebuggerStepThroughAttribute*/ /** @attribute

System.ComponentModel.DesignerCategoryAttribute(&quot;code&quot;)*/ /** @attribute

System.Web.Services.WebServiceBindingAttribute(Name=&quot;Service1Soa

p&quot;, Namespace=&quot;http://tempuri.org/&quot;)*/ public class Service1 extends

System.Web.Services.Protocols.SoapHttpClientProtocol { /** */   public Service1 {

this.set_Url(&quot;http://localhost/WebService1/Service1.asmx&quot;); }   /** */    /** @attribute

System.Web.Services.Protocols.SoapDocumentMethodAttribute(&quot;http:

//tempuri.org/HelloWorld&quot;,

RequestNamespace=&quot;http://tempuri.org/&quot;,

ResponseNamespace=&quot;http://tempuri.org/&quot;,

Use=System.Web.Services.Description.SoapBindingUse.Literal,

ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.

Wrapped)*/   public String HelloWorld {        Object[] results = this.Invoke(&quot;HelloWorld&quot;, new

Object[0]);       return ((String)(results[0]));    }    /** */    public System.IAsyncResult

BeginHelloWorld(System.AsyncCallback callback, Object

asyncState) {       return this.BeginInvoke(&quot;HelloWorld&quot;, new Object[0],

callback, asyncState);   }    /** */    public String EndHelloWorld(System.IAsyncResult asyncResult)

{       Object[] results = this.EndInvoke(asyncResult); return ((String)(results[0])); } }

<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. This bug was corrected in Microsoft Visual Studio .NET version 2003.

<div class="moreinformation_section">

Steps to Reproduce the Behavior
 In Microsoft Visual Studio .NET 2002, open a Command Window.</li> At the command prompt, type the following command, and then press ENTER.

wsdl /?

</li> Locate the help for the /language:  option.</li> Verify in the description that the language option for Visual J# .NET is missing.</li></ol>

Keywords: kbbug kbfix kbservice kbwnet kbcommandline kbwebservices KB815258

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.