APG WebService SOAP-UI Example

Transcription

APG WebService SOAP-UI Example:It assumes that you already have a working APG installation (tested on 6.0u2), and soapUI installed onyour local workstation.Install the frontend webservice application:[root@W4N-DL-MarcAndre-A APG]# ./bin/manage-modules.sh install frontend-wsStarting installation of APG-Web-Service v6.0u2 from frontend-ws-6.0u2-linux-x64.* Gathering information.* 'APG-Web-Service v6.0u2' will be registered with instance name 'APG-WS'.* It will be installed in .? Continue? [y]es, [n]o y* Unpacking files.* Installing files. 100%* 14 files have been installed.* Finalizing installation.! WARNING: The service 'apg-tomcat-default' is about to be stopped.? Continue? [y]es, [n]o y* Stopping 'tomcat Default'.[ OK ]* Deploying web application webapp/APG-WS.war' onTomcat-Default.! WARNING: The web server Tomcat-Default will need to be started again after this process.Installation successful!Start Tomcat after installation, and wait until it is initialized correctly:[root@W4N-DL-MarcAndre-A APG]# ./bin/apg-tomcat-default startStarting APG Tomcat (Default). done.[ ][root@W4N-DL-MarcAndre-A APG]# tail -n2 .outMay 16, 2012 9:04:47 AM org.apache.catalina.startup.Catalina startINFO: Server startup in 29047 msEdit the Web-Service configuration file, and make sure all ResourceLink elements that matches yourAPG.xml file are present, and adapt or remove the Valve , so you computer has access:[root@W4N-DL-MarcAndre-A APG]# vi /APG-WS.xmlSample file: ?xml version "1.0" encoding "UTF-8" ? Context reloadable "false" !-- The datasource definition are now located in conf/server.xml -- !-- To use them in a web application, you must add a ResourceLink -- !-- Gives access to the users, profiles, roles and rights. -- ResourceLink name "jdbc/master" global "jdbc/master" type "javax.sql.DataSource" / !-- Gives access to the timeseries database. -- ResourceLink name "jdbc/APG-DB" global "jdbc/APG-DB" type "javax.sql.DataSource" / !-- Gives access to the netflow database. -- !-- ResourceLink name "jdbc/NF-DB" global "jdbc/NF-DB" type "javax.sql.DataSource" / -- !-- Gives access to the events database. -- !- ResourceLink name "jdbc/FLOW-RPE2-ARCH:{ mapping FLOW-RPE2.xml, table events archive }"global "jdbc/FLOW-RPE2" type "javax.sql.DataSource" / ResourceLink name "jdbc/FLOW-RPE2-LIVE:{ mapping FLOW-RPE2.xml, table events live }"global "jdbc/FLOW-RPE2" type "javax.sql.DataSource" / -- !-- Restrict access to localhost only -- !-- disabled. Valve className "org.apache.catalina.valves.RemoteAddrValve" allow "127.0.0.1" / -- /Context Restart Tomcat:[root@W4N-DL-MarcAndre-A APG]# ./bin/apg-tomcat-default restart

Shutting down APG Tomcat (Default). done.Starting APG Tomcat (Default). done.Login to the main APG gui, and create a sample report:Export the report in XML format, from the edit mode:Open the XML file, using any text editor. The output should look like this: ?xml version "1.0" encoding "UTF-8"? node xmlns "http://www.watch4net.com/APG/Web/XmlTree1" name "Test ws" order "0" singleNodeId "e93efd9"xmlns:xsi "http://www.w3.org/2001/XMLSchema-instance" property xsi:type "NodeFilter" filterExpression "devtype 'Router'"/ property xsi:type "ReportPreferences" duration "l1w" preferredPeriod "3600"/ property xsi:type "NodePropertyNodeColumn" name "Device" nodeProperty "name"/ property xsi:type "PropertyNodeColumn" name "IP" property "ip"/ property xsi:type "PropertyNodeColumn" name "Model" property "model"/ property xsi:type "PropertyNodeColumn" name "Location" property "location"/ property xsi:type "ValueNodeColumn" name "Availability (%)" majorLevel "99.5" criticalLevel "98.0"filterExpression "name 'Availability' & !(part)" forcePeriod "true" period "86400"useTimeRange "true"/ property xsi:type "ValueNodeColumn" name "Current Availability (%)" majorLevel "99.0"criticalLevel "95.0" filterExpression "name 'Availability' & !(part)" timeThreshold "600"/ formula formulaId "util.ChildCount" result name "devices" default "true" graphable "false"/ /formula node name "Devices" singleNodeId "cc18ba8f" uid "DEVICE-DETAILS" type "application" property xsi:type "NodeExpansion" expandOn "device"/ property xsi:type "ReportPreferences" displayMode "3" defaultMode "mix" duration "l1w"preferredPeriod "3600" displayedProperties "devtype ip location devdesc"/

property xsi:type "NodePropertyNodeColumn" name "Name" nodeProperty "name"/ report-layout hspan ".-80cd7286 3,.-4da6b0d8-a982a5cc 3,.-1962a544-f40408ce 1,.-6bae8933 1,.1962a544 1,.-9a0502e8-1ccc3c15 1" order ".-4da6b0d8-a982a5cc 6,.-1962a544-f40408ce 2,.-6bae8933 1,.1962a544 4"/ /node /node Remove all “xsi:” references, all xmlns tags, and change all tags to the “xt:” namespaces, like: ?xml version "1.0" encoding "UTF-8"? xt:node name "Test ws" order "0" singleNodeId "e93efd9" xt:property type "NodeFilter" filterExpression "devtype 'Router'"/ xt:property type "ReportPreferences" duration "l1w" preferredPeriod "3600"/ xt:property type "NodePropertyNodeColumn" name "Device" nodeProperty "name"/ xt:property type "PropertyNodeColumn" name "IP" property "ip"/ xt:property type "PropertyNodeColumn" name "Model" property "model"/ xt:property type "PropertyNodeColumn" name "Location" property "location"/ xt:property type "ValueNodeColumn" name "Availability (%)" majorLevel "99.5" criticalLevel "98.0"filterExpression "name 'Availability' & !(part)" forcePeriod "true" period "86400"useTimeRange "true"/ xt:property type "ValueNodeColumn" name "Current Availability (%)" majorLevel "99.0"criticalLevel "95.0" filterExpression "name 'Availability' & !(part)" timeThreshold "600"/ xt:formula formulaId "util.ChildCount" xt:result name "devices" default "true" graphable "false"/ /xt:formula xt:node name "Devices" singleNodeId "cc18ba8f" uid "DEVICE-DETAILS" type "application" xt:property type "NodeExpansion" expandOn "device"/ xt:property type "ReportPreferences" displayMode "3" defaultMode "mix" duration "l1w"preferredPeriod "3600" displayedProperties "devtype ip location devdesc"/ xt:property type "NodePropertyNodeColumn" name "Name" nodeProperty "name"/ xt:report-layout hspan ".-80cd7286 3,.-4da6b0d8-a982a5cc 3,.-1962a544-f40408ce 1,.-6bae8933 1,.1962a544 1,.-9a0502e8-1ccc3c15 1" order ".-4da6b0d8-a982a5cc 6,.-1962a544-f40408ce 2,.-6bae8933 1,.1962a544 4"/ /xt:node /xt:node Open SOAPui, and create a new project, and point it to your installation WS address:address should be: http://your ip address:portnumber/APG-WS/wsapi/report?wsdl

soapUI automatically creates a default request called “Request 1”. Open it, and remove everythingbetween rep:getReport tags:Paste your previously exported report, but only the node tags (don’t copy the ?xml tags ):

Add authentication, in the Request Properties section. Default username and password are:admin/changeme:Click the Submit button, and see results:You can also request graph reports, the same way. You make sure you are exporting a graph like report.If you forgot to enable remote access to the WebService, you will get access denied errors, like:From Tomcat logs:

soapUI automatically creates a default request called “Request 1”. Open it, and remove everything between rep:getReport tags: Paste your previously exported report, but only the node tags (don’t copy the ?xml tags ): Add authentication, in the Request Properties section. Default username and password are: admin/changeme: Click the Submit button, and see results: You can also .