6

How to make http requests from COBOL?

For example, how can I create GET, POST requests to http://example.com?


Relevant information about what I have on my machine:

$ cobc --version
cobc (OpenCOBOL) 1.1.0
Copyright (C) 2001-2009 Keisuke Nishida / Roger While
Built    Nov 02 2013 00:16:01
Packaged Feb 06 2009 10:30:55 CET

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
  • Which COBOL and OS are you using? – Bill Woodger Oct 14 '14 at 17:48
  • @BillWoodger See update. Seems you are cobol guru here... :-) – Ionică Bizău Oct 14 '14 at 17:53
  • OK, what I'm going to suggest is that you go to GnuCOBOL (the new name for Open COBOL) and ask there, as the question isn't really a good fit for this format. There's an active set of people who I'm sure will help you out. https://sourceforge.net/p/open-cobol/discussion/?source=navbar – Bill Woodger Oct 14 '14 at 17:56
  • @BillWoodger Well, I know the format is not very good for this website, but I really want to see some examples. I always liked to learn from examples.. – Ionică Bizău Oct 14 '14 at 17:58
  • You'll get them at the GnuCOBOL site. You can always make an Answer yourself here later, but all the discussion and passing of information is going to be trickier here, and only a couple of people working on GnuCOBOL attend here anyway. – Bill Woodger Oct 14 '14 at 18:01

1 Answers1

5

Steve Williams, as part of his work with tutorial level, but useful, COBOL sources, has posted some samples highlighting socket programming with GnuCOBOL.

Too long to list here, but the RESTClient sample is well worth reading, and learning from.

http://sourceforge.net/p/gnucobol/discussion/help/thread/762285b2/7ada/attachment/RESTclient.tar.gz

That's not the only way to go about http request/response handling in COBOL, but it's working code and a handy leg up.

See http://sourceforge.net/p/gnucobol/discussion/contrib/thread/2b474086 for the related conversation on SourceForge.

jazzpi
  • 1,399
  • 12
  • 18
Brian Tiffin
  • 3,978
  • 1
  • 24
  • 34