Returning XML that conforms to a schema

M

Mike Lopez

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
 
M

Mike Lopez

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 said:
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:[email protected]]
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
 
D

Dilip Krishnan

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
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top