Unable to import binding

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
934e089:DataTable' 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.
 
G

GCR

I think that your problem comes because the DataTable resides in a namespace
with a schema definition not included in current type definitions. You
probably have somewhere another xsd file (or should have), with the
namespace="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089", where the DataTable definition.
Get this file, add an Import element into your wsdl file, pointig to this
file and mention it as input parameter when calling xsd.exe.
 
R

robert.p.king

Errr, you lost me at XSD files.

All I've done is used Visual Studio 2005 to connect to a web reference
where the hosted remote object is and it did the rest. Is VS2005
missing an import step or something?
 
R

robert.p.king

<?xml version="1.0" encoding="UTF-8" ?>
- <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:ns0="http://schemas.microsoft.com/clr/ns...1.0.0.0, Culture=neutral, PublicKeyToken=null"
xmlns:ns1="http://schemas.microsoft.com/clr/ns/System"
xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<message name="Information.GetEverythingInput" />
- <message name="Information.GetEverythingOutput">
<part name="return" type="ns3:DataTable" />
</message>
- <portType name="InformationPortType">
- <operation name="GetEverything">
<input name="GetEverythingRequest"
message="tns:Information.GetEverythingInput" />
<output name="GetEverythingResponse"
message="tns:Information.GetEverythingOutput" />
</operation>
</portType>
- <binding name="InformationBinding" type="tns:InformationPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<suds:class type="ns0:Information" rootType="MarshalByRefObject" />
- <operation name="GetEverything">
<soap:eek:peration
soapAction="http://schemas.microsoft.com/clr/nsassem/JukeboxHostCS.Information/JukeboxHostCS#GetEverything"
/>
<suds:method attributes="public" />
- <input name="GetEverythingRequest">
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://schemas.microsoft.com/clr/nsassem/JukeboxHostCS.Information/JukeboxHostCS"
/>
</input>
- <output name="GetEverythingResponse">
<soap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://schemas.microsoft.com/clr/nsassem/JukeboxHostCS.Information/JukeboxHostCS"
/>
</output>
</operation>
</binding>
- <service name="InformationService">
- <port name="InformationPort" binding="tns:InformationBinding">
<soap:address location="http://localhost:9000/Information.soap" />
</port>
</service>
</definitions>
 
G

GCR

As I allready said, the definition of the DataTable Type is missing: you have
the namespace declaration as:

xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"

but in the "Information.GetEverythingOutput" message, the "return" part is
of "ns3:DataTable" type, however you cannot find any description of this type
in the wsdl file, neither an import of an external schema file, containing
this description!

<message name="Information.GetEverythingOutput">
<part name="return" type="ns3:DataTable" />
</message>

You need to generate a schema file for the DataTable type and import it in
your wsdl file, like:

<xsd:schema>
<xsd:import schemaLocation="DataTable.xsd"
namespace="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089" />
</xsd:schema>

Good luck!
 
R

robert.p.king

GCR said:
As I allready said, the definition of the DataTable Type is missing: you have
the namespace declaration as:

xmlns:ns3="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089"

but in the "Information.GetEverythingOutput" message, the "return" part is
of "ns3:DataTable" type, however you cannot find any description of this type
in the wsdl file, neither an import of an external schema file, containing
this description!

<message name="Information.GetEverythingOutput">
<part name="return" type="ns3:DataTable" />
</message>

You need to generate a schema file for the DataTable type and import it in
your wsdl file, like:

<xsd:schema>
<xsd:import schemaLocation="DataTable.xsd"
namespace="http://schemas.microsoft.com/clr/ns...ture=neutral, PublicKeyToken=b77a5c561934e089" />
</xsd:schema>

Good luck!

Ok, I understand that, but I don't know what's involved in generating a
schema file for the DataTable type. Is there some info on the web that
might help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top