Using a client-created SOAP request header
- Last Updated: July 19, 2021
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
This example shows how you might create a SOAP header internally to use as an initial SOAP request header, as opposed to recycling a header previously received in a SOAP response message (described in previous examples). This is an example of the header created by the client for the Web service:
SOAP request header created entirely by the client
|
The client creates a header very similar to the headers described in
the previous examples. The <UserName> and
<Password> elements, in this case,
provide user authentication for each Web service request. The Web service requires
this authentication for every Web service request.
The following code is the mainline of a procedure that invokes the Web service to create the initial SOAP request header containing a username and password node. This code:
- Defines several mainline variables, including handles to access
the global SOAP header (
g_header) created for requests and its XML, and variables to hold the username (cUsername) and password (cPassword) values. - Builds the global request header used for all requests (see Procedure to create a SOAP request header).
- Registers the request header (
ReqHandler) handler after connecting to the Web service and instantiating theHeaderSoapport type procedure object. - Runs the
HelloMyWorldprocedure to invoke a Web service operation, passing back the global SOAP request header created by the client (see Request header handler for passing a globally-created header object). - Cleans up the global objects maintained in its context and disconnects from the Web service. Note that one of the objects it deletes is the global SOAP request header create by the client.
|
|