locked
deserializing an XML response from a web server RRS feed

  • Question

  • Hi,

    'm working on a windows 8 app which pulls data from a web service. The response from the server is an xml stream. I need to assign each values that I get from the response. IXmlSerialization doesn't seem to work in Win 8 apps... need help urgently

    this is a C# app 

    Wednesday, October 24, 2012 10:33 AM

Answers

All replies

  • You should create a object that represent the response and use the

    XmlSerializer

    ou

    DataContractSerializer

    See this:

    Object serialization

    XLinq, XmlReader, and XmlWriter data message query sample


    Sara Silva
    My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    (If my reply answers your question, please propose it as an answer because it will help other users)


    • Edited by saramgsilva Wednesday, October 24, 2012 11:24 AM
    Wednesday, October 24, 2012 11:23 AM
  • ServiceReference1.DynamicPoolCommunicationSoapClient client = new ServiceReference1.DynamicPoolCommunicationSoapClient();
                ServiceReference1.SendToHostResponse res = await client.SendToHostAsync(requestXML, processUniqueId, userId, password);

    This is how I connect to the web service. I get the response from the web service to the "res" inside an SOAP envelope. 'm bit confused in implementing your solution?? can you help me more??
    Wednesday, October 24, 2012 12:14 PM
  • With your question i though in REST and JSOn. And the sample i said is related with serialization and deserialization objects.

    These class and methods are yours, can share more things?

    Related topics:

    Consuming WCF SOAP Service in Windows 8 Metro Application

    Use SOAP API in Metro style app

    Metro Web Services Support


    Sara Silva
    My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    (If my reply answers your question, please propose it as an answer because it will help other users)


    • Edited by saramgsilva Wednesday, October 24, 2012 1:18 PM
    • Marked as answer by Charith S Wednesday, October 31, 2012 11:10 AM
    Wednesday, October 24, 2012 1:18 PM
  • async private void usingEticket(string i)
            {
                string eticket = i;
                string processUniqueId = "XXXX";
                string userId = "XXX";
                string password = "XXX";
                string scripXML = @"<XMLString><Sample string></XMLString>"; // it is a sample script xml for identification . 
    
                string requestXML = GenerateRequestXML("XXX", "XX", "XX", "XX", scripXML); // Request xml 
    // I have another class for this.
    
                ServiceReference1.DynamicPoolCommunicationSoapClient client = new ServiceReference1.DynamicPoolCommunicationSoapClient();
                ServiceReference1.SendToHostResponse res = await client.SendToHostAsync(requestXML, processUniqueId, userId, password);
    
                string response = res.Body.SendToHostResult.ToString();
            }
    
    This is my class where I call the web service. I just want to interpret the SOAP envelope that 'm getting as the response. I was thinking to convert this to an string and work on some method. 'm stuck right now....
    Wednesday, October 24, 2012 1:31 PM
  • Hey all, thanks for the support. There was an error with the incoming XML string. That is why it didn't desterilize :)
    • Proposed as answer by saramgsilva Wednesday, October 31, 2012 11:10 AM
    Wednesday, October 31, 2012 11:09 AM