views:

331

answers:

1
[WebMethod(EnableSession=true)]
[ScriptMethod(UseHttpGet=true, XmlSerializeString =  false)]
public string RaiseCallbackEvent(string eventArgument)

returning value started with <?xml. How can I get rid of it?

+2  A: 

I guess it's doing that because it's a SOAP Web Service and that is what is expected from a SOAP Web Service. If you want to return just plain text back to the client, I'd create an ashx to process the request manually.

Like this (this is the default Generic Handler scaffolding)

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Test : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        context.Response.Write("Hello World");
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
DavidGouge