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

Eduardo Segura segura.eduardo at gmail.com
Tue Jan 26 02:09:58 EST 2010


Hi Atsushi,

Thanks for the quick answer. I'm attaching a solution with a simple
service. The method I'm trying to call is the one receiving two
composite types.

Could you quickly verify if this works for you? Sorry I didn't file a
bug or gave more details earlier today, but I thought it was just me
cutting my teeth with mono.

Bjorg, you might actually be on the right track. I did try to feed the
service with some well-formed xml, and the exceptions changed
immediately. Maybe it's something related to the selection of the mime
type? I'm using 'Poster' (firefox add-on) to hand-craft my post
requests to the service. The mime type I'm using is application/json,
as defined in RFC 4627

Thanks for the help,
Best,
ed-

On Mon, Jan 25, 2010 at 6:06 PM, Atsushi Eno
<atsushieno at veritas-vos-liberabit.com> wrote:
> Hello,
>
> Our WebHttpBinding does support json-based requests and responses.
> There is a lot of possibilities why you don't get json response instead
> of xml, and I can't give you an answer with almost no information.
> If you file a bug with the steps to configure and run the service, I'll
> have a look.
>
> Atsushi Eno
>
>
> On 2010/01/26 9:47, 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-
>
>



-- 
E. -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyLittleService.zip
Type: application/zip
Size: 9229 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100125/a1459b60/attachment.zip 


More information about the Mono-devel-list mailing list