Web Services interface

COBOL can provide or request Web Services, using architectures based on SOAP (Simple Object Access Protocol) or REST (REpresentational State Transfer). Data in the interface to such services is typically represented in JSON (JavaScript Object Notation) or XML (eXtensible Markup Language). The following information describes COBOL and other facilities that can be used to generate and consume JSON and XML.

Processing JSON input

Start of changeYou can process JSON text input in a COBOL program by using the JSON PARSE statement. The statement identifies the source data item containing the JSON text, and the receiving data item that is populated by the parser. End of change

Start of changeIn addition, the z/OS® Client Web Enablement Toolkit enables applications to participate in the client/server space by providing a built-in z/OS JSON parser (Start of changeprovided with z/OS V2.2, or z/OS V2.1 with the PTF for APAR OA46575 installedEnd of change) to consume JSON text from any source. Be aware that this parser supports JSON texts in EBCDIC codepage 1047 only, thus JSON text received by the application in another encoding format must first be converted to EBCDIC 1047 before it can be input into the parser. Start of changeFor details, see the description of the z/OS JSON parser in z/OS MVS™ Programming: Callable Services for High-Level Languages. End of changeEnd of change