Integrating DocuVieware through Web Service
In the previous article, we have discussed the business benefits which are offered by integration of DocuVieware through web service into modern web application. Let us look a little bit further and try to understand some of the technological aspects of web service using an example of DocuVieware and REST API.
DocuVieware HTML5 Viewer and Document Management Kit is an ASP.NET Web Component that can be directly integrated as-is in any Microsoft ASP.NET project, whether it is a Web Forms or an MVC application. Richly illustrated tutorials and demo applications with complete source code are available for a quick and easy implementation.
DocuVieware can also be integrated in almost any other kind of web application (such as WordPress, Drupal, or your own in-house application) even if it is not built using the ASP.NET technology. It can be integrated in any existing page content as well, using Bootstrap, Foundation, React, plain CSS, etc., and with any programming language, whether it is PHP, Java, Python or Ruby. This is also true even if the application is hosted in a non-Windows environment like Linux or OS X, or in a web server like Apache or Tomcat instead of IIS. In this case, DocuVieware can be embedded into a web service that will provide interoperability between the different environments.
In practice, DocuVieware is hosted on its own Windows IIS server with .NET Framework, and the requesting web application accesses this server through the REST service via its single base URL, to obtain the control code on demand. It is also possible if the application is hosted on a different server, in the cloud (on Azure for instance), or on a server that runs on Linux, etc.
Implementing an HTTP REST service is effortless thanks to the ASP.NET Web API framework and JSON for data exchange. It is also very easy to consume from any other environment and it is a commonly used architectural style nowadays.
All the REST based examples provided for educational purpose are built following the same pattern.
The REST service is implemented in C# using the ASP.NET Web API 2 from the .NET Framework 4.5. It contains a single POST method that will send and receive data using JSON.
This unique method requires a mandatory parameter: a configuration object (whose content can be adapted to specific needs) to customize the DocuVieware content, behavior and appearance. This object also contains a session identifier (it should be the session identifier from the session mechanism used by your application) and a control identifier (the name of the DocuVieware instance that will be attached to the session, usually “DocuVieware1”).
This POST request will make the service generate a response in the form of a JSON object containing the corresponding DocuVieware HTML5 markup, so it can be injected in the target page of the requesting web application.