473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Return text/html, JSON from Web Service

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

Nov 12 '06 #1
0 3009

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DartmanX | last post by:
I am attempting to create a set of chained selectors (one <select> uses AJAX to read values for the next <select>, and so on). My AJAX code works fine, and returns the text of the entire <select>...
13
by: trpost | last post by:
I am looking to make a small web app that will return the status of a website from the client browser. I tried this with AJAX and it worked great locally, but did not work for remote users...
4
by: VK | last post by:
Google Trends is an all new service (started May 10) and I have not responsability for proper query or data accuracy. Overall seems pretty close to what could be observed by the post history in...
9
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
9
by: martymix | last post by:
simple question: I have a simple <dt>test text</dt> I get the innerHTML of that dt, and I try and append some text to it like so: dt = document.getElementsByTagName('dt') var text =...
0
by: =?Utf-8?B?Sm9zZW1h?= | last post by:
Hi to all, I have .net ajax extensions, and i build a small web service with the attribute (to work with JSON). When i execute mi asmx i see in the result XML. I thought that if i used the...
0
by: =?Utf-8?B?Sm9zZW1h?= | last post by:
Hi to all, I have .net ajax extensions, and i build a small web service with the attribute (to work with JSON). When i execute mi asmx i see in the result XML. I thought that if i used the...
1
by: Sells, Fred | last post by:
please excuse slightly off-topic; cannot access turbogears mailing list at the moment. There was an excellent video by James Ward that showed using turbogears to return json data to adoble's flex...
7
by: SimonPalmer | last post by:
Hi, I am looking for a way to convert a List of floating point numbers to and from text. I am embedding it in an XML document and am looking for a neat way to serialise and de-serialise a list...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.