a1jit Posted May 20, 2006 Posted May 20, 2006 Hi Guys, I have been finding for this answer for quite some time but fail. My question is that can we control that xml output from a web service? Let me explain I have a small method like this in my web service public decimal AddNumbers(decimal lnNumber1, decimal lnNumber2) { return lnNumber1 + lnNumber2; } After data is keyed in, i automatically get this format. <?xml version="1.0" ?> <decimal xmlns="http://tempuri.org/">32.12</decimal> So here, can i change the xml format in a web service? Maybe i want this format <?xml version="1.0" ?> <number1> 2 </number1> <number2> 3 </number2> <results> 5 </results> This is just a sample, i want to do something like this, but it seems web service doesnt allow me to do this. I hope someone can provide me with some useful links,suggesstions or codes on how to do this.. thank you very very much for any help Quote
Administrators PlausiblyDamp Posted May 24, 2006 Administrators Posted May 24, 2006 The easiest way would be to define a class that exposes the 3 fields you want returned and return a valid instance of this from the WebMethod. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.