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

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

For an introduction to the new site, click here. And see here for current known issues.

New Member

RisPort 401 Unauthorized

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>

9 REPLIES

Re: RisPort 401 Unauthorized

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.

New Member

Re: RisPort 401 Unauthorized

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.

Re: RisPort 401 Unauthorized

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.

New Member

Re: RisPort 401 Unauthorized

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

New Member

Re: RisPort 401 Unauthorized

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

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">

1234-abcd-1234-abcd

http://schemas.xmlsoap.org/soap/encoding/">

1000

Any

255

Any

Name

SEP0017954A37F0

New Member

Re: RisPort 401 Unauthorized

And here is the response.

http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">soapenv:Server.userExceptionjava.lang.IllegalArgumentException: argument type mismatchhttp://xml.apache.org/axis/">java.lang.IllegalArgumentException: argument type mismatch

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

...

http://xml.apache.org/axis/">pccmpuba1.occvoip.theocc.comhttp://xml.apache.org/axis/">true

Re: RisPort 401 Unauthorized

Hi 4mcohen,

do you have any decision on this problem, because I also have to deal with it some how?

Best regards.

New Member

Re: RisPort 401 Unauthorized

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 GetDeviceIP(List devicenames)

{

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 deviceresult = new 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;

}

Re: RisPort 401 Unauthorized

10x 4mcohen,

I've decided the problem too, but in some other way. Here I am posting the code for it. Hope it helps someone as developing on cisco can be a tricky situation.

505
Views
0
Helpful
9
Replies