08-28-2008 11:26 AM - edited 03-13-2019 05:36 PM
I'm trying to execute a SelectCmDevice RisPort query and am only receiving a 401 error from the Callmanager 6.1 box. My problem is that I'm using the same credentials that work successfully when doing an AXL executeSQLQuery. Below is a copy of my HTTP and XML data. Any help would be greatly appreciated.
POST /realtimeservice/services/RisPort HTTP/1.1
Authorization: Basic xxxx=
Host:x.x.x.x:8443
Accept: text/*
Content-type: text/xml
Content-length: 1350
SOAPAction: "http://schemas.cisco.com/ast/soap/action/#RisPort#SelectCmDevice"
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://schemas.cisco.com/ast/soap/"
xmlns:types="http://schemas.cisco.com/ast/soap/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<tns:AstHeader id="id1">
<SessionId xsi:type="xsd:string">1234-abcd-1234-abcd</SessionId>
</tns:AstHeader>
</soap:Header>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:SelectCmDevice>
<StateInfo xsi:type="xsd:string"/>
<CmSelectionCriteria href="#id1"/>
</tns:SelectCmDevice>
<tns:CmSelectionCriteria id="id1" xsi:type="tns:CmSelectionCriteria">
<MaxReturnedDevices xsi:type="xsd:unsignedInt">1000</MaxReturnedDevices>
<Class xsi:type="tns:DeviceClass">Any</Class>
<Model xsi:type="xsd:unsignedInt">255</Model>
<Status xsi:type="xsd:string">Any</Status>
<NodeName xsi:type="xsd:string"/>
<SelectBy xsi:type="tns:CmSelectBy">Name</SelectBy>
<SelectItems href="#id2"/>
</tns:CmSelectionCriteria>
<soapenc:Array id="id2" soapenc:arrayType="tns:SelectItem[]">
<Item href="#id3"/>
</soapenc:Array>
<tns:SelectItem id="id3" xsi:type="tns:SelectItem">
<Item xsi:type="xsd:string">SEP0017954A37F0</Item></tns:SelectItem>
</soap:Body>
</soap:Envelope>
08-28-2008 10:42 PM
Your problem is the credentials (as the http error says)... AXL serviceability != AXL. In fact, Cisco completely circumvented the idea of granular access control and you need your user to be a member of the standard admin group in order to make axl serviceability queries (believe me I have tried and had a case open on this issue).
Alternatively you can just use the ccmadmin account.. it has the proper credentials.
08-29-2008 05:53 AM
I wish it were that simple. I am using the CCMAdministrator account. It works for AXL executeSQLQuery but not for the AXL serviceability query I am trying.
08-31-2008 11:59 PM
I'm not sure if it has anything to do with it.. but I never send requests to port 8443 but instead use the regular https port. I also never add the host and port to the query header.
I rechecked and my application user definitel has the Standard CCM Admin Users and that works both in my lab, and at a customer site where I use AXL serviceability.
09-02-2008 07:05 AM
Thanks for the response. I tried sending the requests directly to port 443 with no luck. I'm developing in Visual Studio using C#. I'm using HttpWebRequest which doesn't give me the option of removing host and port from the query header.
I did notice an issue with the Expect header. By default .NET uses "Expect: Continue-100" header and functionality with the HttpWebRequest method when using http 1.1. To change this I set the System.Net.ServicePointManager.Expect100Continue property to false. Now I'm getting a HTTP 500 error...
09-02-2008 11:06 AM
I ran the SOAPMonitor now that I'm getting the 500 error and the output shows "argument type mismatch". I assume this means that there is a problem with XML in my request. Here is the request output.
SOAP REQUEST
09-02-2008 11:09 AM
And here is the response.
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
...
10-10-2008 02:42 AM
Hi 4mcohen,
do you have any decision on this problem, because I also have to deal with it some how?
Best regards.
10-10-2008 05:53 AM
Actually I worked around it. I came to the conclusion that there was something wrong with the XML I was sending but I couldn't identify exactly what it was.
I'm using Visual Studio (C#) to develop in so instead of trying to create the XML myself I just created a Web Reference to the WSDL on the Callmanager server (https://CALLMANAGER:8443/realtimeservice/services/RisPort?wsdl). This will automatically generate a Reference.cs class that will be nested in the project namespace.
I then declared a "using NAMESPACE.WEBREFERENCENAME" and was able to use the objects that were generated in the Reference.cs class. This involved creating a new RISService object, defining this object's properties (Credentials, SoapVersion, and Url), and then I defined a new CmSelectionCriteria object and it's properties (MaxReturnedDevices, Class, Model,SelectBy, Status, and SelectItems[]). Then I created a SelectCmDeviceResult object using the previously created RISService object (inputing a string for state by ref and the CmSelectionCriteria object I previously created).
This in effect created all of the XML for me and did all of the work. Below is the actual code for the Reference.cs objects I used. I'm sure there are other ways to get this to work (including identifying what was wrong with my original XML query) but I hope this helps.
private Dictionary
{
ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
ServicePointManager.Expect100Continue = false;
RISService ris = new RISService();
ris.Credentials = new NetworkCredential(userID, password);
ris.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap11;
ris.Url = "https://" + CallManagerIP + "/realtimeservice/services/RisPort";
CmSelectionCriteria filter = new CmSelectionCriteria();
filter.MaxReturnedDevices = uint.MaxValue;
filter.Class = "Any";
filter.Model = 255; //any model
filter.SelectBy = "Name";
filter.Status = "Registered";
string[] devicenamesarray = devicenames.ToArray();
//SelectItem cmItem = new SelectItem();
//cmItem.Item = devicename;
SelectItem[] cmItems = new SelectItem[devicenamesarray.Length];
for (int i=0; i < devicenamesarray.Length; i++)
{
cmItems[i] = new SelectItem();
cmItems[i].Item = devicenamesarray[i];
}
filter.SelectItems = cmItems;
string stateInfo = null; //execution summary
SelectCmDeviceResult tmpResult = ris.SelectCmDevice(ref stateInfo, filter);
CmNode[] noderesults = tmpResult.CmNodes;
Dictionary
if (tmpResult.CmNodes != null)
{
foreach (CmNode checknode in noderesults)
{
if (checknode.ReturnCode == RisReturnCode.Ok)
{
foreach (CmDevice checknodedevice in checknode.CmDevices)
{
deviceresult.Add(checknodedevice.Name, checknodedevice.IpAddress);
}
}
}
}
return deviceresult;
}
10-13-2008 05:09 AM
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: