Changing the invoke connector

In the list of connections, locate our newly created FlightStatusReport_REST_Ch7 connection from the connections list to the right of the canvas and drag and drop it onto the Trigger pad. This will then display the endpoint configuration wizard. We can start to complete the wizard with the details given in the following table:

Tab

Properties

Description

Basic Info

Call your endpoint field?

To keep it simple call it RESTSource.

What does this end point do?

Add the description: receives JSON formatted progress status messages.

What is the endpoint's relative resource URI?

We want to add to the server URL the name /FlightStatusUpdate/ for this service.

What action does the endpoint perform?

As we are providing data we should be using PUT or POST, as we want a response it is better to use POST.

Add and review parameters for this end point

As we are not going to use any parameters in the URL this should be unset.

Configure a request payload for this endpoint

We do need to define the message payload, so this needs to set.

Configure this endpoint to receive the response

We do need to define the response body, so this needs to be set.

Configure request Headers

We do not want to modify any aspect of the HTTP request header so leave these unset.

Configure Response Headers

We do not want to modify any aspect of the HTTP response header so leave these unset.

Configure CORS

We can leave this unset.

Parameters

Classic REST will make use of URI to define object values in the path and/or query parameters as well. This means that ICS has to provide a means by which the URI can be processed to extract values; for example, https://mywebService.com/products/101/ could be used to refer to products identified by an ID of 101. In proper REST service terms this would return the details of product 101, but if we want to query all products for those containing oil you might have a URI like https://mywebService.com/products/?contains=oil, so you need to be able to link possible query values. In our case, we do not need any parameters or attribute related details in the URI.

HTTP Headers and CORS

Before we move onto the next tab, let's address two considerations that you may wish to use in the future - the use of headers and CORS. The use of HTTP headers was referenced in Chapter 1, Introducing the Concepts and Terminology and Chapter 2, Integrating Our First Two Applications. The HTTP header normally carries a number of standard parameters that describe the nature of the HTTP payload and its delivery as name value pairs. Best practice points to using custom header attributes for informational purposes only; for example, the data in a HTTP body originates from a web cache. Many of the additional header attributes have become de-facto standards, for example, pingback addresses for WordPress.

Tip

More information on the HTTP standard and the header attributes can be found at the Internet Engineering Task Force (IETF) site - https://www.ietf.org/rfc/rfc2616.txt The IETF have taken over the task of managing the HTTP standard from the World Wide Web Consortium (W3C) -https://www.w3.org/.

Cross-Origin Resource Sharing (CORS), like HTTP, CORS has originated from the W3C to help address the problem where if a website then wants to exploit resources from a different website where these websites have different domains, (for example, www.myWebsite.com and www.google.com) as many of the HTTP API functions used by things such as JavaScript (for example, XMLHttpRequest, which is used by AJAX calls) are restricted calls within their own domain - for example, my web application provided by www.MyWebsite.com would not be allowed to call www.google.com/API/GetSomeData. This restriction is to mitigate against Cross Site Scripting attacks. The CORS standard, which is now realized by all recent browser versions, addresses this by working through an agreed set of types of interaction or through an agreed handshake protocol. The use of CORS when the handshake approach is used is done primarily through header attributes. The tick box provided by ICS provides the means to configure these headers.

Tip

More information on CORS can be found at the W3C site - https://www.w3.org/TR/cors/. A working example of CORS in use can be seen at http://www.html5rocks.com/en/tutorials/cors/.

Having explored these other areas a bit more, we can move to the next tab using the Next button.

Configuring the Request

Having provided the details of the first tab, which informs how the remaining tabs will appear, we can start on the request information by completing the details as shown in the following table:

Tab

Section

Action

Request

Accept attachments from Select the type of payload with which you want the endpoint to receive request

If your REST service was taking an attachment – for example an upload service, then you would need to set this. As we do not want attachments leave unset.

Request is HTML form

If the integration service is being invoked from a web form – then select as you will need to examine part of the HTML structure. Not so in this case, so leave the checkbox unchecked.

Select the request payload file – XML Schema/JSON Sample radio buttons

Select the JSON Sample. We will complete this in next section.

Element

This will appear once we have provided the JSON sample. The drop-down menu should be set to request-wrapper as this is the only option available.

Select the type of payload with which you want the endpoint to receive

Within the HTTP header information is provided that describes the payload body. This toggle sets that attribute. In our case we simply want to pass JSON so our prior selections should have defaulted JSON, but confirm or force the selection of JSON.

Coming back to the payload request, we can provide our payload sample by using the file selector or paste it in for ICS to see. The file selection is no different to selecting a WSDL or any other file we have seen so far. We are going to choose the <<< inline >>> option. Click on <<< inline >>> to get a new screen displayed, as you can see in the following screenshot:

Configuring the Request

The JSON payload for the request has already been created and can be found with the other chapter resources, in a file called ICSBook-Ch7-FlightProgress-Source-request.json. The content of this file needs to be just pasted into the form. If the JSON within the form is incorrect, Oracle will alert you to this fact. The JSON content provided is valid, but by editing it you can see the validation fail the payload easily. With the valid JSON loaded, we can complete the dialog by clicking on the OK button. Then we need to move on to the next part of the configuration by clicking on the Next button. As we have chosen not to do anything with regards to the Request Header or CORS, this will take us into completing the details defining the response payload. The following table provides the details to complete this:

Tab

Section

Action

Response

Select the response payload file – XML Schema/JSON Sample radio buttons

Set the checkbox to be JSON Sample. You can complete this as we did with the Request or simply choose the file as we have done with the WSDL files. The file containing the JSON is called ICSBook-Ch7-RoutedFlightStatusEnquiryResponse.json.

Element

This will appear once we have provided the JSON Sample. The drop-down menu should be set to response-wrapper as this is the only option available.

Select the type of payload with which you want the endpoint to receive

Within the HTTP header information is provided that describes the payload body. This toggle sets that attribute. In our case we simply want to pass JSON so our prior selections should have defaulted JSON, but confirm or force the selection of JSON.

Reapplying mappings

Once the response details have been provided we can move on again with a click of the Next button. As we are not changing the Response Headers either, we will move onto the summary stage. The REST endpoint summary is like any other endpoint summary, so we can complete the process by clicking on the Done button.

As we have replaced the source, we will need to reapply the mappings; the details are given in the following table:

Source (execute|request wrapper|FlightSitRepType)

Target (FilteredFlightProgress)

ID

ID

ident

ident

prefix

prefix

type

type

ICAORef

suffix

origin

origin

destination

destination

timeout

Timeout

timestamp

timestamp

longitude

longitude

latitude

latitude

updateType

updateType

As with our original filter, we want to set the notes field on the target side to be a literal value, but this time the value should be JSON source. This will mean we can differentiate the call between the two integrations to the common Mockable.io endpoint. With that, the flow to FilteredFlightProgress mapping is complete and we can use the Save and Exit Mapper buttons.

We also need to reapply the executeResponse flow, with the mapping values given in the following table:

Source (FilteredFlightProgressResponse) and $SourceApplicationObject

| execute | request wrapper

Target (FlightProgressResponse)

ID (from $SourceApplicationObject)

ID

ident (from $SourceApplicationObject)

ident

prefix (from $SourceApplicationObject)

updateType

We should also apply the same approach to the value for the target notified element where the notified element from FilteredFlightProgressResponse is prefixed using the string concat function with the literal value of JSON response is. The mapping should look something like:

Reapplying mappings

Again, save the mapping and exit. This just leaves applying the filter again.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset