How can z/OS call a web service? [closed]

2019-07-18 17:12发布

I have a COBOL program that needs to get data from a web service. Without using CICS what are my best options? I thought that a C program could read the web service and save it to a file, then the COBOL could read that file. Can COBOL call a web service? The data is about 300mb in size.

5条回答
倾城 Initia
2楼-- · 2019-07-18 18:02

Maybe have a look at this article. It suggests creating a C/C++ wrapper interace to the web service. Although this article is for iSeries, you might be able to implement something very similar under zSeries using BPXBATCH

Basically, they suggest using a C wrapper between your COBOL code and the C++ code that interfaces with the web service. This solution allows COBOL to call a C function in a relatively straight forward way. The C function mimics C++ behavior by implementing the call to the Web service using a C++ proxy.

查看更多
霸刀☆藐视天下
3楼-- · 2019-07-18 18:02

If you can use Java at your site calling Java from a cobol program to access the web service may be an option. Assuming your using Enterprise cobol check out section 6.44 of Java Stand-alone Applications on z/OS Volume II

查看更多
乱世女痞
4楼-- · 2019-07-18 18:03

It is possible to call java from COBOL programs on z/os.
We have done it in our company.

  1. You have to specify that it is RECURSIVE
  2. You have to import the classes

Class HelloJ is
"com.ibm.zos.batch.container.test.HelloJ"
Class JavaException is "java.lang.Exception"
Class BCDTranHelper is
"com.ibm.batch.spi.UserControlledTransactionHelper".

  1. The you have to include JNI. LINKAGE SECTION. COPY JNI

***Then you can invoke java from COBOL in your PROCEDURE DIVISION with:
Invoke HelloJ "sayHello"

Also look at Java Exception Check * to see how to handle the exceptions.

This is very useful if you want to invoke a web service from your COBOL program on z/os.

see this link for more details.

http://pic.dhe.ibm.com/infocenter/zos/v1r13/index.jsp?topic=%2Fcom.ibm.zos.r13.iean500%2Fcodeexm.htm

查看更多
够拽才男人
5楼-- · 2019-07-18 18:10

Use the IBM TCP/IP 'EZASOKET' modules

I work for a company with a z/OS system running mostly COBOL, batch (JCL) and CICS. To call webservices, we wrote a module to implement HTTP 1.0 using TCP/IP. With modules

  • EZASOKET
    • GETHOSTBYNAME
    • SOCKET
    • CONNECT
    • WRITE
    • FCNTL
    • READ
    • CLOSE
    • SELECTEX

supplementary modules:

  • EZACIC04 translates EBCDIC to ASCII
  • EZACIC05 translates ASCII to EBCDIC
  • EZACIC06 convert character to bit mask
  • EZACIC08 decode IP address

Since I wrote this for my company, I can't just give out the code. But for reference, it took me 3 days to write the module, and that was with an example to start with that did a partial hacky way of doing it.

You'll need to read through IBM's references to know how to use the EZA modules.

查看更多
Explosion°爆炸
6楼-- · 2019-07-18 18:17

Use the z/OS client web enablement toolkit if you are at z/OS 2.1 or above.

Look at the sample in SYS1.SAMPLIB(HWTHXCB1) for Cobol.

If your Cobol is running under DB2 DSN command, you can also use SOAPHTTP* scalar functions.

查看更多
登录 后发表回答