This document gives a functional overview of the Natural statements for internet and XML access, specifies the general prerequisites for using these statements in a mainframe environment, informs about restrictions that apply and contains a list of further references. To take full advantage of these statements, a thorough knowledge of the underlying communication standards is required.
The following topics are covered:
The following Natural statements are available for access to the internet and to XML documents:
This statement enables you to use the Hypertext Transfer Protocol (HTTP) and the Hypertext Transfer Protocol Secure (HTTPS) in order to access documents on the web with a given Uniform Resource Identifier (URI) or Uniform Resource Locator (URL), that is, the internet or intranet address of a web site.
REQUEST DOCUMENT
implements an HTTP client at Natural
statement level, which allows applications to access any HTTP server on either
the intranet or the internet. The statement has a set of operands, which allows
it to formulate HTTP requests according to the needs of the user application.
For example, using outbound operands it is possible to send user-defined HTTP
headers, form data, or entire documents to an HTTP server. The inbound operands
can be used to retrieve a document from the server, to view the entire HTTP
header block returned from the server, or to return the values of dedicated
headers, etc. Via binary format operands, binary objects such as gif files can
be exchanged with the HTTP server as well. For basic authorization purposes,
user ID and password operands can be specified. The content of this operand is
sent with base64 encoding over the line, according to HTTP standards.
Natural supports the following REQUEST-METHOD
s:
GET
- retrieve a document and HTTP headers,
HEAD
- retrieve HTTP headers only,
POST
- transfer form data to an HTTP server, and
PUT
- upload a file to an HTTP server.
The REQUEST-METHOD
is normally evaluated automatically,
based on the operands coded for the executed REQUEST DOCUMENT
statement. However, the predetermined REQUEST-METHOD
can be
overwritten by an explicit user specification of a REQUEST-METHOD
header.
In addition to the standard REQUEST-METHOD
s
mentioned above, the following methods can be specified in a
REQUEST-METHOD
header:
DELETE
- delete a document from an HTTP server,
PATCH
- modify a document on an HTTP server,
OPTIONS
- retrieve the REQUEST-METHOD
s
supported by an HTTP server, and
TRACE
- retrieve the message received by an HTTP
server.
The following is an example of how the REQUEST DOCUMENT
statement can be used to access an externally-located document:
REQUEST DOCUMENT FROM "http://bolsap1:5555/invoke/sap.demo/handle_RFC_XML_POST" WITH USER #User PASSWORD #Password DATA NAME 'XMLData' VALUE #Queryxml NAME 'repServerName' VALUE 'NT2' RETURN PAGE #Resultxml RESPONSE #rc
The syntax of the REQUEST
DOCUMENT
statement and detailed application hints are to be
found in the Statements documentation.
The PARSE XML
statement allows you to parse XML documents from within a Natural program.
The PARSE XML
statement integrates a full XML parser into
Natural, thus allowing Natural applications to parse XML documents in order to
easily process their content. The PARSE XML
statement opens a
processing loop and returns, whenever one of a list of events occurs during the
parse process, the respective path through the document, name and value of
parsed elements together with some parser status system variables.
The syntax of the PARSE
XML
statement and detailed application hints are to be found
in the Statements documentation.
Below is a list of resources that you may find useful.
Below is a collection of links that may be of interest.
World Wide Web Consortium (W3C): http://www.w3.org/
Extensible Markup Language (XML): http://www.w3.org/XML/
HyperText Markup Language (HTML) Home Page: http://www.w3.org/MarkUp/
W3 Schools: https://www.w3schools.com/