views:

101

answers:

1

I'm using PandaStream, which sends a REST notification as YAML to our ASP.NET app. The web service I have chokes and returns 500 because it attempts to parse the content as XML. How can I stop this parsing? How do I get the content as just a big string so I can parse it myself?

[WebMethod]
//HOWTO? suppress XML parsing
public void UpdateStatus()
{
    // HOWTO? get content as string
    // parse string as YAML
    // ...
}

UPDATE: OK, if I use a regular .aspx page, how do I get the raw POST content as a string?

UPDATE 2: I can get the text:

Stream s = Request.InputStream;
byte[] buffer = new byte[s.Length];
s.Read(buffer, 0, (int)s.Length);
String content = bytesToString(buffer);

...but it gets screwed up. The opening lines of the yaml are:

--- 
:video: 
  :thumbnail: bac01bf0-503a-012b-1406-123138002145.flv_thumb.jpg
  :duration: 15900

...and so on, but in my string this becomes:

video=---%20%0a%3avideo%3a%20%0a%20%20%3athumbnail%3a%20bac01bf0-503a-012b-1406-123138002145.flv_thumb.jpg%0a%20%20%3aduration%3a%2015900

It seems ASP is "parameterizing" the POST body when I just want the raw stuff. Is this something to do with the mime type?

A: 

ASMX Web Services can only process SOAP on input. If you need to read some other format, then you need to not be using an ASMX web service.

Just use a normal page, or an HttpHandler, and do your own parsing.

John Saunders
Hah, using a normal page just didn't occur to me. Thanks.
Jegschemesch