- This line was added.
- This line was removed.
- Formatting was changed.
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:
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
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.:
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
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>>
In the example above the following POST request will be sent:
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.
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.
URL Adapter Response
The adapter returns the following parameters: