Returning XML that conforms to a schema

Discussion in 'ASP .Net Web Services' started by Mike Lopez, Jan 26, 2005.

  1. Mike Lopez

    Mike Lopez Guest

    Hello.

    I'm using Visual Studio 2003 (.Net 1.1).

    I have a web service method that returns a single value. I also have a
    schema that defines the request and response messages.

    How do I code the web service to return the single value in the format
    defined by the response element in the schema?

    Thanks in advance,

    Mike
    Mike Lopez, Jan 26, 2005
    #1
    1. Advertising

  2. Mike Lopez

    Mike Lopez Guest

    Hi, Chris. Thanks for responding.

    I don't know if that'll work. I was kind of hoping you could tell me.

    Obviously I'm new to WS. In all the reading that I've done on the subject,
    nowhere can I find how to do what I need. All the literature is content with
    adding [WebMethod] to a method and spewing out the default response (the
    "tempuri.org" element).

    What exactly am I missing? Do I have to use SOAP or something to generate
    this? I could manually construct an XmlDocument and return that, right? But
    that doesn't seem like the right thing to do because I can do that with good
    old ASP.

    Maybe the tool that you suggest will enlighten me. I will certainly give it
    a shot.

    Thanks again,

    Mike

    "Christoph Schittko [MVP]" <> wrote in message
    news:%...
    > Mike,
    >
    > You could download the Web Services Contract First tool (wscf) from
    > http://www.thinktecture.com/wscf and let it help you by assigning the
    > schema types to WSDL operations and generate service code.
    >
    > Would that work?
    >
    > Thanks,
    > Christoph Schittko
    > MVP XML
    > http://weblogs.asp.net/cschittko
    >
    >
    >> -----Original Message-----
    >> From: Mike Lopez [mailto:]
    >> Posted At: Wednesday, January 26, 2005 1:47 PM
    >> Posted To: microsoft.public.dotnet.framework.aspnet.webservices
    >> Conversation: Returning XML that conforms to a schema
    >> Subject: Returning XML that conforms to a schema
    >>
    >> Hello.
    >>
    >> I'm using Visual Studio 2003 (.Net 1.1).
    >>
    >> I have a web service method that returns a single value. I also have a
    >> schema that defines the request and response messages.
    >>
    >> How do I code the web service to return the single value in the format
    >> defined by the response element in the schema?
    >>
    >> Thanks in advance,
    >>
    >> Mike

    >
    >
    Mike Lopez, Jan 27, 2005
    #2
    1. Advertising

  3. Hello Mike,
    Simplest way is to use the xsd tool (xsd.exe) to create the types you
    need based on the schema. Then add the generated classes to you services
    and return the objects that are instances of the class generated by your
    xsd tool.

    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    http://www.geniant.com

    > Hello.
    >
    > I'm using Visual Studio 2003 (.Net 1.1).
    >
    > I have a web service method that returns a single value. I also have a
    > schema that defines the request and response messages.
    >
    > How do I code the web service to return the single value in the format
    > defined by the response element in the schema?
    >
    > Thanks in advance,
    >
    > Mike
    >
    Dilip Krishnan, Jan 27, 2005
    #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. Markus
    Replies:
    1
    Views:
    1,529
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,251
    Stanimir Stamenkov
    Apr 25, 2005
  3. vaibhav
    Replies:
    3
    Views:
    1,146
    vaibhav
    Aug 14, 2006
  4. Mike Lopez

    Trying to return a C# Class that conforms to a schema

    Mike Lopez, Feb 4, 2005, in forum: ASP .Net Web Services
    Replies:
    7
    Views:
    159
    Dan Rogers
    Feb 15, 2005
  5. Jacob
    Replies:
    0
    Views:
    103
    Jacob
    Jun 30, 2003
Loading...

Share This Page