Returning a custom class in a Web Service

Discussion in 'ASP .Net Web Services' started by Iain, Jul 3, 2004.

  1. Iain

    Iain Guest

    I am writing a Web Service in c# which returns a object structure as an out
    parameter.

    The object (an Order specification) is produced by xsd schema and features
    the usuual combination of public properties and arrays of things.

    The WEb Service builds fine.

    When I try and import it with VS 2003 I get the message below.

    I've looked at the wsdl and the class type is defined in xsd form pretty
    much as I would have expected.

    This issue appears to have hit other people, but the only vaguely useful
    responses have related to Namespaces, which I've checked.

    What does this message *mean*?

    D:\Code\ProburnWeb\OrderMaker\Web References\OrderBatches\Reference.map(1):
    Custom tool error: Unable to import WebService/Schema. Unable to import
    binding 'PBWebAdminSoap' from namespace 'http://idcl.co.uk/PBWEbAdmin'.
    Unable to import operation 'GetBatch'. The datatype
    'http://schemas.xmlsoap.org/wsdl/:Order' is missing.


    Thanks!

    Iain
    Iain, Jul 3, 2004
    #1
    1. Advertising

  2. Iain

    Iain Guest

    Lenin. Thanks for your response.

    The schema (xsd file) I'm using has no other schema dependencies. All the
    types are standard xml types.

    And at least superficially, the contents of the class definition in the
    schema for the returned object in the wsdl file seems well formed and
    coherent.

    However, your comments does suggest that I can try some decomposition on
    this (start with a new xsd file containing one element -> new class ->
    export it) to see where the problem occurs.

    My interim solution was to return the Xml from the database as a string and
    parse it on the client. this more or less is happening anyway (at least I
    think it is ) so it should be no great issue.

    AH!!! could this be something to do with the object definition on the
    client side?
    (the class IS imported into the client app...)

    Iain


    "John Jenkins" <> wrote in message
    news:nkWFc.746$...
    > Hi Iain,
    > does the schema you are defining your class against import other
    > schemas with the schemaLocation attribute set?
    >
    >
    > I came across a similar issue in a project I am working on. My problem
    > however resulted from the creation of classes from the xsd files using the
    > xsd.exe tool.
    >
    > The issue was related to the fact that the schemaLocation attribute is
    > apprently a "hint" in the appropriate specification. What it means that if
    > you import any schemas into your schema you must add them to the command
    > line of the XSD.exe commandline.
    >
    > e.g. xsd.exe /c MainSchema.xsd importedSchema.xsd
    >
    > HTH
    >
    > Lenin
    >
    >
    > "Iain" <> wrote in message
    > news:Oh13%...
    > > I am writing a Web Service in c# which returns a object structure as an

    > out
    > > parameter.
    > >
    > > The object (an Order specification) is produced by xsd schema and

    features
    > > the usuual combination of public properties and arrays of things.
    > >
    > > The WEb Service builds fine.
    > >
    > > When I try and import it with VS 2003 I get the message below.
    > >
    > > I've looked at the wsdl and the class type is defined in xsd form pretty
    > > much as I would have expected.
    > >
    > > This issue appears to have hit other people, but the only vaguely useful
    > > responses have related to Namespaces, which I've checked.
    > >
    > > What does this message *mean*?
    > >
    > > D:\Code\ProburnWeb\OrderMaker\Web

    > References\OrderBatches\Reference.map(1):
    > > Custom tool error: Unable to import WebService/Schema. Unable to import
    > > binding 'PBWebAdminSoap' from namespace 'http://idcl.co.uk/PBWEbAdmin'.
    > > Unable to import operation 'GetBatch'. The datatype
    > > 'http://schemas.xmlsoap.org/wsdl/:Order' is missing.
    > >
    > >
    > > Thanks!
    > >
    > > Iain
    > >
    > >

    >
    >
    Iain, Jul 5, 2004
    #2
    1. Advertising

  3. Iain

    Iain Guest

    The resolution to this problem was as follows: -

    The XSD file from which the schema was generated must have a
    targetNamespace.

    The WebRequest must have the same targetNamespace.

    I ended up getting hopelessly confused about namespace qualifications in the
    schema (which did NOT seem to work as I expected) so I simply set no
    qualifications for the target namespace

    targetNamespace = "http://fred.com" xmlns="http://fred.com" with the two
    formDefaults as unqualified...

    Iain

    "Iain" <> wrote in message
    news:...
    > Lenin. Thanks for your response.
    >
    > The schema (xsd file) I'm using has no other schema dependencies. All the
    > types are standard xml types.
    Iain, Jul 5, 2004
    #3
    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. DNB
    Replies:
    1
    Views:
    245
  2. Toby Mathews

    Returning nested class from web service

    Toby Mathews, Oct 28, 2003, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    195
    Mohan
    Nov 4, 2003
  3. suresh_C#

    returning custom class from web service

    suresh_C#, Sep 21, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    96
    suresh_C#
    Sep 21, 2004
  4. Replies:
    0
    Views:
    119
  5. Leo Violette
    Replies:
    0
    Views:
    998
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page