开发者

How to return xml from .net webservice

开发者 https://www.devze.com 2022-12-30 23:09 出处:网络
I am reading data and filling a data set and want to return xml, in a .net web service. so far I am trying to use

I am reading data and filling a data set and want to return xml, in a .net web service. so far I am trying to use

return my开发者_运维知识库dataset.getxml();

but it is not helping as my method return type is "DataSet"

so is there any way I can get a well formatted xml.

Thanks


Your web service can serialize its output to whatever you want it to.

All you need to do is to return the dataset, and what it will be serialized to depends on what is requested by the client.

Depending on how you're invoking the service, you should be able to set a 'dataType' parameter.


(NOTE: I'm assuming you want to return a raw xml string from your method as the body payload of the webservice)

You could declare your return type of the webservice as a string then pass back the text representation of the xml you want

0

精彩评论

暂无评论...
验证码 换一张
取 消