Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 20.1c

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). The adapter returns the following parameters:

NameTypeDirectionDescriptionresponseBloboutretrieved content.httpStatusIntegeroutHTTP status codes as integer.httpHeaderParametersArray of HeaderFieldoutHTTP header parameters as an array of name-value pairs.

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.

Figure: Get HTML Page

Image Modified

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.

E2E We suggest to store all aliases within the 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.

Figure: Post Request

Image Modified

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>> Anchor8_add-ons_url_http_static_post_r_57128_add-ons_url_http_static_post_r_5712.Figure: Component Diagram for a POST Request
In the example above the following POST request will be sent: http://systems1/bugtracking_obtree/postresult.htm    

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

Image Modified

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.

Multiexcerpt
MultiExcerptNamehttp_tagged_values
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:

Multiexcerpt include
SpaceWithExcerptWBRIDGE
MultiExcerptNameurl_parameters_outgoing
PageWithExcerptURL

HTTP Headers

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNamehttp_headers_adapter
PageWithExcerptINTERNAL:_bridge_excerpts