How to convert XML response returned by any Web Service into C# .NET Object

Leave a comment

November 13, 2012 by Ravi C Khambhati

Today I was working on SharePoint web service and if you guys have worked on SharePoint or any other Web Service you must be familiar with the XML response returned by service.

So I thought of doing De-serialize response to .NET object and started with creating classes. After some time I realized that its talking lot of time because each response is different. So I started doing googling and found the solution for the same.

So here are the steps

1. Call function of service and store the response in myFunction.xml file
2. Open Visual Studio command prompt
3. Type “xsd.exe myFunction.xml” and press enter
4. Step 3 will generate myFunction.xsd file(Schema file)
5. Type “xsd.exe myFunction.xsd /classes” and press enter
6. Step 5 will generate myFunction.cs file

So here we are ready with the classes for deserialization.

You can get more details about XSD.exe tool at below URL

I hope this will help while working with Web Service.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: