Hi all,
Is there any decent way to stop a Web Service from serializing it's
return value to XML? Here's an example of what I mean.
I have a WebMethod that returns a string. The output is actually:
<?xml version="1.0" encoding="utf-8"?>
<string
xmlns="http://somedomain/services/myservice.asmx">{"Result":"-1","Pnref":null}</string>
What I really would like though is just the part:
{"Result":"-1","Pnref":null}
With a content type text/html
I really want to avoid doing any XML unpacking on the client (Yes, I
know they are called XML Web Services).
My thoughts so far have been only to set the return type of the
WebMethod to void, hijack the Context.Response object, set the
ContentType = "text/html" and use Response.Write to output the data I
want.
This works, but it is way to hacked together to be anywhere near the
correct way of doing this. Can anyone help me out? Also, if there are
other reasons I really shouldn't be doing this, please let me know.
Thanks in advance,
Zack