From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Peter.Gregory@cis.strath.ac.uk
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Basic Ocamlnet Question
Date: Tue, 14 Aug 2007 19:46:41 +0200 [thread overview]
Message-ID: <1187113601.13041.31.camel@localhost.localdomain> (raw)
In-Reply-To: <1628.84.13.116.50.1187112599.squirrel@webmail.cis.strath.ac.uk>
Am Dienstag, den 14.08.2007, 18:29 +0100 schrieb
Peter.Gregory@cis.strath.ac.uk:
> Hi,
>
> I've just started messing about with ocamlnet, and have instantly run
> into a problem. I was trying to write some code that interfaced with the
> backpack API (http://developer.37signals.com/backpack/). I tried
> tweaking one of the examples just to get a page listing, and wrote the
> following:
>
>
> open Http_client.Convenience;;
The "convenience module" is only for simple requests. Do it as follows:
> let get_and_print url =
> let s = http_post url [("","<request> <token>mytoken</token>
> </request>")] in
> print_string s;
> flush stdout
> ;;
let get_and_print url =
let msg = new post_raw url "<request> <token>mytoken</token> </request>" in
(msg # request_header `Base) # update_field
"content-type" "application/xml";
let p = new pipeline in
p # add msg;
p # run();
print_string msg#response_body#value
;;
Gerd
>
> let () = get_and_print "http://pg.backpackit.com/ws/pages/all";;
>
>
> However, this doesn't work, as the header for the request should be
> "Content-Type: application/xml". How do I set the header for my request
> in ocamlnet?
>
> Thanks,
> Peter.
>
>
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
--
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de
Phone: +49-6151-153855 Fax: +49-6151-997714
------------------------------------------------------------
next prev parent reply other threads:[~2007-08-14 17:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-14 17:29 Peter.Gregory
2007-08-14 17:39 ` [Caml-list] " Oliver Bandel
2007-08-14 17:46 ` Gerd Stolpmann [this message]
2007-08-14 19:37 ` Peter.Gregory
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1187113601.13041.31.camel@localhost.localdomain \
--to=info@gerd-stolpmann.de \
--cc=Peter.Gregory@cis.strath.ac.uk \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox