1 Replies - 15939 Views - Last Post: 20 December 2007 - 04:59 AM Rate Topic: -----

#1 anuruddha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 22-October 07

How customize the return xml by Web Service

Posted 20 December 2007 - 01:28 AM

I written web service using asp.net.
it works fine. by running the web service i can put value and get the result.
it shows the result in xml format.
for eg:-
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://www.tempfunction.veritemp.com.au/webservices/">admin</string>

this xml is generated by web service

but i have a requirement that instead of this xml, generate a xml as we want
including data.
fro eg:-
<?xml version="1.0" encoding="utf-8" ?>
<string>admin</string>
like this.(this is for only demostration)

it means generate an xml according our requirement.

is this possible?
if it is can u give me overview how this is done/ good web site related this topic.

thank u.

This post has been edited by anuruddha: 20 December 2007 - 01:30 AM


Is This A Good Question/Topic? 0
  • +

Replies To: How customize the return xml by Web Service

#2 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5795
  • View blog
  • Posts: 12,628
  • Joined: 16-October 07

Re: How customize the return xml by Web Service

Posted 20 December 2007 - 04:59 AM

Just pass back an XmlDocument and you're done.

e.g.
	 [WebMethod]
	 public XmlDocument HelloWorldXml() {
		 XmlDocument xmlDoc = new XmlDocument();
		 xmlDoc.LoadXml("<string>admin</string>");
		 return xmlDoc;
	 }



The caveat here is that the web service client will have to know how to parse the response, since the WSDL just says "xml". Still, this will get the exact respose you aske for.

Hope this helps.
Was This Post Helpful? 1

Page 1 of 1