Skip to main content
Skip table of contents

Using the URL Adapter with the HTTP Protocol

On the basis of the example provided, this page describes how to 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

one of: http (default), https

port

a valid port number (default: 80)

path

method

one of: get (default), post, put, delete, patch, head, options

Advanced

user

Username/password.

followRedirects

any positive integer or 0

options

valid cURL options, e.g. CURLOPT_TIMEOUT=20

Proxy

proxyURL

proxyUser

proxyType

one of: HTTP, SOCKS5

SSL

sslCAInfo

sslCertificateFile

sslCertificateType

one of: PEM (default), DER

sslPrivateKeyFile

sslPrivateKeyPassword

sslPrivateKeyType

one of: PEM (default), DER

sslVerifyHost

On

Verification on.

Off

Verification off (default).

Existence

Limit verification to the mere existence of the host.

sslVerifyPeer

On

Verification on (default).

Off

Verification off.

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.

  • 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

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:

  • 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 Contents of the xUML Service Transaction Log in the Administration Guide for more details). Having this information, you can use this for error analysis or usage metrics.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.