Microsoft KB Archive/831689

= BUG: &quot;Unable to import binding&quot; 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 =

Article ID: 831689

Article Last Modified on 5/17/2007

-

APPLIES TO


 * Microsoft Web Services Enhancements for Microsoft .NET 1.1
 * Microsoft Web Services Enhancements for Microsoft .NET 2.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 ' Binding' 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,  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 &quot;datatype&quot; is a misspelling for the words &quot;data type.&quot;



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 &quot;Symptoms&quot; 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.



Steps to reproduce the problem
 Start Visual Studio .NET.</li> Use Microsoft Visual Basic .NET to create a Console Application project.

By default, the Module1.vb file is created.</li> On the Project menu, click Add Reference.

The Add Reference dialog box appears.</li> On the .NET tab, click System.Runtime.Remoting under Component Name.</li> Click Select, and then click OK.</li>  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(&quot;MyRemoteObject.Constructor: New Object created&quot;) End Sub

Public Sub setValue(ByVal newval As Guid) Console.WriteLine(&quot;MyRemoteObject.setValue: old {0} new {1}&quot;, myvalue, newval) myvalue = newval Console.WriteLine(&quot;MyRemoteObject.setValue -> value is now set&quot;) End Sub

Public Function getValue As Guid Console.WriteLine(&quot;MyRemoteObject.getValue: current {0}&quot;, myvalue) Return myvalue End Function

End Class

Module Module1

Sub Main Console.WriteLine(&quot;Module1.Main: Server started&quot;)

Dim chnl As New HttpChannel(1234) ChannelServices.RegisterChannel(chnl)

RemotingConfiguration.RegisterWellKnownServiceType( _         GetType(MyRemoteObject), &quot;MyRemoteObject.soap&quot;, _          WellKnownObjectMode.Singleton)

' The server keeps running until you press ENTER. Console.ReadLine

End Sub

End Module

</li> On the File menu, click Save All.</li> On the Build menu, click Build Solution to build your application.</li> On the Debug menu, click Start to run your application.

A Console window appears and displays the following message:

Module1.Main: Server started

</li> 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 &quot;Symptoms&quot; section occurs.</li></ol>

<div class="references_section">