473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

what is Schema (xsd) for? For client or for the service itself?

I am trying to use schema to validate the data that user sent to my
service. How do I achieve that using schema? Do I give schema to the
client? or do I write my own schema validation inside web service?
How does it work? Thank you.

Jul 14 '06 #1
3 1353
kkao77 a écrit :
I am trying to use schema to validate the data that user sent to my
service. How do I achieve that using schema? Do I give schema to the
client? or do I write my own schema validation inside web service?
How does it work? Thank you.

Let's suppose that you have to passe some "complex type" in a WebMethod
parameter.
It could be for exemple an XmlDocument type.

It's your responsibility to ensure that the syntax of the XmlDocument
passed in conforms to the syntax you expect.
To be more precise, if you manage both the client-end and the
server-end, you don't have to check the syntax.
In more open scenarios (you manage only the server-end), it's crucial
to check the syntax (for security reasons mostly).

In fact SOAP ensures type checking : suppose your WebMethod expects an
XmlDocument ; if a client calls your method with a parameter of another
type , you'll get a SOAP exception raised by the XmlSerializer on the
server-side.

Jul 14 '06 #2
Thanks olrt,

So does that mean if I use .net, I don't need to worry abou schema in
this case especially writing webmethod(), it is more useful for people
who prepares xml documents to form those elements and attributes?

I thought I would create schema on server end so the user could
validate some info. once they consume my service. and I was wondering
since they have to create proxy, there is not really xml document to
validate against to, becuase their deserialized xml becomes a class for
them to use and each property has it's own type. Am I right? Thanks
for help.
olrt wrote:
kkao77 a écrit :
I am trying to use schema to validate the data that user sent to my
service. How do I achieve that using schema? Do I give schema to the
client? or do I write my own schema validation inside web service?
How does it work? Thank you.


Let's suppose that you have to passe some "complex type" in a WebMethod
parameter.
It could be for exemple an XmlDocument type.

It's your responsibility to ensure that the syntax of the XmlDocument
passed in conforms to the syntax you expect.
To be more precise, if you manage both the client-end and the
server-end, you don't have to check the syntax.
In more open scenarios (you manage only the server-end), it's crucial
to check the syntax (for security reasons mostly).

In fact SOAP ensures type checking : suppose your WebMethod expects an
XmlDocument ; if a client calls your method with a parameter of another
type , you'll get a SOAP exception raised by the XmlSerializer on the
server-side.
Jul 14 '06 #3
kkao77 a écrit :
Thanks olrt,

So does that mean if I use .net, I don't need to worry abou schema in
this case especially writing webmethod(), it is more useful for people
who prepares xml documents to form those elements and attributes?
I think I hadn't been clear.
If you have total control of both the client and server sides, you
don't need to validate the syntax of the objects on the server since
you have control of the objects'syntax on the client.

I thought I would create schema on server end so the user could
validate some info. once they consume my service. and I was wondering
since they have to create proxy, there is not really xml document to
validate against to, becuase their deserialized xml becomes a class for
them to use and each property has it's own type. Am I right? Thanks
for help.
Be aware that there are only certain types that are WSDL-compatible.
This is the case for primitive types (string, double, etc.) and some
complex types (XmlNode, DataSet).
If the class you expose to client is not WSDL-compatible, you'll have
to make it IXmlSerializable.
But unfortunately this isn't enough.
For example in .NET, wsdl.exe (which can be used to generate a proxy)
generates a DataSet-parametered method for a XmlDocument-derived
parametered Webmethod :-(
So the client will have to edit the proxy code to effectively consume
the exposed class.

See my post "XmlDocument-derived class ..." in this newsgroup that
exposes some issues related to passing a complex-type parameter through
SOAP.

Regards,
Olivier.

Jul 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ben | last post by:
Due to my unfamiliarity with schemas, I am unable to figure out how to accomplish the same type of processing that I have currently working under a dtd. We have a pre-defined generic message...
0
by: johnsocs | last post by:
All I'm trying to write an xml schema for the following xml from the google web service api. In the schema I'm not sure how to describe the soapenv:encodingStyle attribute. Thanks. <?xml...
0
by: Jeremy Summers | last post by:
Has anyone run into problems creating typed datasets from complex schemas? I am attempting to create a Typed Dataset in Visual Studio .Net from a .xsd schema file for a industry standard web...
4
by: bibsoconner | last post by:
Hi, I hope someone can please help me. I'm having a lot of trouble with schema files in .NET. I have produced a very simple example that uses "include" to include other schema files. It all...
12
by: Whoever | last post by:
Hi, I'm trying to return an XmlDocument or XmlNode converted from a typed dataset. public XmlNode whatever() { MyTypedDataSet ds = new MyTypedDataSet(); return new XmlDataDocument(ds); }
4
by: joewhitehair | last post by:
Using a schema, I created classes for my web service using the XSD.exe tool. With the classes I then wrote a web service function, but the WSDL that is generated has different minOccurs and...
0
by: billmiami2 | last post by:
I'm creating an ASP.NET web service with a number of web methods. The consumers of these web services are developers using Macromedia Flash which comes with its own interface for web services. In...
1
by: Ganesh Muthuvelu | last post by:
Hello, I have a simple schema as shown below. When I validate it, I get the error "Type 'http://www.w3.org/2001/XMLSchema:emptype' is not declared. An error occurred at , (6, 12)." ...
1
by: mflll | last post by:
How does one say in one schema that one wants an element defined in another schema. For example, I want to include in the Employee definition, an Address element defined in the schema...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.