BUG: "Unable to import binding" error message when you try to create an XML Web service proxy for the .NET Framework remoting service that contains Char data type members or Guid data type members (831689)



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 run the Web Services Description Language tool (Wsdl.exe) in Microsoft Visual Studio .NET to create an XML Web service proxy for the .NET Framework remoting service that contains either a Char data type member or a Guid data type member, you may receive an error message that is similar to the following error message:

Error: Unable to import binding 'MyRemoteObjectBinding' from namespace 'http://schemas.microsoft.com/clr/nsassem/ConsoleApplication1/ConsoleApplication1%2C%20Version%3D1.0.1510.36520%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'.
- Unable to import operation 'setValue'.
- The datatype 'Char' is missing.

Note The following information pertains to the previous error message:
  • In the error message, MyRemoteObject is a placeholder for the class name of the .NET Framework remoting service.
  • The error message corresponds to the .NET Framework remoting service that contains a Char data type member. If the .NET Framework remoting service contains a Guid data type, the error message will contain the following information:

    - The datatype 'Guid' is missing.
  • In the error message, the word "datatype" is a misspelling for the words "data type."

CAUSE

The common language runtime supports the Char data type and the Guid data type. The Web Services Description Language (WSDL) does not implicitly support these data types. The WSDL code for the .NET Framework remoting service only references these data types from the predefined http://schemas.microsoft.com/clr/ns/System namespace. However, the WSDL code does not contain the definitions that are included in the http://schemas.microsoft.com/clr/ns/System namespace, and the WSDL code does not import the http://schemas.microsoft.com/clr/ns/System namespace. Therefore, because the WSDL code contains references to a Char data type value or to a Guid data type value, the problem that is mentioned in the "Symptoms" section occurs.

WORKAROUND

To work around this problem, you must not use data types such as the Char data type and the Guid data type in the WSDL code for the .NET Framework remoting service. Instead, you must use custom classes that implement these data types.

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. Start Visual Studio .NET.
  2. Use Microsoft Visual Basic .NET to create a Console Application project.

    By default, the Module1.vb file is created.
  3. On the Project menu, click Add Reference.

    The Add Reference dialog box appears.
  4. On the .NET tab, click System.Runtime.Remoting under Component Name.
  5. Click Select, and then click OK.
  6. Replace the existing code in the Module1.vb file with the following code:
    Option Explicit On 
    Option Strict On
    
    Imports System
    Imports System.Runtime.Remoting
    Imports System.Runtime.Remoting.Channels.Http
    Imports System.Runtime.Remoting.Channels
    Imports System.Threading
    
    Class MyRemoteObject
       Inherits MarshalByRefObject
    
       Private myvalue As Guid
    
       Public Sub New()
          Console.WriteLine("MyRemoteObject.Constructor: New Object created")
       End Sub
    
       Public Sub setValue(ByVal newval As Guid)
          Console.WriteLine("MyRemoteObject.setValue(): old {0} new {1}", myvalue, newval)
          myvalue = newval
          Console.WriteLine("MyRemoteObject.setValue() -> value is now set")
       End Sub
    
       Public Function getValue() As Guid
          Console.WriteLine("MyRemoteObject.getValue(): current {0}", myvalue)
          Return myvalue
       End Function
    
    End Class
    
    Module Module1
    
       Sub Main()
          Console.WriteLine("Module1.Main(): Server started")
    
          Dim chnl As New HttpChannel(1234)
          ChannelServices.RegisterChannel(chnl)
    
          RemotingConfiguration.RegisterWellKnownServiceType( _
              GetType(MyRemoteObject), "MyRemoteObject.soap", _
              WellKnownObjectMode.Singleton)
    
          ' The server keeps running until you press ENTER.
          Console.ReadLine()
    
       End Sub
    
    End Module

  7. On the File menu, click Save All.
  8. On the Build menu, click Build Solution to build your application.
  9. On the Debug menu, click Start to run your application.

    A Console window appears and displays the following message:

    Module1.Main(): Server started
  10. At a Visual Studio .NET command prompt, run the following command to try to create an XML Web service proxy for the .NET Framework remoting service:

    wsdl http://localhost:1234/MyRemoteObject.soap?wsdl

    The behavior that is mentioned in the "Symptoms" section occurs.

REFERENCES

For additional information about creating an XML Web service proxy, visit the following Microsoft Developer Network (MSDN) Web site:For additional information about the .NET Framework remoting service, visit the following MSDN Web site:For additional information about the Web Services Description Language tool (Wsdl.exe), visit the following MSDN Web site:For additional information about WSDL with .NET attribution, visit the following MSDN Web site:For additional information about how to understand WSDL, visit the following MSDN Web site: For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

301112 HOW TO: Marshal an object to a remote server by reference by using Visual Basic .NET


Modification Type:MajorLast Reviewed:2/27/2004
Keywords:kberrmsg kbcode kbMiscTools kbChannels kbCommandLine kbhttp kbNameSpace kbServer kbWebServices kbRemoting kbBug KB831689 kbAudDeveloper