Sample java code to execute SQL queries using AXL

Version 1
    This document was generated from CDN thread

    Created by: Komalkumar Tagdiwala on 20-02-2013 01:53:56 PM
    Hello!

    I am new to CUCM development. I used the sample code for getPhone and customized it further to execute other APIs using the AXL Web Service WSDL. However, I have been unable to find a way to execute direct SQL queries using the AXL interface.

    Is there some sample code someone can share that demonstrates the wiring of API methods to execute direct SQL queries using AXL?

    Thanks and regards,
    Komal

    Subject: RE: Sample java code to execute SQL queries using AXL
    Replied by: David Staudt on 20-02-2013 02:55:04 PM
    The AXL SQL Toolkit (downloaded from the UCM admin UI - also includes the AXL schema files) includes a very basic java example of using the <executeSqlQuery> request.  Note that since the XML that comes back from an <executeSqlQuery> request depends entirely on the contents of the SQL and the data returned, that there is no applicable schema for the result.  Typically this means that you can't use WSDL frameworks like AXIS/.NET which generate code based on SOAP schema.
    Below is a simple request that queries the 'processnode' table in UCM, which holds a list of all the UCM cluster member nodes.  Details on UCM tables, fields and relationships can be found in the 'Data Dictionary' documents:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
       <soapenv:Header/>
       <soapenv:Body>
          <ns:executeSQLQuery sequence="1">
             <sql>select * from processnode</sql>
          </ns:executeSQLQuery>
       </soapenv:Body>
    </soapenv:Envelope>
    ------------------------------------
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
          <ns:executeSQLQueryResponse xmlns:ns="http://www.cisco.com/AXL/API/8.5">
             <return>
                <row>
                   <pkid>00000000-1111-0000-0000-000000000000</pkid>
                   <name>EnterpriseWideData</name>
                   <mac/>
                   <systemnode>t</systemnode>
                   <description/>
                   <isactive>t</isactive>
                   <nodeid>1</nodeid>
                   <tknodeusage>1</tknodeusage>
                   <ipv6name/>
                </row>
                <row>
                   <pkid>854a8c28-dae6-42fd-93fb-46edc2b5f2aa</pkid>
                   <name>10.88.131.141</name>
                   <mac/>
                   <systemnode>f</systemnode>
                   <description/>
                   <isactive>t</isactive>
                   <nodeid>2</nodeid>
                   <tknodeusage>0</tknodeusage>
                   <ipv6name/>
                </row>
                <row>
                   <pkid>b534935e-d765-c25e-096c-509eb9b96b37</pkid>
                   <name>10.88.131.146</name>
                   <mac>000c292b3ba2</mac>
                   <systemnode>f</systemnode>
                   <description>UCM851sub</description>
                   <isactive>t</isactive>
                   <nodeid>3</nodeid>
                   <tknodeusage>1</tknodeusage>
                   <ipv6name/>
                </row>
             </return>
          </ns:executeSQLQueryResponse>
       </soapenv:Body>
    </soapenv:Envelope>