473,789 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1378
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 IXmlSerializabl e.
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 "XmlDocumen t-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
3867
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 header that must appear on all XML messages in our shop. We have several processes that just need to process the generic header to determine how to route the message and which service needs to process the message. So we have an XML structure that at...
0
1072
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 version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
0
2430
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 service. I have run the schema through XML Spy and validated it with no errors, but when attempting to generate a dataset, I keeping getting a 'undefined data type' error. The schema is quite large so I don't know if that is causing the problem or...
4
2293
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 works with SPY, but when I pick "Validate Schema" from the .NET 2003 menu, it fails with message: "Type XType is not declared." As I hinted at in my subject line, I suspect that it has to do with including another schema multiple times.
12
5316
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
2510
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 maxOccurs values for my elements. I can seem to figure out why this has changed or how to correct it. I can't find any way to manually modify the classes for minOccurs or maxOccurs either. It can happen whether I explicitly set the minOccurs/maxOccurs...
0
1198
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 order that these developers can take full advantage of the web services, it appears that I need to return output data types in my service description (i.e., before the method is called and the dataset returned), not just input data types. Note...
1
1445
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)." *************** <?xml version="1.0" encoding="utf-16"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="Employee">
1
1580
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 http://test.org.Address Here is the schema defining the Employee: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="http://test.org/emp" xmlns="http://test.org/emp"
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6761
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.