Unable to import binding

Discussion in 'ASP .Net Web Services' started by robert.p.king@gmail.com, Dec 8, 2005.

  1. Guest

    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/nsassem/PlayerHost/PlayerHost%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://schemas.microsoft.com/clr/nsassem/PlayerHost/PlayerHost%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    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/nsassem/PlayerHost.Information/PlayerHost%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    xmlns:ns1="http://schemas.microsoft.com/clr/ns/System"
    xmlns:ns0="http://schemas.microsoft.com/clr/nsassem/PlayerHost/PlayerHost%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    xmlns:ns3="http://schemas.microsoft.com/clr/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089"
    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/nsassem/PlayerHost/PlayerHost%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'.
    ===================================================

    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/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089"

    Can anyone shed some light on this problem? I'm not a remoting guru by
    any means.
    , Dec 8, 2005
    #1
    1. Advertising

  2. GCR Guest

    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/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089", 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.
    GCR, Dec 9, 2005
    #2
    1. Advertising

  3. Guest

    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?
    , Dec 11, 2005
    #3
  4. GCR Guest

    OK, let's try to clear this step by step: can you post the wsdl?

    "" wrote:

    > 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?
    >
    >
    GCR, Dec 12, 2005
    #4
  5. Guest

    <?xml version="1.0" encoding="UTF-8" ?>
    - <definitions name="Information"
    targetNamespace="http://schemas.microsoft.com/clr/nsassem/JukeboxHostCS/JukeboxHostCS%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:tns="http://schemas.microsoft.com/clr/nsassem/JukeboxHostCS/JukeboxHostCS%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    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/nsassem/JukeboxHostCS.Information/JukeboxHostCS%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    xmlns:ns0="http://schemas.microsoft.com/clr/nsassem/JukeboxHostCS/JukeboxHostCS%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"
    xmlns:ns1="http://schemas.microsoft.com/clr/ns/System"
    xmlns:ns3="http://schemas.microsoft.com/clr/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089"
    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>
    , Dec 13, 2005
    #5
  6. GCR Guest

    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/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089"

    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/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089" />
    </xsd:schema>

    Good luck!
    GCR, Dec 14, 2005
    #6
  7. Guest

    GCR wrote:
    > 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/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089"
    >
    > 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/nsassem/System.Data/System.Data%2C%20Version%3D2.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Db77a5c561934e089" />
    > </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?
    , Dec 14, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jordan
    Replies:
    2
    Views:
    2,513
    Jordan
    Feb 10, 2004
  2. Amit
    Replies:
    6
    Views:
    13,740
    Assimalyst
    Oct 24, 2006
  3. Besharam

    WSDL failing to parse Unable to import binding

    Besharam, Oct 1, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    273
    Besharam
    Oct 1, 2003
  4. Replies:
    0
    Views:
    974
  5. imonline

    Unable to import binding

    imonline, Nov 16, 2006, in forum: ASP .Net Web Services
    Replies:
    4
    Views:
    812
    John Saunders
    Nov 18, 2006
Loading...

Share This Page