03-25-2008 01:56 PM - edited 03-13-2019 05:06 PM
I downloaded the AXL SQL Toolkit, and I am always getting a null result set. Below is my C#.NET code:
AXLAPIService axl = new AXLAPIService("ipaddress", "user", "password");
ExecuteSQLQueryReq request = new ExecuteSQLQueryReq();
ExecuteSQLQueryRes result = new ExecuteSQLQueryRes();
request.sql = "SELECT * FROM Device ";
result = axl.executeSQLQuery(request);
I also get a null result when calling any other AXL service, such as GetUser.
I have tried using BruteForcePolicy and Expect100Continue = false as well, but I still get a null result. I know that my user and password are authenticating okay, and I know that my request is being "understood", because I get an exception if my SQL statement is incorrect, for example.
03-28-2008 06:16 AM
sounds like yet another problem with the manually hacked wsdl file - however, have you tried
"SELECT * FROM device"? None of the table names use capital letters, and it's a linux box so it's case sensitive.
03-28-2008 07:03 AM
Yes, I am using the hacked wsdl file, if by that you mean having made the various changes specified in the readme file. That's a good point about it being a linux box, but I tried the select statement above and got the same result.
I have also tried doing an XML push instead of using the proxy class, and over 99% of the time I have gotten a 401 - Unauthorized message doing that -- however, for a very brief window yesterday (perhaps 3-5 requests over just a few minutes) I actually got some results back that I could clearly see in Visual Studio. Here's the code:
string AXLRequest;
string type = "getUser";
string param = "
string Sequence = "1";
AXLRequest = "
AXLRequest += "
";AXLRequest += "<>http://www.cisco.com/AXL/API/1.0\" xsi:schemaLocation=\"http://www.cisco.com/AXL/1.0 https://myip/schema/axlsoap.xsd\" sequence=\"" + Sequence + "\"> ";>
AXLRequest += param + " ";
AXLRequest += " ";
AXLRequest += " ";
AXLRequest += " ";
ServicePointManager.Expect100Continue = false;
String strUriHttps = @"https://myip:8443/axl";
HttpWebRequest oWRequest = (HttpWebRequest)HttpWebRequest.Create(new Uri(strUriHttps));
oWRequest.Method = "POST";
oWRequest.ContentType = "text/xml";
String AXLHeader = null;
String Auth = "myaxluser" + ":" + "password";
Auth = Convert.ToBase64String(Encoding.ASCII.GetBytes(Auth));
AXLHeader = "POST /axl/ HTTP/1.0\r\n";
AXLHeader += "Host:myip:8443\r\n";
AXLHeader += "Authorization: Basic " + Auth + "\r\n";
AXLHeader += "Accept: text/*\r\n";
AXLHeader += "Content-type: text/xml\r\n";
AXLHeader += "SOAPAction: \"CUCM:DB ver=6.0\"\r\n";
AXLHeader += "Content-length: " + AXLRequest.Length.ToString() + "\r\n\r\n";
AXLHeader += AXLRequest;
Stream stream = oWRequest.GetRequestStream();
stream.Write(System.Text.Encoding.ASCII.GetBytes(AXLHeader), 0, AXLHeader.Length);
stream.Close();
HttpWebResponse oWResponse = (HttpWebResponse)oWRequest.GetResponse();
Stream recStream = oWResponse.GetResponseStream();
StreamReader readStream = new StreamReader(recStream, Encoding.UTF8);
String rep = readStream.ReadToEnd();
I know about appending the equal signs to the password for authentication and that hasn't made a difference, but I'm curious as to how the same code appeared to work for a very brief window.
03-28-2008 10:15 AM
Umm.. is it just me or are you only sending the AXLHeader to the callmanager?
And I'm not sure you need all those headers.. my colleague is currently adapting our connector class to ccm 6.1.1 and we did a few test runs, still using the same old code as in ccm 4.1.3 to send an AXL request. It's java, but it's easy enough to switch to C#:
String soaprequest = "
soaprequest += "
\n";soaprequest += "<>http://www.cisco.com/AXL/1.0\" xsi:schemaLocation=\"http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd\" xsi:type=\"XRequest\" sequence=\"1234\">\n";>
soaprequest += axlParams + "\n";
soaprequest += "\n";
soaprequest += "\n";
soaprequest += "";
tracer.Trace("AXL Request: " + axlRequest + "Parameters:\r\n" + axlParams, 5);
URL url = new URL(this.apiPath);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "text/xml");
conn.setRequestProperty("Content-Length", "" + soaprequest.length());
conn.setRequestProperty("Authorization", "Basic " + this.authentication);
conn.setFollowRedirects(true);
conn.connect();
PrintWriter pout = new PrintWriter(new OutputStreamWriter(conn.getOutputStream()), true);
pout.print(soaprequest);
pout.flush();
int status = conn.getResponseCode();
if (status >= 400) // we have an error (30x should be handled since we set followredirect)
04-07-2008 05:52 AM
(To answer your question, both the header and the request are getting sent. The AXLRequest variable gets concatenated to the AXLHeader variable.)
Thanks for the Java sample. Fyi, when I go to http://myip/axl in the browser, I get a certificate error. We then downloaded the certificate and installed it using keytool, but we are getting various errors related to the certificate that's preventing the SOAP request from going through.
04-07-2008 06:39 AM
Add this line before creating HttpWebRequest:
ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };
--
regards,
PK
04-08-2008 06:06 AM
Thanks--I added that line, and I got the same results as described in my second post. I was able to get results successfully at first, but after about 10 requests or so, I got a 401 - Unauthorized error repeatedly after that. Today I am strictly getting the 401. The results are extremely random.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide