10-02-2007 05:52 AM - edited 03-13-2019 04:28 PM
Hi, i'm trying to get the device ip using the risport... so i use the wsdl to make a webreference in VS2005 c# ... here is my code...
CiscoRis.DeviceQueryService ris = new CiscoRis.DeviceQueryService();
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
ris.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap11;
ServicePointManager.Expect100Continue = false;
ris.Credentials = new NetworkCredential("Administrator", "pass");
ris.Url = "https://CMIP:8443/realtimeservice/services/RisPort";
CmSelectionCriteria filter = new CmSelectionCriteria();
filter.MaxReturnedDevices = uint.MaxValue;
filter.Class = DeviceClass.Phone;
filter.Model = 255; //any model
string stateInfo = null; //execution summary
SelectCmDeviceResult result = ris.SelectCmDevice(ref stateInfo, filter);
CmNode[] nodes = result.CmNodes;
CmDevice[] devices = nodes[0].CmDevices;
foreach (CmDevice device in devices)
{
Response.Write(device.IpAddress + Environment.NewLine);
Response.Write("");
}
but when i execute i'm get this error:
java.lang.IllegalArgumentException: argument type mismatch
If someone know why i'm having this problem please let me know... Thanks!
10-03-2007 02:29 AM
Try using this as filter:
CmSelectionCriteria filter = new CmSelectionCriteria();
filter.MaxReturnedDevices = uint.MaxValue;
filter.Class = "Phone";
filter.Model = 255; //any model
filter.SelectBy = "Name";
10-03-2007 03:50 AM
Hi, thanks for you response!
I try to change but the error still the same...
10-03-2007 04:00 AM
hmmm... this is the full code I use:
ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
ServicePointManager.Expect100Continue = false;
RISService ris = new RISService();
ris.Credentials = new NetworkCredential(ccmAdmin, ccmPass);
ris.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap11;
ris.Url = "https://" + ccmIp + ":8443/realtimeservice/services/RisPort";
CmSelectionCriteria filter = new CmSelectionCriteria();
filter.MaxReturnedDevices = uint.MaxValue;
filter.Class = "Phone";
filter.Model = 255; //any model
filter.SelectBy = "Name";
string stateInfo = null; //execution summary
SelectCmDeviceResult tmpResult = ris.SelectCmDevice(ref stateInfo, filter);
public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
{
public TrustAllCertificatePolicy() { }
public bool CheckValidationResult(ServicePoint sp,
X509Certificate cert,
WebRequest req,
int problem)
{
return true;
}
}
10-03-2007 06:42 AM
I try to use your code but i coundn't i this was because my webreference was made in a CM 4.2.. because when i try to make a webreference in a CM 5.1 i get this error..
There was an error downloading 'https://172.16.200.202:8443/realtimeservice/services/RisPort?WSDL'.
The underlying connection was closed: An unexpected error occurred on a receive.
m_safeCertContext is an invalid handle.
there is a chance to you send to me an empty project only with the webreference?
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