As you may know, DataPower does rewrite the WSDLs and Schemata a WSP gets created on optimized for compilation.
DataPower WSDL publisher "...?wsdl" does present the rewitten WSDLs and Schemata.
For debugging a PMR WSDL issue I needed to vizualize the complete WSDL/Schema import/include structure. And so I wrote adpWsdlDraw service that allows me to pass a DataPower hosted WSDL URL, and the service traverses all import/include and generates a SVG (Scalable Vector Graphics) drawing that gets displayed in your browser. "Scalable" means that you can zoom in arbitrarily without loss of drawing quality, which is needed given the big amounts of WSDLs/Schemata being the basis of customer PMRs I saw. Please see at bottom for example (screenshot).
First you can just import and use it against your own WSP WSDLs.
No need to understand the details in that case.
And you can at least get a "visual" understanding of its complexity.
Next you can understand how a DataPower service generating a SVG layout works and make use of that for your own projects.
Then you can modify the service to your needs as well.
By the way, Graphviz SVG drawings are interactive, if you move the mouse over an edge it will show you the edge's nodes.
The traversal in the stylesheet is a bit sloppy, I did no duplicate node detection and therefore tons of nodes and edges get generated multiple times. Grapvviz statement "concentrate=true" was good enough for me to eliminate all duplicates in the final drawing. Additionally it joins common edge parts giving a better view on the structure compared when each edge would be drawn separately.
Here is pbmtobraile online to try out (without the need to install
anything), especially "echo -e ... | pbmtext | pnmcrop |
pbmtobraille". Here is an input form to try out, with short listing
of "echo -e" options: https://stamm-wilbrandt.de/echo-e.to.braille.html
If you do access your DataPower boxes via a VNC session as
described over your company VPN from remote, your traffic from VPN
server to your VNC server is not encrypted. These days end-to-end
encryption should be done everywhere [remote-->VPN
server-->VNC server--(https)-->DataPower]. One option for
this is to tunnel the VNC connection over SSH. There are many
tutorials (it is really simple), this
is one of them.
I wanted to be able to do same or similar [of course store as file and view via gimp or browser is possible].
Back in 2011 I gave 2 WSTE webcasts on "Non-XML Data Processing in WebSphere DataPower SOA Appliances Stylesheets". The 2nd webcast shows on slide 28 how I did convert a bitmap image into textual output making use of the Braille Patterns.
This is the conversion for snowman.pbm, .pbm is portable bitmap format from netpbm tools:
Typically only the top 2x3 dots of 2x4 get used, as you can see above I used all 2x4.
samples.txt[.pre.html] contains various sample output produced (shown below), which are part of pbmtobraille.c's comments too.
9x9.pbm is a really crazy parsing sample according the .pbm spec, following this statement:
"Mr. Poskanzer cautions that programs that read this format should be as
lenient as possible, accepting anything that looks remotely like a pixmap."
This is the header section demonstrating basic use with pbmtext output, including negation of generated output, as well as the help line telling the tool's features:
This is top of tail comment section, showing graphviz output done by pbmtobraille:
And finally this is bottom section showing a bigger layout in vertical direction (layout=TB is default, Top to Bottom):
OK, lets first see what the Text clock from Ross Goodwin looks like after being ported to GatewayScript on DataPower. More details can be found in posting Brilliant: Text Clock displays current time using text from public domain books. As you can see in the 50% resolution screenshot below the page states the time in big bold red characters, "the time is", "eight", "fourty-two", "in the morning". Additionally the DataPower port reports the maximal time taken by asynchronous url.open() calls.
There were several problems to be resolved in porting, described one by one now, all changes can be looked up in this side-by-side diff. MPGW service export rgTextClock.zip allows you to easily play with (access it at "http://yourBox:3600" in your browser)..
The script needs access to "urlopen" module, header variables (in order to set "text/html" Content-Type for the generated response) and service variable (in order to set 'var://service/mpgw/skip-backside' making rgTextClock MPGW service a loopback service). In addition it needs to simulate write access to HTML elements identified by ID. This is done by object "o" acting as associative array. Varaible "t" and constant "d" of 50 millisecond are used in function "check()" discussed further below:
Now we have to solve the problem on how long to wait until all asynchronous "urlopen.open()" calls have finished, the same functionality as provided by DataPower's event-sink action on rule level. This is done by function "check()" that gets called with a 50ms delay. If "all is done", it just calls function "result()" to generate and return the HTML response page. Otherwise it just calls itself again, after another delay of 50ms. When is "all is done" achieved? In the case we just have to count the number of completed HTML elements writte, or the number of keys of object "o". If it is 7, we are done. Here you can see function "check()" together with its initial invocation:
For completeness this is function "result()" that
generates response HTML page (includes a 15sec page refresh for clock updates in your browser)
sets "text/html" Content-Type header
does skip-backside for a loopback service
If you watch the "completed in" times reported below the main response you will notice quite some variance. Btw, since the data is accessed from Ross' web server your DataPower box needs internet access in order to work.
The refresh every 15 seconds will show 4 different pages per minute, but the time displayed will be the same for a given minute.
I was really impressed and thought how to make it run on DataPower. There is no "sleep" or "delay" function among the DataPower extension functions for XSLT/XQuery/JSONiq besides the <dp:url-open> timeout trick (for development purposes only!). So I looked at GatewayScript and remembered my previous posting on GatewayScript timers, and this posting shows how to do sleepsort based on GatewayScript timers, but some tricks are needed.
The first problem that needed to be solved was how to pass an argument to a (anonymous) timeout function -- that was solved easily via some googleing, just pass arg1 [, arg2, ...] after the timeout value (in milliseconds) in setTimeout().
Next problem specifically to setTimeout solution for sleepsort was how to output the result [by session.output.write()] after the last timeout has fired. My first solution was to setup an additional timeout longer than all values to be sorted, but without knowing the maximum value that was difficult, and not nice.
The next idea was better, making use of the fact that only the last session.output.write() wins in sending the response back, just define two timeouts for each number to be sorted:
timeout at x millisecond for number x, and timeout function appending x to result array when timeout fires
timeout at x+1 millisecond writing the (current) result to session.output
OK, now we have 2N timeouts for sorting N numbers, but the final result gets written last and therefore returned.
Of course there is the problem that sorting might not be correct if too many numbers get sorted and race condifions between timeouts might occur. Interestingly sorting 20000 numbers works always fine in GatewayScript(!).
I did pipeing the output of sleepsort.js into sleepsort.check.js in order to find occurences of incorrect sortings:
This posting is on how to connect a serial console server with DataPower XG45/XI52/XB62/IDG appliances.
Why do we want to do this? It allows remote access to serial console of DataPower appliance and seeing all bootup messages. For example I can login to "myXI52" appliance over serial line from anywhere in the world by:
$ telnet dp-gport 10005
Connected to dp-gport.
Escape character is '^]'.
Welcome to DataPower XI52 console configuration.
Copyright IBM Corporation 1999-2014
Version: XI188.8.131.52.0 build main.252668 on Oct 22, 2014 4:51:19 PM
Serial number: 6805302
Notice: startup config contains errors.
Whether you are allowed to access DataPower serial line at all and/or remotely depends on your company's security policy.
We have serial console servers in both Böblingen lab DataPower racks (one for Level 2 support and one for my Level 3 support rack). Since three weeks now we have a "DataPower room" in Böblingen lab -- August, Andreas and I share an office (see room sign at bottom of this posting). We do share appliances as well. This is the 16port serial console server in my rack:
On the left "ETHERNET WAN PORT" provides the network connectivity, and lines 1-4 provide serial (RS232) access to 4 of my DataPower appliances.
The serial line connection of "myXI52" appliance until today was done by connecting the blue serial line cable received with my appliance in April last year with the grey serial-to-RJ45 cable I used to connect a XI50 appliance to serial console server before.
The black cable does the same now, and is built after this prototype from Andreas, see his dwAnswer posting for details. In short you just have to cross the green and green-white cables, that's all:
The last time I did such "hardware stuff" myself was when tuning my Asuro robot back in 2006 ;-)
I wanted to play with it a bit, and wanted to deal with parallel timeouts. "Timeout demo" GatewayScript td.js is the result. Depending on the input timeout values in milliseconds the 1st timecout kicks in first and cancels 2nd timer, or 2nd timeout kicks in and overwrites GS response (only the very last that is written to session.output gets returned as response):
Not surprisingly the stylesheet did not compile, it missed "version", "encoding" and other stuff required by XSLT 1.0 spec and did not know what "𝖛𝖊𝖗𝖘𝖎𝖔𝖓" and "𝖊𝖓𝖈𝖔𝖉𝖎𝖓𝖌" should be. So I repeated compile-fix until the stylesheet finally compiled again. This is the result -- vi's syntax highlighting does not like black-letter ;-)
And wow, the output was BIG and very detailed. I found many functions not mentioned in above util function list, and wanted to get a compressed list. Therefore I did just set showHidden to false, here you can see the output:
From a DataPower support perspective I have to say that any use of undocumented functionality is not supported.
But util.inspect() is a useful tool at least for debugging, your self developed modules as well as required 3rd party modules.
In CLI debugger the length of output string is restricted to 512 bytes by default, but can be overridden by -L option (-1 meaning unbounded). So here you see that you can do util.inspect() in CLI debugger as well:
xi52(config)# show debug-actions
Session ID Transaction ID Service Name File Location Remote Address In Use Remote User User Location Elapsed Time ---------- -------------- ------------ ------------- -------------- ------ ----------- ------------- ------------ 391 298305 coproc2gatewayscript local:///temp.js 184.108.40.206 No 00:00:05