WCF/WF - Create WCF service to accept XML and response back XML

Asked By kushal dalal on 02-Aug-10 11:45 AM
I would like to create WCF service with method that accepts XML as parameter and then parse that xml and response back xml.
The xml conforms to XSD and i would like to know the best practice for it.
Thanks

Personally, I wouldn't do this but - Robbe Morris replied to kushal dalal on 02-Aug-10 12:39 PM

you could just use a string parameter and validate the string as valid xml in the service.  Not sure what else you are expecting of the service.
kushal dalal replied to Robbe Morris on 02-Aug-10 12:53 PM
Robbe,

Thanks for the reply. I am creating wcf service for two way xml reply/request. Client will request with xml, at service accept that xml, parse that xml, authenticate and reply with xml reponse.
What will be the best practice to do this?

As you have mentioned can i take xml as a string, then validate the string as xml and then do parsing and authentication or is there any other way to do this efficiently.

Thanks

Nope, not really - Robbe Morris replied to kushal dalal on 02-Aug-10 12:55 PM

You'll always have to validate it versus just assume the incoming request is always proper and coming only from your desired clients.  If your client is expecting an xml string back, then that is what you have to return.
kushal dalal replied to Robbe Morris on 02-Aug-10 01:03 PM
So you mean to say that every request to the service, i have to validate first,if it is from authenticated source then do the other operations on that. At the time of replying back convert the xml in to string and send it back.


Of course - Robbe Morris replied to kushal dalal on 02-Aug-10 01:12 PM
Each request of your service happens in isolation from other requests.  Why wouldn't you need to validate each request?
kushal dalal replied to Robbe Morris on 02-Aug-10 01:14 PM
I have to check it that it is coming from the client, i have to check that the information in xml request is valid and have valid username and password. If all the criteria is true then reply them back with string(xml converted to string).
b k replied to kushal dalal on 03-Mar-11 03:43 AM
What if the xml size is big?how to pass it..
b k replied to Robbe Morris on 03-Mar-11 03:44 AM
What if the xml size is big?how to pass it..