Data Virtualization Community Edition Tutorial: Publishing Web Services Hello, and welcome to the Tutorial Series for Cisco Information Server, or CIS. In this tutorial, we show how to Publish Web Services
For more details… Resources: Additional information: Archives Documentation Training Resources: Archives Data files Tutorial Document Note that Tutorials are NOT meant to be comprehensive training modules. Instead, they demonstrate a very basic use case that can be built quickly and easily. However, the Community Edition Knowledge Base contains additional information that will help you learn more and go deeper. Additional resources in the Knowledge Base include: <CLICK> Resources used to build the tutorial, such as Data Virtualization Archive files, data source files, and a document version of this tutorial. <CLICK> Additional information, including documentation and training materials.
Agenda What is it and why does it matter? How-to Summary Here is our agenda. We begin by defining Publishing and outlining its importance in Data Virtualization projects. Next we demonstrate the basics of Publishing Web Services. Finally, we summarize the contents of this tutorial.
Agenda What is it and why does it matter? How-to Summary Let’s begin by discussing what Publishing is, and why it is important for Data Virtualization.
What is it? Publishing Makes CIS resources accessible to authorized consumers Accessible as a Database via JDBC, ODBC, ADO.NET, OData Accessible as Web Services via REST, SOAP Many resource types may be published Data Virtualization developers use CIS Studio to create virtual views, procedures, transformations, and other types of resources. By default, these resources are not accessible to data consumers. Publishing is the act of making CIS resources accessible to authorized consumers. We can choose to Publish resources as Virtual Databases, as Web Services, or both. Virtual Databases can be accessed by any client tool that connects via JDBC, ODBC, ADO.NET, or OData protocols. Published Web Services are accessible via REST and SOAP protocols. In this introductory demo we will concentrate on publishing Procedures, which is the most common use case for publishing Web Services. However, many other types of resources may be published, including Views, Transformations, Tables from physical data sources, and even entire physical databases.
Why does it matter? Publishing Simplifies Enterprise data access Hides Enterprise data complexity Users leverage tools of choice Publishing is an essential capability for Data Virtualization, because it makes virtualized data accessible to data consumers. Virtual databases and Web Services provide a simplified “front door” to all data in the enterprise, while hiding the complexity of the many disparate physical data sources in the Enterprise. Publishing Web Services is important because it presents data in a format that can be accessed via SOAP and REST protocols. These are extremely popular access methods, especially for Web Developers.
Agenda What is it and why does it matter? How-to Summary Next, let’s walk through the basic steps of Publishing a Web Service.
Here is the business problem… Data Consumers Here is the business problem we illustrate in this tutorial. <CLICK> CIS Developers access many different physical data sources… <CLICK> To produce federated virtual procedures and views. <CLICK> However, these resources are only accessible within the CIS Studio development environment. They are not visible to data consumers using other data visualization tools. <CLICK> To make these virtual resources accessible to data consumers, we will publish them as Web Services. They can then be accessed by any client connections using REST or SOAP protocols.
Let’s get started… We’re now ready to begin. We’re going to publish the Stored Procedure named LookupProduct from the CIS Examples folder, as shown here. But why are we publishing a Stored Procedure? Why not publish a View? After all, it is certainly possible to publish Views as Web Services, and in the companion Tutorial on publishing Virtual Databases, we did choose to publish Views. The answer lies in best practices for Web Services. In most cases, it is not good practice to publish entire database tables as Web Services, because they might be hundreds of millions of rows, and Web Services over HTTP are generally not aimed at such use cases. Stored Procedures, however, can accept input parameters which can be used to filter results. Therefore, a common practice is to wrap a View within a Stored Procedure, using one or more input parameters that force the data consumer to filter data requests. That’s exactly our approach here. <CLICK> We use a single view… <CLICK> … but add a WHERE clause filter… <CLICK> … that is driven by a required input parameter to the procedure.
Publish the Procedure Right-click LookupProduct and select Publish.
Publish the Procedure As the dialog box shows, I have already published several Web Service Endpoints. I could publish to one of these, but for this example let’s create a new one. <CLICK> Click Web Services to indicate that you do not want to use an existing endpoint. <CLICK> Now click Add Composite Service. <CLICK> Give the Service a Name.
Publish the Procedure The new Web Service Endpoint is created.
Publish the Procedure Optionally, you can change the name of the published procedure. Click OK… <CLICK> and the Procedure is added to the Endpoint as a new Operation.
Verify the Published Procedure Now you can open the published Procedure and examine its column names and data types.
Verify the Published Procedure Let’s get some data. Open the Published End Point. <CLICK> Notice that both SOAP and REST services are automatically created. Click the REST tab… <CLICK> On the Operations pane, select the operation we just published. <CLICK> Scroll down to Endpoint URLs… <CLICK> … and double-click the URL for HTTP/XML. This places the URL on the clipboard.
Verify the Published Procedure Now paste the URL into a browser. <CLICK> Note the parameter template the appears in the URL. The filter we must enter is represented by the text in curly braces. <CLICK> Replace the template text with a value… <CLICK> … and authenticate. <CLICK> The filtered result is returned. Our published service is working correctly.
Publish to an Existing Endpoint Let’s publish a second Procedure, in order to show how to add a web service operation to an existing endpoint. Create a new SQL Script in a folder of your choice. <CLICK> Give the script a name… <CLICK> … and create any logic you like. To save time, I have simply pasted in the script from our previous example, and changed the name of the procedure. <CLICK> Right-click the new Procedure and select Publish.
Publish to an Existing Endpoint Now, instead of creating a new Endpoint, simply select the one we created earlier. <CLICK> Optionally, change the name for the published Procedure, and click OK.
Publish to an Existing Endpoint The new procedure is added to the Endpoint. You can open it, examine it, and test it, just as we did before.
Changing a Published Resource Finally, let’s see what happens as we make changes to published resources. Open the Procedure you created for the last example. Don’t open the Published Procedure in the Web Service Endpoint, but open the Procedure you created in your development folder. <CLICK> Change the Procedure, as shown here, and save your work.
Changing a Published Resource Now test the published web service operation as we did before. It returns multiple rows now, indicating that our change from an “equals” condition to a “greater than” condition was automatically propagated to the published resource. No re-publish is required when changes are made to underlying resources. Our demo is complete.
Agenda What is it and why does it matter? How-to Summary Let’s summarize what we have seen in this tutorial.
Summary: Definition Publishing Makes CIS resources accessible to authorized consumers Accessible as a Database via JDBC, ODBC, ADO.NET, OData Accessible as Web Services via REST, SOAP Many resource types may be published Data Virtualization developers use CIS Studio to create virtual views, procedures, transformations, and other types of resources. By default, these resources are not accessible to data consumers. Publishing is the act of making CIS resources accessible to authorized consumers. We can choose to Publish resources as Virtual Databases, as Web Services, or both. Virtual Databases can be accessed by any client tool that connects via JDBC, ODBC, ADO.NET, or OData protocols. Published Web Services are accessible via REST and SOAP protocols. In this introductory demo we concentrated on publishing Procedures, which is the most common use case for publishing Web Services. However, many other types of resources may be published, including Views, Transformations, Tables from physical data sources, and even entire physical databases.
Summary: Benefits Publishing Simplifies Enterprise data access Hides Enterprise data complexity Users leverage tools of choice Publishing is an essential capability for Data Virtualization, because it makes virtualized data accessible to data consumers. Virtual databases provide a simplified “front door” to all data in the enterprise, while hiding the complexity of the many disparate physical data sources in the Enterprise. Publishing Web Services is important because it presents data in a format that can be accessed via SOAP and REST protocols. These are extremely popular access methods, especially for Web Developers.
Summary: Key Take-aways Publishing You can create as many Web Service Endpoints as you like Changes are automatically propagated to published resources As you work with Publishing in CIS, keep these key take-aways in mind. You can create as many Web Service Endpoints as you like, and you can add resources to any of them. When you change an underlying resource, the published dependent resource is automatically changed.
Summary: What’s next? Use your knowledge to make your resources available to data consumers Leverage your knowledge to publish other types of resources Learn to connect external clients to Virtual Databases After completing this tutorial, you are ready to make your work available to external clients. Use your learning from this tutorial to publish Procedures for end-user consumption. Leverage your knowledge to publish other types of resources, such as Views, Transformations, and physical tables. Use other Tutorials to learn how to connect client tools to your Web Services using SOAP and REST. Thank you.