Microsoft KB Archive/815258

From BetaArchive Wiki

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:

  1. Remove the following line in the class header:

    //@cc_on
    //@set @debug(off)
  2. Change the Import statements. For example, replace

    import System;

    with the following code:

    import System.*;
  3. Change the Attribute of class and methods. For example, replace

    /// <remarks/>
    public System.Diagnostics.DebuggerStepThroughAttribute() System.ComponentModel.DesignerCategoryAttribute("code") System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap", Namespace="http://tempuri.org/") 

    with the following code:

    /** <remarks/> */
    /** @attribute 
    System.Diagnostics.DebuggerStepThroughAttribute()*/
    /** @attribute 
    System.ComponentModel.DesignerCategoryAttribute("code")*/
    /** @attribute 
    System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap", Namespace="http://tempuri.org/")*/
  4. Add the public keyword before the class name as follows.

    public class Service1
  5. In the constructor setting, change the URL. For example, replace

    this.Url = "http://localhost/WebService/Service1.asmx";

    with the following code:

    this.set_Url("http://localhost/WebService/Service1.asmx");
  6. 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.
// 

/// <remarks/>
public System.Diagnostics.DebuggerStepThroughAttribute() System.ComponentModel.DesignerCategoryAttribute("code") System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap", Namespace="http://tempuri.org/") 
class Service1 extends System.Web.Services.Protocols.SoapHttpClientProtocol {
    
    /// <remarks/>
    public function Service1() {
        this.Url = "http://localhost/WebService1/Service1.asmx";
        
    }
    
    /// <remarks/>
    public final System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloWorld", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped) function HelloWorld() : System.String {
        var results : System.Object[] = this.Invoke("HelloWorld", new System.Object[0]);
        return System.String(results[0]);
    }
    
    /// <remarks/>
    public final function BeginHelloWorld(callback : System.AsyncCallback, asyncState : System.Object) : System.IAsyncResult {
        return this.BeginInvoke("HelloWorld", new System.Object[0], callback, asyncState);
    }
    
    /// <remarks/>
    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.
// 

/** <remarks/> */
/** @attribute 

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

System.ComponentModel.DesignerCategoryAttribute("code")*/
/** @attribute 

System.Web.Services.WebServiceBindingAttribute(Name="Service1Soa

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

System.Web.Services.Protocols.SoapHttpClientProtocol {
    
    /** <remarks/> */
    public Service1() {
        

this.set_Url("http://localhost/WebService1/Service1.asmx");
    }
    
    /** <remarks/> */
    /** @attribute 

System.Web.Services.Protocols.SoapDocumentMethodAttribute("http:

//tempuri.org/HelloWorld", 

RequestNamespace="http://tempuri.org/", 

ResponseNamespace="http://tempuri.org/", 

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

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

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

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

BeginHelloWorld(System.AsyncCallback callback, Object 

asyncState) {
        return this.BeginInvoke("HelloWorld", new Object[0], 

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

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

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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. In Microsoft Visual Studio .NET 2002, open a Command Window.
  2. At the command prompt, type the following command, and then press ENTER.

    wsdl /?

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


Keywords: kbbug kbfix kbservice kbwnet kbcommandline kbwebservices KB815258