- Created by Annegret Bernhardt, last modified on Jan 08, 2024
On the basis of the example provided, this page describes how use the URL adapter with the HTTP protocol.
Static GET Request
The following example shows how to access a web resource through the URL adapter.
The request operation uses the alias to identify the web resource and the method to perform. The response is a Blob. In this implementation, the response contents are mapped to a form to be displayed to the user.
In this example, the web resource is also part of the same example service (see API.HelloAPI). The URL of the resource is specified in the URL alias as follows:
Adapter Attribute | Value |
---|---|
protocol | http |
port | 11112 |
path | hello/hello/GETHelloStatic |
host | localhost |
method | GET |
Find below a list of all attributes that can be used with the HTTP protocol.
Full Dynamic GET
Sometimes URL parameters are not static but must be calculated or are know at runtime only. To reflect this, you can provide all information from the URL adapter alias dynamically on the request operation.
You can also use a mixture of static and dynamic access. Specify the static parts on the alias and provide the dynamic parts via the URL adapter parameters. This can be helpful because the settings of the alias can be changed in the service configuration later.
The following example shows a full dynamic request. All needed information to access the web resource is specified via the parameters.
Action composeURL builds the URL to access the dynamic resource of the API and the name given by the user is added.
Alias Attributes
Find below a list of relevant alias attributes, if the URL adapter is used with the HTTP protocol. Default values used when an option is not explicitly set are written in bold.
Attribute | Description | Allowed Values / Examples | |
---|---|---|---|
Standard | |||
protocol | Transport protocol. | one of: http (default), https | |
port | Machine port number the service is binding to. This port number can be given at service level only. | a valid port number (default: 80) | |
path | HTTP path for the SOAP request. | ||
method | HTTP method of the URL adapter call. Default is "POST" if no value is specified. | one of: get (default), post, put, delete, patch, head, options | |
Advanced | |||
user | Username/password. | ||
followRedirects | The maximum number of redirects to follow. | any positive integer or 0 | |
options | Native cURL options as listed on Setting cURL Options on the URL Adapter . Use one of the following syntax rules:
| valid cURL options, e.g. CURLOPT_TIMEOUT=20 | |
Proxy | |||
proxyURL | URL of the proxy server. | ||
proxyUser | Proxy user. | ||
proxyType | Type of the proxy | one of: HTTP , SOCKS5 | |
SSL | |||
sslCAInfo | Name of the file containing additional certificates for the connection verification (e.g. additional root CAs). | ||
sslCertificateFile | Name of the file that contains the client certificate. | ||
sslPrivateKeyFile | Name of the file that contains the private key. | ||
sslPrivateKeyPassword | Password for the private key. | ||
sslCertificateType | Type of the certificate. | one of: PEM (default), DER | |
sslVerifyHost | Whether to verify the host information form the SSL connection. | On | Verification on. |
Off | Verification off (default). | ||
Existence | Limit verification to the mere existence of the host. | ||
sslVerifyPeer | Whether to verify the peer information from the SSL connection. | On | Verification on (default). |
Off | Verification off. | ||
sslPrivateKeyType | Type of the private key. | one of: PEM (default), DER |
URL Adapter Response
The adapter returns the following parameters:
Attribute | Type | Direction | Restrictions | Description | |
---|---|---|---|---|---|
to listed protocol only | to listed method only | ||||
httpHeaderMap | Map of Entry | out | Header information as a map. The map contains arrays of header value strings whereas the header name is the key of the map.
Refer to HTTP Header Support for more information on the standard xUML HTTP headers. | ||
httpStatus | Integer | out | http, https | Contains the HTTP status code of the response. | |
response | Blob | out | get, post, put, list, read | Contains the response content in relation to the used method. |
HTTP Headers
With xUML service adapter calls, the xUML Runtime adds the following outgoing HTTP headers containing correlation information to the request: Transaction id and request id will be logged to the transaction log on the adapter call (refer to Administration Guide > Contents of the Transaction Log for more details). Having this information, you can use this for error analysis or usage metrics.
This header identifies the transaction the call belongs to. You can set the transaction id manually with setTransactionID. If not set, the Runtime will generate one.
This header will be passed through the callstack to identify all service calls that belong to a transaction.
This header identifies the unique request. The Runtime generates a unique number for each adapter call.
These headers contain the sender host resp. the sender service. They are set by the Runtime automatically.
- No labels