" /> help in parsing conf server datas - Genesys CTI User Forum

Author Topic: help in parsing conf server datas  (Read 2148 times)

Offline ghoo

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
help in parsing conf server datas
« on: December 12, 2016, 11:38:48 AM »
Advertisement
Hello Everybody,
I am sorry for posting something that is perhaps stupid but I am new with genesys SDK (and in fact c# - I am coming from cisco call manager world and I have been working with php and python mostly) and I have a big problem.

I have the following code to ask some config to genesys conf server.

This is working but I get crazy to extract result datas.

If I would like to get, for example,  the "lastname" of all returning objects, does someone knows what I should do or have a link with some examples of something that is working ?

Thanks in advance and happy new year  :D

[b]CODE THAT GIVE A RESULT[/b]
[color=maroon] 
            PropertyConfiguration config = new PropertyConfiguration();

            ConfServerProtocol protocol =
                new ConfServerProtocol(new Endpoint("default", "10.32.1.11", 2020));
            protocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
            protocol.ClientName=("aaa");
            protocol.UserName="aaa";
            protocol.UserPassword=("aaa");
            protocol.Open();

            RequestReadObjects2 requestXpathQuery =
                RequestReadObjects2.Create(
                    (int)CfgObjectType.CFGPerson,
                    "CfgPerson[@emailAddress='*com' and firstName='*']");

            protocol.Send(requestXpathQuery);

            //remove this to be non blocking

            IMessage respondingEvent =
                protocol.Receive();
            Console.WriteLine("[We got something]");[/color]

          [color=red] Console.WriteLine("** test 0 **");
            foreach (var x in objectsRead.ConfObject.Elements())
            {
                Console.WriteLine(">#test0#"+x);
            }
[/color]


[b]WHAT I GOT[/b] :

** test 0 **
>#test0#<ConfData xmlns="http://schemas.genesyslab.com/Protocols/Configuration/ConfServer/2005/">
  <CfgPerson>
    <DBID value="104" />
    <tenantDBID value="101" />
    <lastName value="John" />
    <firstName value="John" />
    <employeeID value="jjbb" />
    <userName value="John" />
    <password value="EFC68988B983D23CE443EA2DD923546A53CE6841A84E833E0408951B5938EC7F" />
    <isAgent value="2" />
    <CfgAgentInfo>
      <placeDBID value="0" />
      <capacityRuleDBID value="0" />
      <siteDBID value="0" />
      <contractDBID value="0" />
    </CfgAgentInfo>
    <isAdmin value="1" />
    <state value="1" />
    <emailAddress value="johnbongout@gmail.com" />
    <isExternalAuth value="1" />
    <changePasswordOnNextLogin value="0" />
    <passwordHashAlgorithm value="1" />
    <PasswordUpdatingDate value="1480517309" />
  </CfgPerson>
  <CfgPerson>
    <DBID value="105" />
    <tenantDBID value="101" />
    <lastName value="Smith" />
    <firstName value="Smith" />
    <employeeID value="Smith" />
    <userName value="Smith" />
    <password value="92676370EA2AE7EA0B10B6D466C40FBFD4D8D5195A83713B543EF581DCC94EF5" />
    <isAgent value="2" />
    <CfgAgentInfo>
      <placeDBID value="0" />
      <capacityRuleDBID value="0" />
      <siteDBID value="0" />
      <contractDBID value="0" />
    </CfgAgentInfo>
    <isAdmin value="1" />
    <state value="1" />
    <emailAddress value="smith@gmail.com" />
    <isExternalAuth value="1" />
    <changePasswordOnNextLogin value="0" />
    <passwordHashAlgorithm value="1" />
    <PasswordUpdatingDate value="1481528085" />
  </CfgPerson>
</ConfData>


Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: help in parsing conf server datas
« Reply #1 on: December 12, 2016, 12:00:19 PM »
Hi,

What are you doing is sending a request to the conf server, and receiving XML response. Inside tags of XML you have whatever you want. You must read innerXml to see the data.

If you are not used to work with xml and you donīt want to parse it...

Try to use config services...  IConfService service = ConfServiceFactory.CreateConfService(protocol);

Regards.