Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make http requests from COBOL

Tags:

cobol

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"
like image 922
Ionică Bizău Avatar asked Oct 14 '14 17:10

Ionică Bizău


People also ask

How to get information from web service through COBOL?

Currently, we are connecting getting information from web service through cobol by using "db2 xml" "SOAP HTTP NV". exec sql select db2xml.soaphttpnv (:internet protocol address,:webservice namespace,:soap xml schema structure) into :varchar-output from sysibm.sysdummy1 end-exec.

What is an HTTP message?

HTTP messages are how data is exchanged between a server and a client. In this, there are two types of messages where one is HTTP client request and the second is the response from the server. Messages in textual form and it is encoded in ASCII form, and span over multiple lines.

How does http communication work in Linux?

HTTP’s communication happens using this established TCP connection (see the bottom part that lists outs the protocols used for the resource transfer) The client sends the HTTP Request line to the server (Line 6) to which the server responds with the HTTP Status code & data as we saw earlier in the telnet output

What is httpurlconnection in Java?

More than twenty years after HttpURLConnection we had Black Panther in the cinemas and a new HTTP client added to Java 11: java.net.http.HttpClient. This has a much more logical API and can handle HTTP/2, and Websockets. It also has the option to make requests synchronously or asynchronously by using the CompletableFuture API.


1 Answers

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.

like image 176
Brian Tiffin Avatar answered Oct 23 '22 03:10

Brian Tiffin