ExecuteSqlQeury no response from server

Version 1
    This document was generated from CDN thread

    Created by: Prem Yadav on 05-01-2009 05:58:36 AM
    Hi,
    I am trying a simple query in the ExceuteSqlQuery API. The request is sent without any errors, but I am not getting any response from the server. The request XML is

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <axlapi:executeSQLQuery sequence="1" xmlns:axlapi="http://www.cisco.com/AXL/6.0" xsi:schemaLocation="http://www.cisco.com/AXL/1.0 http://10.71.152.77/schema/axlsoap.xsd"
    <sql>select * from endusers</sql></axlapi:executeSQLQuery>
    </SOAP-ENV:Body> </SOAP-ENV:Envelope>

    Is it the correct way or am I doing something wrong?

    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 05-01-2009 08:28:05 AM
    I tried to post the XML using the code as provided in the sample:

    X509TrustManager xtm = mj.new MyTrustManager();
    TrustManager[] mytm = { xtm };
    SSLContext ctx = SSLContext.getInstance("SSL");
    ctx.init(null, mytm, null);
    SSLSocketFactory sslFact = (SSLSocketFactory) ctx
    .getSocketFactory();
    socket = (SSLSocket) sslFact.createSocket("10.71.152.77", Integer.parseInt("8443"));

    in = socket.getInputStream();

    and now I am getting the exception

    java.security.cert.CertificateException: Untrusted Server Certificate Chain

    How to resolve this problem?
    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Stephan Steiner on 05-01-2009 10:10:05 AM
    Phew, you're operating on a socket level? And I thought I was low level by doing things manually with HTTPSURLConnection. I'm using the following initialization method to ensure that my code accepts any certificate from the CCM.

    public void init() throws InitializationException
    {
    X509TrustManager xtm = new MyTrustManager();
    TrustManager[] mytm = { xtm };
    SSLContext ctx;
    try
    {
    ctx = SSLContext.getInstance("SSL");
    ctx.init(null, mytm, null);
    SSLSocketFactory sf = ctx.getSocketFactory();
    HttpsURLConnection.setDefaultSSLSocketFactory(sf);
    HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
    {
    public boolean verify(String hostname, SSLSession session)
    {
    return true;
    }
    }
    );
    }
    catch (NoSuchAlgorithmException ex)
    {
    throw new InitializationException("SSL Algorithm not found: " + ex.getMessage());
    }
    catch (KeyManagementException ex)
    {
    throw new InitializationException("Key management exception: " + ex.getMessage());
    }
    }

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 05-01-2009 12:09:29 PM
    Hi,
    I finally managed to get the response from the server. But in the response I am getting "The requested resource(CCMApi/AXL/V1/soapisapi.dll) is not available.

    Any clues?

    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 05-01-2009 12:51:38 PM
    I am using the correct URL for posting the xml:
    sAXLSOAPRequest = "POST /axl/ HTTP/1.0\r\n";
    sAXLSOAPRequest += "Host:<ip-address of server>:8443\r\n";

    but I am getting the HTTP /1.1 moved temporarily error.
    How to solve this problem? I think I have followed the guide step by step.
    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: David Staudt on 05-01-2009 09:27:13 PM
    Can you post the the complete set of headers, or ideally the actual bytes of the full request? Can you confirm your transport mechanism is sending the request to the correct port?

    This FAQ may help: http://developer.cisco.com/web/axl/wikidocs?src=/wiki/display/AXL/how-to_telnet

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 06-01-2009 01:14:41 AM
    Hi David,
    The header looks like this:

    POST /axl/ HTTP/1.1
    Host: 10.71.152.77:8443
    Authorization: Basic Q0NNQWRtaW5pc3RyYXRvcjpub3RjMXNjMA==
    Accept: text/*
    Content-type: text/xml
    SOAPAction: "CUCMB ver=6.1"
    Content-length: 574

    I think I am sending the request to the correct port.
    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: David Staudt on 06-01-2009 04:23:26 AM
    That looks correct from a content perspective. It seems like perhaps your transport mechanism isn't sending the request to the correct port..?

    What is the full text of the HTTP response?

    Checking the Tomcat trace logs may show something interesting...

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 06-01-2009 05:03:14 AM
    Hi David,
    The full response text is:

    HTTP/1.1 302 Moved Temporarily
    Server: Apache-Coyote/1.1
    Location: https://10.71.152.77:8443/axl/
    Content-Length: 0
    Date: Tue, 06 Jan 2009 04:56:11 GMT

    what logs do you want me to check?
    Tomcat security logs?

    Regards,
    Pre,

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 06-01-2009 05:08:06 AM
    Will post the correct logs

    Edited by: Prem Yadav on 06-Jan-2009 00:14

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 06-01-2009 09:45:48 AM
    Hi David,
    Thanks for the help.
    I have finally managed to get the correct results.
    But the response is a little slow compared to when I use the AXL viewer. Is there anyway I can get faster response?
    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: David Staudt on 06-01-2009 03:40:20 PM
    AXL isn't particularly speedy...you can check the AXL service logs for the request/response timestamps to see how long the service takes to actually process. Other than checking the CUCM server's performance for any CPU/memory anomalies, there isn't much that can effect the server side response time.

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: Prem Yadav on 06-01-2009 04:07:41 PM
    Thanks David,
    I guess I can't do much about the speed. Now if you could have a look at my query in the CUAE developer's forum.
    The huge time difference is killing me. Its 1 a.m here and I have been waiting for answers.

    Regards,
    Prem

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: EDWARD BROWN on 08-01-2009 02:39:25 AM
    Pram, it looks like you have the table name incorrect, from the data dictionary the table name is enduser. ALso, you reference an IP from the schema which looks incorrect. Here is an example of a get for a NTP reference:

    Request

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><axlapi:executeSQLQuery sequence="1" xmlns:axl="http://www.cisco.com/AXL/API/6.1" xmlns:axlapi="http://www.cisco.com/AXL/API/6.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cisco.com/AXL/API/6.1 axlsoap.xsd"><sql>select pkid, name from ntpserver where name='10.1.70.1'</sql></axlapi:executeSQLQuery></SOAP-ENV:Body></SOAP-ENV:Envelope>

    Response

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:executeSQLQueryResponse xmlns:axl="http://www.cisco.com/AXL/API/6.1" xmlns:xsi="http://www.cisco.com/AXL/API/6.1" sequence="1"><return><row><pkid>f9a501bb-1feb-dced-56a5-189926bd5e9d</pkid><name>10.1.70.1</name></row></return></axl:executeSQLQueryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

    Hope this helps.

    Subject: Re: ExecuteSqlQeury no response from server
    Replied by: EDWARD BROWN on 08-01-2009 02:44:52 AM
    Prem, it looks like you have the table name incorrect, from the data dictionary the table name is enduser. ALso, you reference an IP from the schema which looks incorrect. Here is an example of a get for a NTP reference:

    Request

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><axlapi:executeSQLQuery sequence="1" xmlns:axl="http://www.cisco.com/AXL/API/6.1" xmlns:axlapi="http://www.cisco.com/AXL/API/6.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cisco.com/AXL/API/6.1 axlsoap.xsd"><sql>select pkid, name from ntpserver where name='10.1.70.1'</sql></axlapi:executeSQLQuery></SOAP-ENV:Body></SOAP-ENV:Envelope>

    Response

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><axl:executeSQLQueryResponse xmlns:axl="http://www.cisco.com/AXL/API/6.1" xmlns:xsi="http://www.cisco.com/AXL/API/6.1" sequence="1"><return><row><pkid>f9a501bb-1feb-dced-56a5-189926bd5e9d</pkid><name>10.1.70.1</name></row></return></axl:executeSQLQueryResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

    Hope this