Home > .NET Framework > Guidance on large XML documents

Guidance on large XML documents

I was looking on the web for precise guidance for sending large XML documents in a Web Service.

I was looking for information like,

What should be data type of the document (a parameter to the web service) should it be

  1. a string
  2. a schema based type
  3. an attachment

How large is large?

When should you go for attachements?

Is it possible to do MTOM in ASP.NET 1.1?

Performance benchmarks if any?

I would say I was disappointed. No concrete information from the .NET world. Things that were close, but not a perfect solution were

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wse3.0/html/4344d43e-ceb4-43a9-8f8c-6a3f89f786bd.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wse3.0/html/b4b19453-e4e4-4056-906d-72504ed8c0df.asp

http://www-128.ibm.com/developerworks/xml/library/ws-complexml.html

Prefer Primitive Types for Web Services Parameters

There are two broad categories of parameter types that you can pass to Web services:

  • Strongly typed. These include .NET types such as double and int, and custom objects such as Employee, Person, and so on. The advantage of using strongly typed parameters is that .NET automatically generates the schema for these types and validates the incoming values for you. Clients use the schema to construct appropriately formatted XML messages before sending them.
  • Loosely typed. These parameters use the string type. Note that you should not pass XML documents as string parameters because the entire string then needs to be XML encoded. For example, < and > needs to be converted to &lt and &gt and so on. Instead, you should use either an XmlElement parameter or implement IXmlSerializable. The latter is the most efficient and works well for large data sizes, regardless of which encoding style you use, you should prefer simple primitive types like int, double, and string for Web services parameters. Use of primitive types leads to reduced serialization and automatic and efficient validation by the .NET Framework.

From http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenetchapt10.asp is ok but still not good enough.

I was looking for this kind of information, https://bpcatalog.dev.java.net/nonav/soa/docoriented/frames.html. Looks like Java world is more mature. I thought .NET is good with respect to web services. Anyways most of the design stuff applies to .NET too.

And then I ran into this article, http://www.topxml.com/XmlDocument/re-30780_High-Performance-Web-Services–Avoid-XmlNode-Use-IXmlSerializable.aspx. Ideally this should have been from Microsoft Patterns and Practices.

Categories: .NET Framework
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment