473,803 Members | 3,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WSDL Schema validation

How does .Net validates a soap request?

I have a WSDL that goes something like

<s:element name="CheckInSt atus">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="abcID" type="s:string"
/>
<s:element minOccurs="1" maxOccurs="1" name="myStatus" type="s:int"
/>
</s:sequence>
</s:complexType>
</s:element>

But when I pass a soap request below, no soap fault was returned.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<CheckInStatu s xmlns="http://tempuri.org/">
<abcID>abc123 </abcID>
</CheckInStatus>
</soap:Body>
</soap:Envelope>

Passing a <myStatus /> or <myStatus xsi:nil="true"> would return a soap
fault.

I thought .Net should return a soap fault since the required element is
not passed, however it does not.

I validate the required field when the WS is invoked but I'm wondering
why that soap request was even permitted?
Thanks

Nov 23 '05 #1
2 6713
be***********@g mail.com
How does .Net validates a soap request?
It doesn't do it for you....
I thought .Net should return a soap fault since the required element
is not passed, however it does not.

I validate the required field when the WS is invoked but I'm wondering
why that soap request was even permitted?


Because they didn't build that into the ASMX plumbing. The main reason for
this is that they expect you to be using the XmlSerializer which would error
on deserializing the incoming message if required data was missing or malformed.

It would have been nice if those of use working with XmlElement could have
had a property like ValidateRequest =true on WebMethodAttrib ute, but they've
left it up to you to do in this lower level scenario. So you need to wrap
your XmlElement with an XmlNodeReader and a ValidatingReade r and do it yourself.
You can then throw your own soap fault to indicate the instance document
is invalid.

HTH,
Dre

Nov 23 '05 #2
The key issue here is you are trying to pass a null value to an integer -
which in .NET is a value type that cannot ever have a null value. When you
pass an empty element, you are supplying a null - and on serialization to
the integer, a value expeption is thrown. When you explicitely pass
"xs:nill="true" ", you are doing the same thing. This is just not allowed.

The key here is to recognize the difference between optional (no value
passed) and null value. The serializer does support optional values via
the "Specified" flag. If you have a property named "foo" and you choose to
make it optional, you just created a public boolean property named
fooSpecified in the implementation class along with your foo property.
When you serialize into that class, if no value was passed on the wire, the
specified flag will have a value of false. If a value was passed, the
specified flag will have a value of true. The same holds in reverse - if
you serialize a type that has an optional value out, and you don't set the
specified flag value to true beforehand, the field that the specified flag
is married to will not be serialized.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
From: be***********@g mail.com
Newsgroups: microsoft.publi c.dotnet.framew ork.webservices
Subject: WSDL Schema validation
Date: 10 Dec 2004 15:09:49 -0800
Organization: http://groups.google.com
Lines: 40
Message-ID: <11************ **********@f14g 2000cwb.googleg roups.com>
NNTP-Posting-Host: 64.139.57.2
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google. com 1102720195 31184 127.0.0.1 (10 Dec 2004
23:09:55 GMT)
X-Complaints-To: gr**********@go ogle.com
NNTP-Posting-Date: Fri, 10 Dec 2004 23:09:55 +0000 (UTC)
User-Agent: G2/0.2
Complaints-To: gr**********@go ogle.com
Injection-Info: f14g2000cwb.goo glegroups.com; posting-host=64.139.57. 2;
posting-account=WAq9Kw0 AAAAeVc7OS2ltqe SGxRIn4kZ4
Path:
cpmsftngxa10.ph x.gbl!TK2MSFTNG XA01.phx.gbl!TK 2MSFTNGP08.phx. gbl!newsfeed00. s
ul.t-online.de!t-online.de!news. glorb.com!postn ews.google.com! f14g2000cwb.go
oglegroups.com! not-for-mail
Xref: cpmsftngxa10.ph x.gbl
microsoft.publi c.dotnet.framew ork.webservices :8020
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.webservices

How does .Net validates a soap request?

I have a WSDL that goes something like

<s:element name="CheckInSt atus">
<s:complexTyp e>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="abcID" type="s:string"
/>
<s:element minOccurs="1" maxOccurs="1" name="myStatus" type="s:int"
/>
</s:sequence>
</s:complexType>
</s:element>

But when I pass a soap request below, no soap fault was returned.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<CheckInStatu s xmlns="http://tempuri.org/">
<abcID>abc123 </abcID>
</CheckInStatus>
</soap:Body>
</soap:Envelope>

Passing a <myStatus /> or <myStatus xsi:nil="true"> would return a soap
fault.

I thought .Net should return a soap fault since the required element is
not passed, however it does not.

I validate the required field when the WS is invoked but I'm wondering
why that soap request was even permitted?
Thanks
Nov 23 '05 #3

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

Similar topics

2
9453
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data. Actually, second time I do a deserialization, the data from XML is fed directly to an object. The problem I am experiencing is the error at the second reading attempt, and error description implies that reader is winded to the end of the XML and...
0
1139
by: Ricky Li | last post by:
I went through some article to see how I can add schema validation for my templated control by adding an XSD file into the VS.NET schema folder. Everything works fine for a schema like this: <mycontrolns:mycontrol id="test" runat="server"> <mytemplate>test</mytemplate> </mycontrolns> and I was able to specify the XSD to validate "mytemplate" as the only valid child type for "mycontrol". Here's a challenge: Is there anyway
1
6411
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i reference this wsdl in .NET it seems to do it fine, yet there are no objects to reference except RateQuoteBeanService. In the WSDL it looks like there should be getRateQuote, and QUOTEREQUEST, etc.
3
4739
by: kevin | last post by:
Is that even possible? I am creating a web service in .NET to expose some already created .NET programs to other groups. One group is writing the client in PERL, and thus wishes the wsdl schema to not be sequenced. (PERL hashes do not retain order information) First, the w3 specs don't mention the sequence in any detail - its just there in the examples, which makes me wonder if removing the sequence tag is even supportable. Second,...
0
1096
by: Jimmy L | last post by:
to validate a WSDL is a valid one do i just need 1) WSDL schema - http://schemas.xmlsoap.org/wsdl/ 2) WSDL document input these 2 document into a XML editor just like validate XML doc with DTD?
5
3685
by: wolf_y | last post by:
My question is simply: under what conditions will empty tags of the form <MOM></MOM> pass schema validation? Of course, the mirror question is: under what conditions will empty tags fail validation? The former seems to be an easier question to answer. XML files will arrive from around the world and must be schema validated before further processing and loading into a database, so I'm trying to foresee the various layouts that might be...
2
4124
by: Grzegorz Smith | last post by:
Hi all. I have problem with ZSI and WSDL schema.I generate from WSDL by wsdl2py client method for webservice. I made soap call and something goes wrong. Doeas anyone know hot to create some server code by ZSI from WSDL?? I just suspectes that my return data from webservice is in incorrect envelope -so maybe wsdl2py can help mi generate correct server method, or just generate correct structure that webservice should return. Thanks for any...
2
2741
by: mailajayck | last post by:
I want to know what all checks does a WSDL file go through to be finally marked by any tool as a VALID WSDL file?? I am actually thinking of ways to get my WSDL file to be shown as valid by XMLSPY There should be some way and I am not able to find that way DO help me.
0
1701
by: kenkejas | last post by:
Hello public, Got a problem. While generating proxy classes getting warnings: Schema Validation Errors: Error compiling schema. WSDL descriptor is public: http://eptstest-integra.sodra.lt/orabpel/epts/surastiAsmenis/surastiAsmenis?wsdl Have tried with Altova XML spy and SoapUI 3.5. Descriptors load well except WseWsdl3.exe tool. Using such proxy class is ok until you get fault response, then everything is translated to "business...
0
9700
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
10546
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...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
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
7603
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
6841
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
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.