return xml with kayak

74 views
Skip to first unread message

ChampAlias

unread,
Feb 7, 2011, 8:18:14 AM2/7/11
to Kayak HTTP
Hi Benjamin, sorry for my English, I'm french.

I would like use kayak for return a xml. what is the best method for
make this ?

I have a string xml (get with with my object serialized) and I have
try change text/plain to text/xml but it's not works correctly.

thanks for help :-)

StoredPluginSettings Settings = new StoredPluginSettings { MenuMode =
"firstest" };

CustomXmlSerializer CustomSerializer = new
CustomXmlSerializer();
string XMLToDisplay =
CustomSerializer.SerializeObject(Settings);

respond(
"200 OK",
new Dictionary<string, IList<string>>()
{
{ "Content-Type", new string[]
{ "text/xml" } }
},
new object[]
{ Encoding.ASCII.GetBytes(XMLToDisplay) }
);

ChampAlias

unread,
Feb 7, 2011, 9:34:10 AM2/7/11
to Kayak HTTP
seems work if I use : Encoding.UTF8.GetBytes instead ASCII

Benjamin van der Veen

unread,
Feb 7, 2011, 3:27:16 PM2/7/11
to kayak...@googlegroups.com

Weird, the encoding used shouldn't actually make a difference. Your code looks correct. What are you using to make the request? Browser? Curl? Could be related to how it handles MIME types and character encodings.

ChampAlias

unread,
Feb 8, 2011, 5:29:54 AM2/8/11
to Kayak HTTP
I have try the request with browser and curl, I have change the value
of my serializer and now it's works correclty with ASCI values.

thanks


On 7 fév, 21:27, Benjamin van der Veen <b...@bvanderveen.com> wrote:
Reply all
Reply to author
Forward
0 new messages