cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

C# PerfmonPort web service client (with CUCM 6.1.3)

764
Views
0
Helpful
0
Comments
This document was generated from CDN thread

Created by: Indrajit Chakrabarty on 24-05-2010 03:16:11 AM
I am trying to create a C#/.NET client with the PerfmonPort webservice. 

1. Downloaded the WSDL from https://192.168.2.10/perfmonservice/services/PerfmonPort?wsdl
2. Used wsdl.exe to generate the client C# code, this showed a number of
warnings -
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright
(C) Microsoft Corporation. All rights reserved. Warning: This web reference does not conform to WS-I Basic Profile v1.1.
R2706: A wsdl:binding in a DESCRIPTION MUST use the value of "literal" for the use attribute in all soapbind:body, soapbind:fault, soapbind:header and
soapbind: headerfault elements.
  -  Input element soapbind:body
of operation 'PerfmonOpenSession' on portType 'PerfmonBinding' from
namespace 'http://schemas.cisco.com/ast/soap/'.
  -  Output element
soapbind:body of operation 'PerfmonOpenSession' on
portType'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonAddCounter' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation 'PerfmonAddCounter' on
portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonRemoveCounter' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation 'PerfmonRemoveCounter' on
portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonCollectSessionData' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation
'PerfmonCollectSessionData' on portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonCloseSession' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation 'PerfmonCloseSession' on
portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonListInstance' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation 'PerfmonListInstance' on
portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonQueryCounterDescription' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation
'PerfmonQueryCounterDescription' on portType 'PerfmonBinding' from
namespace 'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonListCounter' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation 'PerfmonListCounter' on
portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.
  -  Input element
soapbind:body of operation 'PerfmonCollectCounterData' on portType
'PerfmonBinding' from namespace 'http://schemas.cisco.com/ast/soap/'.
 
-  Output element soapbind:body of operation
'PerfmonCollectCounterData' on portType 'PerfmonBinding' from namespace
'http://schemas.cisco.com/ast/soap/'.

For more details on the WS-I Basic Profile v1.1, see the specification at http://www.ws-i.org/Profiles/BasicProfile-1.1.html.
 
3. If I try to use the AstService client (after making modifications to the client code as per the CUCM
XML Developers Guide) to invoke the PerfmonOpenSession method, I run into this exception -
 
There is an error in XML document (1, 475)
Cannot assign object of type System.Xml.XmlNode[] to an object
of type System.String at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader,
String encodingStyle, XmlDeserializationEvents events)
 
I am using VS2008 Professional with SP1, here is the snippet of code that fails -
 
AstService perfmonService = new AstService("192.168.2.10", "admin", "ccm61bc");
string sessionId = perfmonService.PerfmonOpenSession();
var result = perfmonService.PerfmonListCounter("192.168.2.10");
 
In the second try, I used the 'Add Service Reference' in VS2008 and tried to run this code -
                
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
                 
WebServices.PerfmonPortTypeClient perfmonClient = new
HuntGroupReporter.Core.WebServices.PerfmonPortTypeClient();
                 
perfmonClient.ClientCredentials.UserName.UserName = "admin";
                 
perfmonClient.ClientCredentials.UserName.Password = "ccm613u";
                 
perfmonClient.Endpoint.Address = new
System.ServiceModel.EndpointAddress("http://192.168.2.10/perfmonservice/services/PerfmonPort");
                 
perfmonClient.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
                 
string sessionId = perfmonClient.PerfmonOpenSession();

This call
fails with a security exception. I am sure it is a WCF client configuration issue.
 
I would really appreciate if you anyone can help me get a simple C#/.NET client working with the CUCM 6.1.3 with the SOAP client code generated through wsdl.exe. Are there any .NET samples for PerfmonPort?
 
Many thanks.
indy

Subject: RE: C# PerfmonPort web service client (with CUCM 6.1.3)
Replied by: Indrajit Chakrabarty on 24-05-2010 09:29:38 AM
I used the SOAP Monitor service to trace the SOAP request on the CUCM server. I am using this piece of code -
 
                  AstService perfmonService = new AstService("192.168.2.10", "admin", "ccm61bc");
                  string sessionId = perfmonService.PerfmonOpenSession();
 
The SOAP Request is -
 
<?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:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <tnserfmonOpenSession/>
   </soap:Body>
</soap:Envelope>
 
and the response for the above SOAP request is -
 
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1erfmonOpenSessionResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
              xmlns:ns1="http://schemas.cisco.com/ast/soap/">
           <SessionHandle xsi:type="ns1:SessionHandleType">563475f8-0000-1000-8000-000000000000</SessionHandle>
      </ns1erfmonOpenSessionResponse>
   </soapenv:Body>
</soapenv:Envelope>
 
The exception I see in the client is perhaps a .NET-specific issue (Exception - There is an error in XML document (1, 475). "Cannot assign object of type System.Xml.XmlNode[] to an object of type System.String.").
 
I shall really appreciate if anyone can point me to the right direction.
 
Thank you
indy
 

Subject: RE: C# PerfmonPort web service client (with CUCM 6.1.3)
Replied by: Giggesh Thekkekeloth on 08-06-2010 05:29:47 AM
Thanks for raising the SR-614492961
http://wwwin-tools.cisco.com/casekwery/getServiceRequest.do?id=614492961
for this issues.
To summerize the issue:
We understood that the CUCM XML Developers Guide 6.x/7.x/8.x to generate C#/.NET SOAP web service clients
for the AXL/SOAP and PerfmonPort web service interfaces for their CUCM. With the generated C# source you were
able to query CUCM 'AXL interface and execute the web methods available in the AXL WSDL. But faced problem
using the 'PerfmonPort' C# client.
 
So,
later later with the Service Request 614492961 we learnt that "This is an issue with C# or .net not compatible with
wsdl spec 1.1, Perfmonport  web service works well with other clients and we do not have fix for this until we move
to wsdl 2 convention. Yes, we can document that we are using the wsdl1.1 spec for serviceability xml." Following
which a defect -CDETS: http://cdets.cisco.com/apps/goto?identifier=CSCth13311 has been raised to correct API
document, which is under work.
CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards