Expedia Affiliate Network Hotel API v3 Integration Tutorial. Part

Route ‘EAN_Hotels_HotelsList_Request’

Next step is sending data to ‘EAN_Hotels_HotelsList_Request’. Let’s create route the same way
as ‘EAN_Hotels_HotelsList_DataSource’. In Listener Type select ‘Programmable (Java)’.

Now go back to ‘EAN_Hotels_HotelsList_DataSource’ route. Click ‘Add Target’, then go
to ‘Transport’ and select ‘RouteToRoute’ as ‘Transport Type’ and Programmable Listener name
from ‘EAN_Hotels_HotelsList_Request’ route at ‘Basic/Target Listener’.
Done. Now output data from ‘EAN_Hotels_HotelsList_DataSource’ are input
for ‘EAN_Hotels_HotelsList_Request’ route.
Create ‘EAN_Hotels_HotelsList_ResponseHandler’ route and ‘Programmable (Java)’ listener in it.
Let’s configure SOAP transport to EAN website. Go to ‘EAN_Hotels_HotelsList_Request’ route, click ‘Add Target’, then ‘Transport’.
Set Transport properties:
Basic tab:
Transport Type — SOAP Web Service
Target URL — http://api.ean.com/ean-services/ws/hotel/v3 . If it changes you can find new one at EAN
API documentation.
SOAP version — 1.1.

Response tab:
Set listener (Programmable (Java)) of ‘EAN_Hotels_HotelsList_ResponseHandler’ route to ‘Response Listener’.

Now response from EAN server is input data for ‘EAN_Hotels_HotelsList_ResponseHandler’ route.

Route ‘EAN_Hotels_HotelsList_ResponseHandler’

We have SOAP response from EAN server. First of all we should delete SOAP information
from it. Go to ‘EAN_Hotels_HotelsList_ResponseHandler’ route, select Listener configuration, ‘Processor Configuration’ and add ‘SOAP Unwrap Processor’.

Next step is to transform data to our custom HTML file. Go to ‘Target Transform’, click ‘Add Format’.
Then at ‘Transformation’ tab click ‘Edit’.

Nothing new for us. You can use information from EAN API documentation for getting server’s response format and, for example, XML or WSDL Format builder for building Source tree at Data Mapper.
Let’s take some simple HTML file:
<td>Hotel ID</td>
and build Target format. Click “Open Target format”, select ‘XML Format builder’ and path to our HTML file.

Now you can drag and drop elements to Mapping pane for creation relationship between Source and Target.

Save mapping and go to ‘Transport’ configuration. Select ‘Email (SMTP)’ at ‘Transport Type’.
Then specify parameters for mail sending: server, port, credentials, Subject field, etc.

Route ‘EAN_Hotels_HotelsList_ErrorHandler’

Create ‘EAN_Hotels_HotelsList_ErrorHandler’ route and ‘Programmable (Java)’ listener in it. In this route we use any transformation. We just send error message to specified E-mail. So, use ‘Source Transform” and “Target Transform” with default settings (‘Relay (System Format)’), then go to ‘Transport’. Select ‘Email (SMTP)’ at ‘Transport Type’, then specify parameters for mail sending.

Route is ready.

Runtime error handling

In order to handle the runtime errors we would need to add the transaction monitors to each route.
Transaction Monitor is the component of the route that is triggered every time the error occurs during
the route execution. If you need custom error handling for each route, you can add custom transaction monitors for each of them, but in our case we can use one, globally defined monitor, that would be triggered if error occurs in any of the routes of this interface. To do that, go to the file management dialog menu Edit -> Define Global Transaction Monitors. Click ‘Add Transaction Monitor’. There are four kinds of monitors defined in the XCS eiConsole by default. Among them, you can see the email trigger transaction monitor. Since we need to send email on each error, we could use it, but as you remember, we already have the error handling route that is sending emails with errors. Thus, let’s use Error Route Trigger monitor and specify an appropriate route name — ‘EAN_Hotels_HotelsList_ErrorHandler’. See the image below.

Environment properties

When you use interface at several environments it is usually hard to remember where exactly you set
one or another parameter. The better solution for this is to move parameters to one common for all
routes location. Open any of routes, then click “Menu/Route/Environment Properties”.

Let’s go, for example, to ‘EAN_Hotels_HotelsList_Request’ route, select ‘Transport’. Click first icon
near ‘Target URL’. Now you can select URL from Environment Properties list.

At sample project all parameters are in Environments Properties. So, first place here your environment settings and only after it execute project.