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 AttributeValue
protocolhttp
port11112
pathhello/hello/GETHelloStatic
hostlocalhost
methodGET

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.

AttributeDescriptionAllowed 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
userUsername/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:

  • values separated by ',' in one line
  • values separated by ' ' in one line
  • list of tagged values
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.

OnVerification on.
OffVerification off (default).
ExistenceLimit verification to the mere existence of the host.
sslVerifyPeer

Whether to verify the peer information from the SSL connection.

OnVerification on (default).
OffVerification off.
sslPrivateKeyType

Type of the private key.

one of: PEM (default), DER

URL Adapter Response

The adapter returns the following parameters:

AttributeTypeDirectionRestrictionsDescription
to listed protocol onlyto 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.
  • Header names are lowercase and treated case insensitive.
  • Multiple headers with the same name are treated as arrays.

Refer to HTTP Header Support for more information on the standard xUML HTTP headers.

httpStatus
Integerouthttp, https
Contains the HTTP status code of the response.
responseBlobout
get, post, put, list, readContains 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:

  • X-Transaction-Id or xTransactionId (in JMS context)
    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.
  • X-Request-Id
    This header identifies the unique request. The Runtime generates a unique number for each adapter call.
  • X-Sender-Host and X-Sender-Service
    These headers contain the sender host resp. the sender service. They are set by the Runtime automatically.

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.

  • No labels