[Mono-dev] POSTing objects in JSON format...

Steve Bjorg steveb at mindtouch.com
Mon Jan 25 19:58:08 EST 2010


I'm going to go out on the limb here and guess that under Mono it assumes the input to be always XML and doesn't look at the MIME type.

The "error on line 1, position 1" in XmlTextReader seems to be a dead giveaway for that. :)

- Steve

--------------
Steve G. Bjorg
http://mindtouch.com
http://twitter.com/bjorg
irc.freenode.net #mindtouch

On Jan 25, 2010, at 4:47 PM, ed.segura wrote:

> 
> Hi,
> 
> I'm wondering why this format doesn't work for mono, when it does for
> windows?
> 
> I'm trying to send a simple post request to the service, which contains the
> following:
> 
> {"composite":{"BoolValue":true,"StringValue":"aaa"},"composite2":{"BoolValue":true,"StringValue":"bbb"}}
> 
> This works fine in VS2008, but I keep getting an exception when I try to
> POST that data using mono:
> 
> Exit HttpContextAcquired:
> http://127.0.0.1:8080/Service1.svc/PostDataUsingTwoCompositeTypes
> Exit AspNetReplyChannel.WaitForRequest
> AspNetReplyChannel caught an error: System.Xml.XmlException: Text node
> cannot appear in this state.  Line 1, position 1.
>  at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00199] in
> /usr/src/packages/BUILD/mono-2.6.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1699 
>  at Mono.Xml2.XmlTextReader.ReadContent () [0x0015c] in
> /usr/src/packages/BUILD/mono-2.6.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1345 
>  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
> /usr/src/packages/BUILD/mono-2.6.1/mcs/class/System.XML/System.Xml/XmlTextReader.cs:619 
>  at System.Xml.XmlTextReader.Read () [0x0006b] in
> /usr/src/packages/BUILD/mono-2.6.1/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:564 
> ...
> 
> Am I missing something? I tried with several variations of the syntax, but
> nothing seems to work. I also looked in the forums for json serialization
> issues on 'post', but no luck.
> 
> Any help will be highly appreciated...
> ed-
> -- 
> View this message in context: http://old.nabble.com/POSTing-objects-in-JSON-format...-tp27316282p27316282.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list