locked
How to get XML from Data service? RRS feed

  • Question

  • Hi All,

    is it possible to get  plain XML (not ATOM) from a data service? let say i want my data base table data serialized in XML format then what header i should provide?

    Thanks,
    Akhilesh Bhale
    Monday, December 14, 2009 6:55 AM

Answers

All replies

  • Hi,
    have a look at this link
    http://msdn.microsoft.com/en-us/library/bb472488.aspx
    Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
    Monday, December 14, 2009 7:14 AM
  • Hi,

    Are you talking about ADO.NET data service(Astoria)? I dont think there is POX support for that as of now. Check thsi thread

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/3fec1baa-d063-4580-b2de-a5707d87b45c
    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. http://thoughtorientedarchitecture.blogspot.com/
    • Proposed as answer by Haripraghash Monday, December 14, 2009 8:31 AM
    • Marked as answer by Mog Liang Friday, December 18, 2009 8:33 AM
    Monday, December 14, 2009 8:31 AM
  • Hi hari,
    your post r very helpfull.i lot of things learnt form your post.especially the link you provideing is very helpfull.i appreciate your work.keep post.
    Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
    Monday, December 14, 2009 8:36 AM
  • Hi hari,
    your post r very helpfull.i lot of things learnt form your post.especially the link you provideing is very helpfull.i appreciate your work.keep post.
    Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you

    Thanks :)

    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. http://thoughtorientedarchitecture.blogspot.com/
    Monday, December 14, 2009 4:55 PM
  • Yes it is here is the code i use i am doing the something

    I Code from here http://pstaev.blogspot.com/2008/04/passing-dataset-to-wcf-method.html


    Here is the client Code


    [ServiceContract]
        public interface IService
        {
            [OperationContract]
            bool PassDataSet(string sXMLSchema , string sXML);
        }


    Here is the Server code



       
    [ServiceContract()]
    	public interface IService
    	{
    		[OperationContract()]
    		bool PassDataSet(string sXMLSchema , string sXML);
    	}
    
    	public class Service : IService
    	{
    		bool IService.PassDataSet(string sXMLSchema , string sXML)
    		{
    			DataSet dsObjects = new DataSet();
    			//First read the schema of the DataSet
    			dsObjects.ReadXmlSchema(new MemoryStream(Encoding.Unicode.GetBytes(sXMLSchema)));
    			//Then read the data itself
    			dsObjects.ReadXml(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(sXML)));
    
    			//dsObjects.ReadXml(new MemoryStream(Encoding.Unicode.GetBytes(sXML)));
    			//Here do what ever you like with your DataSet
    			//Finally return a value to the client
    			SyncFromReaders(dsObjects);
    			//SyncFromReaders(dsObjects);
    			//	dsObjects.WriteXml(Path.Combine(SERManagerService.CCode.AppPath , "Writexml.xml"));
    			//	dsObjects.WriteXmlSchema(Path.Combine(SERManagerService.CCode.AppPath , "WriteXmlSchema.xslt"));
    
    			return true;
    		}
    
    That's all you need

    Hope this helps

    Please Mark as Answer if it helps.


    • Proposed as answer by Arash Khoddamy Monday, December 14, 2009 10:20 PM
    Monday, December 14, 2009 10:19 PM