Groups | Blog | Home
all groups > dotnet xml > june 2004 >

dotnet xml : Receiving XML Documents


elguapois NO[at]SPAM yahoo.com
6/18/2004 7:04:31 AM
Hi,

I'm setting up a service that receives a XML document, validates the
document using a schema and then returns a simple result.

I wanted to ask what the best way is of doing this, that is sending
the xml document. So far I've come across 2 way's:

1. Create a webservice that accepts a XMLNode.
2. Use HttpWebRequest to send the document as a stream.

The service would be written in .NET but the clients can be written in
any programing language.

Thanks,
Eric Cherng
6/21/2004 10:17:04 AM
elguapo,

Since interoperability is important in your case (your #2 requirement), it
is not suggested that you send any data types that are specific to .NET. If
you plan on sending the XML Document as an XmlNode, make sure to have it
properly serialized as an XML element.

I have researched doing this and came up with 2 ways to pass an XML
Document:
1. By a string type element
2. By using the xsd:any

I have tested both solutions and they both work, however it's up to your
requirements on which you would like to do. I find that #1 is the easiest
solution to implement, but because the XML document is wrapped into a string
type, you won't be able to directly manipulate the XML (without having to
load it into another XmlDocument at least).

$2 solution is a little more difficult to implement (in Java at least, .NET
is pretty simple), but this does have the benefit of having your XML
document as part of the overall XML structure being passed by the web
service.

Hope this helps.

Eric



[quoted text, click to view]

John Jenkins
6/22/2004 9:49:21 PM
Hi elguapo,
I am currently implementing a similar project. We adopted the
approach of defining our types as xsd schema, and xml serialization. We used
the xsd tool to generate class definitions of the classes that we will be
sending as paramters and return types.

This was then integrated into the WSDL document. The proxy classes whent hey
reference the web service are provided with class definitions they can use.

In conjunction with this we payed close attention to the WS-Profile document
produced for Interoperability available at msdn.

Hope this helps

Lenin

[quoted text, click to view]

elguapois NO[at]SPAM yahoo.com
6/23/2004 3:35:51 AM
Hi Eric,

Yes interoperability is very important for me. I've considered
passing the xml as a string and then loading it into a XMLDocument og
validate-ing it with a schema but I always thought it was not a
recomended way of doing this.

Perhaps I will support more than method of receiving the document.
1. String
2. xmlnode

EG

[quoted text, click to view]
elguapois NO[at]SPAM yahoo.com
6/23/2004 3:45:02 AM
Hi Lenin,

This is very interesting.

I've already created a schema document that I was planning to
distribute to the users that are going to be using the webservice.
But it would be better to be able to insert the schema into the wsdl
file.

Do you know of any articles or examples that show how this is done?

Thanks,
EG



[quoted text, click to view]
AddThis Social Bookmark Button