This page explains the URL Adapter in Bridge context. If you were looking for the same information regarding the PAS Designer, refer to URL Adapter in the Designer guide.

Static GET Request

The following example shows how to access a web page through the <<URLAdapter>>. The page URL is derived from the alias (details see below).

To make the HTML page readable in a conventional text editor or Web browser we convert it to a string in the second step using the transcodeToString.

As the <<URLAdapter>> is a backend for the Bridge, the necessary connection information is done in the component diagram. The link to this diagram is done with an alias (which is an artifact with the stereotype <<Alias>> ), which has to be defined by the developer. The name of this alias can be chosen freely.

We suggest to store all aliases in package Aliases.

The following figure shows the corresponding backend part of the component diagram for the above GET request:

Figure: Component Diagram for Static GET request

The SOAP service has a dependency to the backend alias. The backend delivers the requested HTML page. The parameters for the HTTP request are defined as tagged values on the <<URLAlias>>.
In the example above the following GET request will be sent to e.g.:  http://www.e2ebridge.com:80/BridgeFiles/bridging_in_a_nushell.htm

Find below a list of all tagged values that can be used with the HTTP protocol.

Static POST Request

To define a POST request we have the same structure and stereotypes as previously described for the GET request. There are basically two differences. The protocol defined in the component diagram has to be "POST" and the post parameters have to be defined in the activity diagram. In some cases the HTTP-Header has to be adjusted, otherwise the Bridge defaults are used.
The activity diagram below shows the definition of the key/value pairs which can then be sent via POST to the host defined in the deployment diagram. Because the input of the <<URLAdapter>>  is a blob that must be named "content" this parameter definition has to be made in several steps.

The first step creates the HTTPHeaderField class, which overwrites the content-type default value to application/x-www-form-urlencoded. With this statement, the post-request will look like it would be sent via a Web Browser.

The second step creates the post parameter and appends the key-value pairs together with the manipulated contentType to the headerParameters array.

The third step concats all input values in one string that will be transcoded to a blob in the next action state. This transcoding is necessary because of the interface of the <<URLAdapter>>, which requires Blobs as input and output parameter. The action state with the stereotype <<URLAdapter>> has no script entries but a tagged value with the alias that makes the link to the deployment diagram (like described in the GET request).

The last step transcodes the base64 output (in this case a .html page) to a string which is sent back to the client.

All object names except outputString in the last step must be named exactly like in the diagram above because only these input parameters are valid for the <<URLAdapter>>.

Full Dynamic GET

It is also possible to not have an alias pointing to the host and not to have a component diagram. This is useful when all parameters are dynamic e.g. all parameter are read from a database. The following request creates the URL dynamically which means that you do not have an alias pointing to the component diagram where the parameters are defined.

Figure: Get Request Without Deployment Diagram

However, the absence of a component diagram where the backend is well documented should be the exception, and only used if all backend parameters are dynamic.

Tagged Values

Find below a list of relevant tagged values, if the URL adapter is used with the HTTP protocol.
Default values used when an option is not explicitly set are written in bold.

Tagged ValueDescriptionValues
protocolTransport protocol.http, https

method

HTTP method.get, post, put

port

Machine port number the service is binding to. This port number can be given at service level only.

80

path

HTTP path for the request.
Advanced
followRedirectsMaximum number of redirects to follow.any integer
optionsNative cURL options.cURL Options
Authentication
userUsername/password.
Proxy
proxyTypeType of the proxy.HTTP, SOCKS5
proxyURLURL of the proxy server.
proxyUserProxy user.
SSL
sslCAInfoFile name containing additional certificates for the connection verification (e.g. additional root CAs).
sslCertificateFileFile name containing the client certificate.
sslCertificateTypeType of the certificate.PEM, DER
sslPrivateKeyFileFile name containing the private key.
sslPrivateKeyPasswordPassword for the private key.
sslPrivateKeyTypeType of the key.
sslVerifyHostWhether to verify the host information form the SSL connection.OnVerification on.
OffVerification off.
sslVerifyPeerWhether to verify the peer information from the SSL connection.OnVerification on.
OffVerification off.

URL Adapter Response

The adapter returns the following parameters:

HTTP Headers

Overwriting Default Headers

Builder 7.12.0 Runtime 2020.12 You can overwrite this default behavior by own header role definitions as described on HTTP Header Support > Overwriting the Standard HTTP Headers. In this context, you can also enable automatic header generation for dedicated headers.To do this, specify a list of header generation rules in tag requestHttpHeaderRoles on the URL alias.

requestHttpHeaderRoles can hold a list of definitions in format <http header name>:<role>. The listed headers will automatically be generated with the specified role for each adapter call on this alias. These definitions overwrite the default behavior, and X-Transaction-Id, X-Request-Id, X-Sender-Host and/or X-Sender-Service will be substituted by this definition.
Refer to URL for the list of allowed values.