Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

AXL Services Always Return Null in C#.NET

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.


Re: AXL Services Always Return Null in C#.NET

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.

New Member

Re: AXL Services Always Return Null in C#.NET

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 = "myuserid";

string Sequence = "1";

AXLRequest = "\" xmlns:xsi=\"\" xmlns:xsd=\"\"> ";

AXLRequest += " ";

AXLRequest += "<>\" xsi:schemaLocation=\" 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);


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.

Re: AXL Services Always Return Null in C#.NET

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 = "\" xmlns:xsi=\"\" xmlns:xsd=\"\">\n";

soaprequest += "\n";

soaprequest += "<>\" xsi:schemaLocation=\"\" 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.setRequestProperty("Content-Type", "text/xml");

conn.setRequestProperty("Content-Length", "" + soaprequest.length());

conn.setRequestProperty("Authorization", "Basic " + this.authentication);



PrintWriter pout = new PrintWriter(new OutputStreamWriter(conn.getOutputStream()), true);



int status = conn.getResponseCode();

if (status >= 400) // we have an error (30x should be handled since we set followredirect)

New Member

Re: AXL Services Always Return Null in C#.NET

(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.


Re: AXL Services Always Return Null in C#.NET

Add this line before creating HttpWebRequest:

ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };




New Member

Re: AXL Services Always Return Null in C#.NET

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.