anonym0use
anonym0use

Reputation: 3046

Best approach for passing XML to a webservice?

I have XML files in a directory that I wish to get over to a webservice on a server that will validate them and return a true/false as to whether they are valid in construct and values etc. Reason for server side processing is that the validation rules may change from time to time and need to adjust in one place as opposed to all client machines.

What would be the best mechanism to do this?

At the moment am wondering if passing the XMLDocument object from the client to the webservice as a parameter may be the way to go?

Am using .net 3 for this in C#

Upvotes: 2

Views: 1370

Answers (3)

Ciaran McNulty
Ciaran McNulty

Reputation: 18848

Depending on your validation rules, it might be more sensible to encapsulate them in something like an XML schema hosted on a public URL.

That way, clients can validate against the schema in one line of code, rather than having to connect to a web service.

Upvotes: 0

kokos
kokos

Reputation: 43604

Wouldn't a normal string be enough? It's overkill to serialize / deserialize an entire XDoc instance in my opinion. Of course, you can also zip the entire thing to reduce the size of the requests.

Upvotes: 0

Brian Genisio
Brian Genisio

Reputation: 48137

You might consider using something like a WCF service and streaming the xml up using the GZipStream. I am doing something similar to this and it is working pretty well.

Upvotes: 2

Related Questions