473,395 Members | 1,996 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,395 software developers and data experts.

Validate Xml from Serialized Web Service Proxy Class throws on soap Array

Hi, im trying to validate objects before they are sent over the wire to a
webservice,
the schema embedded into WSDL is not sufficient so i took that schema and
extended it with additional restrictions,
after conversion from local domain class into remote domain class the remote
class (generated from WSDL) is serialized to XML and validated using the
schema, this throws "Undefined complexType
http://schemas.xmlsoap.org/soap/encoding/:Array is used as restriction of
complex type" (translated)
How do i add this schema or map the soap array to another type?

private void ValidateRemoteDomainObject(remote.webservice.entit y o)
{
MemoryStream ms = new MemoryStream();
XmlSerializer xs = new XmlSerializer(o.GetType());
xs.Serialize(ms, o);
ms.Position = 0;
ValidateXmlSchema(new StreamReader(ms), "Schema.xsd");
}
void ValidateXmlSchema(TextReader reader, string schemaUri)
{
XmlReaderSettings xrs = new XmlReaderSettings();
xrs.ValidationType = ValidationType.Schema;
xrs.ValidationFlags &=
~XmlSchemaValidationFlags.AllowXmlAttributes;
xrs.ValidationFlags |=
XmlSchemaValidationFlags.ReportValidationWarnings;
xrs.ValidationEventHandler += new
ValidationEventHandler(ValidationEventHandler);
XmlSchema schema = XmlSchema.Read(
XmlReader.Create(schemaUri), this.ValidationEventHandler);
xrs.Schemas.Add(schema);
XmlReader xr = XmlReader.Create(reader, xrs);
while(xr.Read()){
// do something with node
}
}
void ValidationEventHandler(object sender, ValidationEventArgs e)
{
throw new ApplicationException(
String.Format("{0}", new object[] {e.Message}),
e.Exception
);
}
Joris van Lier

Jun 27 '08 #1
1 2959
Joris van Lier wrote:
Hi, im trying to validate objects before they are sent over the wire to
a webservice,
the schema embedded into WSDL is not sufficient so i took that schema
and extended it with additional restrictions,
after conversion from local domain class into remote domain class the
remote class (generated from WSDL) is serialized to XML and validated
using the schema, this throws "Undefined complexType
http://schemas.xmlsoap.org/soap/encoding/:Array is used as restriction
of complex type" (translated)
You need a schema for the namespace
http://schemas.xmlsoap.org/soap/encoding/ that defines the Array type. I
am not sure whether the various soap specifications define a schema,
perhaps someone in microsoft.public.dotnet.framework.aspnet.webservic es
knows more.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '08 #2

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

Similar topics

7
by: John Grandy | last post by:
make a call to XML Web Service WebMethod ... returns object myArray with no error ... myArray contains objects of type StringKeyStringValue runtime error occurs on accessing properties of...
10
by: Alphonse Giambrone | last post by:
I am trying to develop a web service to accept a file uploaded via http post from a vba (Access) application. Thanks to helpful links in a vb newsgroup and my previous work with WinInet api I was...
0
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem...
1
by: JTrigger | last post by:
I need to call a .Net web service that takes an array or object as a parameter from a PERL client. I have been trying to use the PERL SOAP::Lite package to do this without success. I can call one...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
3
by: Mike Logan | last post by:
How do I validate messages? If my schema has a simpleType with facets like "minExclusive" and "maxLength" will the .Net framework validate the message before running the web service? This is what...
0
by: ben | last post by:
OK so there are a few things going on. I succesfully created a SOAP webreference in VS IDE which when built works fine under small amounts of load, however under heavy amounts of load we start to...
13
by: John Kotuby | last post by:
I am expecting the answer to be, "of course not" or " are you kidding?", but maybe (hopefully) I am wrong and somebody can point me to an ingenious example of how the impossible just takes a little...
5
by: ayaz.usman | last post by:
Hi, I've built a web services proxy server, in C# using wsdl.exe, by importing wsdl. Howeever, when I go to : http://localhost/sample.asmx?wsdl, they wsdl there does not match the wsdl I fed...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
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...
0
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,...

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.