Presuming that by "Java" you mean "Java not running on the mainframe," there are multiple ways to do this.
- CICS Web Services (SOAP)
- CICS Web Support (REST/POX)
- MQSeries with a triggered queue
"Best" is in the eye of the beholder, it depends on what you want. None of these are new, the capability has been available for several years.
For option 1, the CICS Web Services Assistant will generate WSDL from COBOL existing language structures. If you decide you don't like what it generates you can write your own WSDL and generate COBOL language structures from that. The Java program would use your favorite SOAP (or MQ) infrastructure to communicate with the CICS/COBOL program.
For option 2, your CICS/COBOL program would have to be coded to be "web aware." The CICS/COBOL program would have to use the WEB EXTRACT, WEB RECEIVE, and WEB SEND APIs to communicate with the Java program. The Java program would use HTTP(S) GET/POST processing to send/receive messages to the CICS/COBOL program.
For option 3, your CICS/COBOL program would have to be coded to use MQGET and MQPUT to receive and send messages to the Java program. You want to have the queue defined with a backout queue name and a backout threshold, and check the latter against the backout count value. If the threshold is greater than the count, you want to move the message to the backout queue without attempting to process it in the CICS/COBOL program (it's a poison message). The java program would use JMS or whatever your favorite messaging wrapper package is to communicate with the CICS/COBOL program.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…