Output webservice data/object to XML

Recently, I was working on a project as a web developer where I used webservies to get and update data between Siebel and .NET. The problem working on two systems, sometimes you don’t know where the problem is, in my case when I get the error I wasn’t sure it’s from my end which is .NET or the Siebel side, specially when outputting the webservice call I was getting few data back and some returned ‘Null’. I used soap client to do some troubleshooting but that didn’t help much because the data in soap looks okay, but when I use the same WSDL in .NET I get different results.

First I thought it might be something when I convert the WSDL to .cs but when I went through the file all seem okay. Then I thought to display the output to a XML file so that I can compare both soap and .NET outputs.

         QueryContact_Output outputQC = null;
             <strong>string path = "output.xml";</strong>
            <strong>System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(outputQC.GetType());</strong>
          <strong>  StreamWriter writer = new StreamWriter(path);</strong>

            //Get data
            Collection<object> wsList = new Collection<object>();
            outputQC = WebServices.Contact.PCAOQueryContact();
            x.Serialize(Console.Out, outputQC); // display the output in the debug window
           <strong> x.Serialize(writer, outputQC); </strong>// write the output to output.xml
            Console.WriteLine();
            Console.ReadLine();

This code helped me to find the root of the problem, it was the sequence that caused the issue. the data map order/sequence in Siebel and the auto generated WSDL didn’t match or not mapped correctly.