Web Service pretty print

Here is a technique that uses XSLT to pretty print the XML metadata of a Lawson Web Service. The output shows each operation’s details (name, input/output parameters, type, length, constraint, SQL statement, etc.) in a human readable HTML format. This technique is useful for creating template spreadsheets in Excel where we input data without having to manually enter the headers in the spreadsheet which is error prone. The result is similar to the template spreadsheets generated by Smart Data Tool.

  1. Suppose we have the following Thibaudweb service with three operations, one of each type, API, MDP, and SQL:

  2. Save the XML metadata into a file somewhere in your computer. For that, go to the Lawson Web Service server view (for example: http://hostname/LWS_DEV/), select List Services, expand your web service (in my case Thibaud), right-click the Meta Data link, select Save Target As, and save the XML file somewhere in your computer:
  3. Then, open the XML file in a text editor, insert the following processing instruction at the top of the file, and save the file:
    <?xml-stylesheet type="text/xsl" href="WebServicePrettyPrint.xslt"?>
  4. Then, save a copy of the following XSLT file to somewhere in your computer, in the same folder as the XML file: http://ibrix.info/lws/WebServicePrettyPrint.xslt
  5. Then, open the XML file in Microsoft Internet Explorer. The XSLT processor of Internet Explorer’s MSXML will convert the XML metadata into HTML using the XSLT file above. The HTML output shows each operation’s details (name, input/output parameters, type, length, constraint, SQL statement, etc.) in a human readable HTML format. The result looks like this:
  6. Internet Explorer will show a security warning asking if you want to run the script. Click Allow blocked content. The blocked content is a small piece of JavaScript code that transposes the HTML tables.
  7. The little button at the top right transposes the HTML tables. Click the button. Copy/paste the transposed table in an Excel spreadsheet. That will serve as the header. Now just enter the data. That’s useful to create the template spreadsheets in Excel similar to Smart Data Tool.

That’s it!

 

UPDATE 2012-08-14: Added support for MDP Output fields and Related Programs.

Published by

thibaudatwork

M3 Technical Consultant

One thought on “Web Service pretty print”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s