You can translate the document:

Changing Web service implementation

Change Web service Implementation

You have figured out how to integrate consuming applications via web services, now you can work with Denodo to populate the services with data. Our goal now is to create a derived views and add it as the implementation of our i_client_info interface.

Creating derived views

You already know how to create derived views using the available operations (selection, union, join, flatten, minus, intersect). This topic was covered in the Basics Tutorial / DV First Steps / Simple Derived Views using the Web Design tool. Hence, in this tutorial, you will create this derived view in the Web Design Studio.

The derived view we want now must have fields that correspond to the definition of the interface. In our i_client_info interface, the schema is:

This schema is very similar to the schema of the client_with_bills view, let's reuse it!

  • i_client_info field: corresponding client_with_bills field(s).
  • client_id: this field matches exactly with the client_with_bills view.
  • full_name: you don't have this field in any of your views, but we can concatenate the name and surname fields of client_with_bills in order to get the full name.
  • client_type: this field matches exactly.
  • full_address: just like the full_name field, we will just concatenate street, city, zip and state.
  • phone: this field matches primary_phone.
  • billing_due_date: this field matches due_date.
  • balance: this field matches exactly.

Since we only need one view, to create the new derived view you should use the selection operation to model the proper schema. You can follow these steps:

  1. Right-click the client_with_bills view in the elements tree and select New > Selection.
  2. Go to the Output tab and rename the view to: client_info_impl.
  3. Remove the fields: name, surname, code, value, street, city, zip, state, ssn, billing_end_date, phone_center, billing_period_id, billing_start_date, billing_id, return_customer_id, package_id, amount_due and tax_id (Keep only client_id, client_type, primary phone, due_date, and balance).
  4. Rename primary_phone to phone.
  5. Rename due_date to billing_due_date and edit this field to convert it to date.
    1. Open the edit dialog by clicking the small pencil next to billing_due_date or right-clicking the field and selecting edit.
    2. Under Field expression, write to_localdate('yyyy-MM-dd HH:mm:ss', client_with_bills.due_date) (this calls the to_date function which will convert the text data of due_date into the date data type with format 'yyyy-MM-dd HH:mm:ss').
    3. Click Ok

  6. Create a new text field called full_name by concatenating name and surname.
    1. Click the New field button at the bottom of the output dialog.
    2. Enter the Field name full_name.
    3. In Field expression, write concat(, ' ', client_with_bills.surname) (this calls the concat function which joins the name and surname with a space in-between).
    4. Click Ok.
  7. Create a new field called full_address by concatenating street, city, zip and state.
    1. Click the New field button at the bottom of the output dialog.
    2. Enter the Field name full_address.
    3. In Field expression, write concat(client_with_bills.street, ', ',, ', ',, ', ', client_with_bills.state) (this calls the concat function which joins each row's street, city, zip, and state with a comma and space in-between each).
    4. Click Ok.
  8. Change the type of the balance field from text to decimal.
    1. Open the edit dialog of the balance field
    2. Type cast('decimal', client_with_bills.balance) in the Field expression (If possible, this will convert the text of the field into a decimal data type).
    3. Click Ok.
  9. Finally, click the button to create the view.

At this point, it's a good idea to execute this view to see if everything works as expected. Make changes to the view if needed and when the view works, go on. (Make sure your MySQL database and web service are running. Refer to Installation & Bootstrapping).


Configuring interface implementation

The last step of this tutorial is to configure the i_client_info interface to use client_info_impl as its implementation view. Open i_client_info in the interface in the workspace by double-clicking on it and then open the Edit dialog with the button at the top.

Here, open the Implementation tab and all you have to do is drag the implementation view we just created into the dialog:

As you can see, Denodo associates fields with matching names automatically. We're all set, click the button to add the implementation your interface.

If the implementation view does not match the definition of the interface, the Implementation tab will be marked with a tooltip explaining why the view is not compatible with the interface.


Sweet, your work is done! Well, almost, there's only one last step. Let's test our services (the same steps covered in the Invocation Section) to see the implementation we just setup be queried.

Test the REST data service using these URLs again:

  1. -> now actually returns all client data.
  2. -> now actualy returns the data for the client whose client_id equals 'C005'.

Test the SOAP data service using SOAPui with the same request as before:

It is important to know that you don't need to change/modify/update your data services, editing the virtualization layer will be enough.


Pretty awesome, huh? Congratulations! You just finished the Denodo Data Services Tutorial set.

Thank you!