newbie web services question

T

troyboy

Hi I have created a simple web service using classes to pass data:

[WebMethod(Description = "Test")]
public double test(DataHere data)
{
return 3.5;
}

public class DataHere {
[XmlElement (DataType="int")]
public int myInt;
public double myDouble;
}

My question is how do I attach a schema to this so that I can restrict
myInt to have number from 5 to 10?

In my above example it is very easy to use vs2005 to use the web
service. VS even creates the DataHere class for the client. Can't the
client do some validation using a schema or do I have to validate on
the web service in the test method?

TroyBoy
 
M

Michael Nemtsev

Hello troyboy,

Read there http://msdn.microsoft.com/msdnmag/issues/03/07/XMLSchemaValidation/

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

t> Hi I have created a simple web service using classes to pass data:
t>
t> [WebMethod(Description = "Test")]
t> public double test(DataHere data)
t> {
t> return 3.5;
t> }
t> public class DataHere {
t> [XmlElement (DataType="int")]
t> public int myInt;
t> public double myDouble;
t> }
t> My question is how do I attach a schema to this so that I can
t> restrict myInt to have number from 5 to 10?
t>
t> In my above example it is very easy to use vs2005 to use the web
t> service. VS even creates the DataHere class for the client. Can't the
t> client do some validation using a schema or do I have to validate on
t> the web service in the test method?
t>
t> TroyBoy
t>
 

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

Top