R
robert.p.king
I'm having a problem which is driving me mad.
I have a simple remote object which I am hosting in a windows forms
app. The code for the class is (modified from Coding4Fun Issue 6):
===================================================
Imports Microsoft.MediaPlayer.Interop
Imports PlayerHost.MediaPlayer
Imports System.Drawing.Imaging
Imports System.Data
Public Class Information
Inherits MarshalByRefObject
Public Function GetEverything() As DataTable
Dim pl As IWMPPlaylist
pl = Player.mediaCollection.getAll()
Dim Library As New DataTable("Library")
Library.Columns.Add("Artist")
If pl.count > 0 Then
For y As Integer = 0 To pl.count - 1
Dim newrow As DataRow = Library.NewRow()
Dim track As IWMPMedia = pl.Item(y)
newrow("Artist") = track.getItemInfo("Artist")
Library.Rows.Add(newrow)
Next
End If
Return Library
End Function
<..... other methods an stuff removed for brevity .....>
End Class
===================================================
My windows forms app exposes this class in its OnLoad event like so:
===================================================
RegisterWellKnownServiceType(GetType(Information), "Information.soap",
WellKnownObjectMode.SingleCall)
Dim channel As New Channels.Http.HttpChannel(9000)
Channels.ChannelServices.RegisterChannel(channel, False)
===================================================
If I then run the app and connect to the url
http://localhost:9000/Information.soap?WSDL I get the schema as
expected. I then add a web reference to the schema in VS2005. This
seems to work fine and I get no errors.
The namespace definitions look like this:
===================================================
<definitions name="Information"
targetNamespace="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:suds="http://www.w3.org/2000/wsdl/suds"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:ns1="http://schemas.microsoft.com/clr/ns/System"
xmlns:ns0="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
===================================================
However, when I actually try to call the service from a Asp.Net 2.0
page, I get an error:
===================================================
Unable to import binding 'InformationBinding' from namespace
'http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null'.
===================================================
So i tried the wsdl.exe tool and got some more information:
===================================================
Error: Unable to import binding 'InformationBinding' from namespace
'http://sche
mas.microsoft.com/clr/nsassem/PlayerHost/PlayerHost%2C%20Version%3D1.0.0.0%2C%20
Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'.
- Unable to import operation 'GetEverything'.
- The datatype
'http://schemas.microsoft.com/clr/nsassem/System.Data/System.Da
ta%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561
934e089ataTable' is missing.
===================================================
I've tried changing the GetEverything method to return a DataSet, XML
string, MemoryStream but it seems that for any return type outside of
the System namespace I get an error.
I did notice that in the schema definitions above, the System namespace
is defined simply as
xmlns:ns1="http://schemas.microsoft.com/clr/ns/System" but the
System.Data is defined as
xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"
Can anyone shed some light on this problem? I'm not a remoting guru by
any means.
I have a simple remote object which I am hosting in a windows forms
app. The code for the class is (modified from Coding4Fun Issue 6):
===================================================
Imports Microsoft.MediaPlayer.Interop
Imports PlayerHost.MediaPlayer
Imports System.Drawing.Imaging
Imports System.Data
Public Class Information
Inherits MarshalByRefObject
Public Function GetEverything() As DataTable
Dim pl As IWMPPlaylist
pl = Player.mediaCollection.getAll()
Dim Library As New DataTable("Library")
Library.Columns.Add("Artist")
If pl.count > 0 Then
For y As Integer = 0 To pl.count - 1
Dim newrow As DataRow = Library.NewRow()
Dim track As IWMPMedia = pl.Item(y)
newrow("Artist") = track.getItemInfo("Artist")
Library.Rows.Add(newrow)
Next
End If
Return Library
End Function
<..... other methods an stuff removed for brevity .....>
End Class
===================================================
My windows forms app exposes this class in its OnLoad event like so:
===================================================
RegisterWellKnownServiceType(GetType(Information), "Information.soap",
WellKnownObjectMode.SingleCall)
Dim channel As New Channels.Http.HttpChannel(9000)
Channels.ChannelServices.RegisterChannel(channel, False)
===================================================
If I then run the app and connect to the url
http://localhost:9000/Information.soap?WSDL I get the schema as
expected. I then add a web reference to the schema in VS2005. This
seems to work fine and I get no errors.
The namespace definitions look like this:
===================================================
<definitions name="Information"
targetNamespace="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:suds="http://www.w3.org/2000/wsdl/suds"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:ns1="http://schemas.microsoft.com/clr/ns/System"
xmlns:ns0="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
===================================================
However, when I actually try to call the service from a Asp.Net 2.0
page, I get an error:
===================================================
Unable to import binding 'InformationBinding' from namespace
'http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null'.
===================================================
So i tried the wsdl.exe tool and got some more information:
===================================================
Error: Unable to import binding 'InformationBinding' from namespace
'http://sche
mas.microsoft.com/clr/nsassem/PlayerHost/PlayerHost%2C%20Version%3D1.0.0.0%2C%20
Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'.
- Unable to import operation 'GetEverything'.
- The datatype
'http://schemas.microsoft.com/clr/nsassem/System.Data/System.Da
ta%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561
934e089ataTable' is missing.
===================================================
I've tried changing the GetEverything method to return a DataSet, XML
string, MemoryStream but it seems that for any return type outside of
the System namespace I get an error.
I did notice that in the schema definitions above, the System namespace
is defined simply as
xmlns:ns1="http://schemas.microsoft.com/clr/ns/System" but the
System.Data is defined as
xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"
Can anyone shed some light on this problem? I'm not a remoting guru by
any means.