Author Topic: Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects  (Read 6128 times)

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects
« on: January 14, 2009, 03:53:34 AM »
Hey Guys

Moving from 7.5 to 7.6.2 the 'RetrieveMultipleObjects' now stops the application from running.

It just sits there and returns no objects.

Is there anything I'm missing? I haven't changed the RetrieveMultipleObjects code in my app.

EDIT: As a note, all the other code works fine. RetreiveObject<> works fine.

Thanks
« Last Edit: January 14, 2009, 04:08:33 AM by skoom »

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
Re: Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects
« Reply #1 on: January 14, 2009, 06:49:54 AM »
The issue was I didn't have the EventBrokerService object.

Adding this object it all worked fine.

Thanks!

Offline mhsrinivasan

  • Newbie
  • *
  • Posts: 21
  • Karma: 1
Re: Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects
« Reply #2 on: March 31, 2009, 02:03:25 PM »
Hey Skoom,

I'm getting the same issue. Can you explain how you resolved  it in detail?

Where you have added the EventBrokerService object?
Ive added the EventBrokerService and Registered the ConfService Object.
When retrieving DNs, i'm getting an exception stating FolderDBIds is null
Still, RetrieveMultipleObjects in not working.

Can you give a sample code for it to work?
« Last Edit: March 31, 2009, 04:01:16 PM by mhsrinivasan »

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
Re: Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects
« Reply #3 on: April 01, 2009, 04:25:56 AM »
This works for me... This is some code I've started working on, at the moment it only gets all DNs for a switch.

public class GenCfg : IDisposable {
private ConfService cServ;
private ConfServerProtocol cProt;
private EventBrokerService ebs;

public GenCfg(string genServer, int genPort, string appName, string user, string pass) {
this.cProt = new ConfServerProtocol(new Endpoint("CRGM",genServer,genPort));
this.cProt.ClientName = appName;
this.cProt.UserName = user;
this.cProt.UserPassword = pass;
this.cProt.Open();

this.ebs = new EventBrokerService(this.cProt);
this.ebs.Activate();

this.cServ = ConfServiceFactory.CreateConfService(this.cProt);
this.ebs.Register(this.cServ);


}

public Collection<CfgDN> GetAllDNs(string switchName) {
CfgSwitchQuery sq = new CfgSwitchQuery();
sq.Name = switchName;
CfgSwitch sw = this.cServ.RetrieveObject<CfgSwitch>(sq);

if (sw == null) { throw new Exception("Switch not found"); }

CfgDNQuery dq = new CfgDNQuery();
dq.DnType = CfgDNType.CFGACDPosition;
dq.State = CfgObjectState.CFGEnabled;
dq.SwitchDbid = sw.DBID;

return this.cServ.RetrieveMultipleObjects<CfgDN>(dq);
}

public void Close() {
if (this.cProt != null) { this.cProt.Close(); }
this.cProt = null;
this.cServ = null;
this.ebs = null;
}
public void Dispose() {
this.Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing) {
if(disposing) {
this.Close();
}

}


}

Offline mhsrinivasan

  • Newbie
  • *
  • Posts: 21
  • Karma: 1
Re: Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects
« Reply #4 on: April 01, 2009, 12:38:36 PM »
[color=red][/color]I'm getting an exception stating the FolderDbid is null in the GlobalConfService.cs in COM AB. I've changed the code in that (marked as Red)
internal static void EndLoadObject(IAsyncResult asyncResult )
        {
            ConfAsyncResult result = asyncResult as ConfAsyncResult;

            if (result == null) return;

            List<IMessage> messageList = result.MessageList;
            InternalCfgObjectData objData;

            foreach (IMessage response in messageList)
            {
                EventObjectsRead realResponse = response as EventObjectsRead;
               
                if (realResponse == null || realResponse.ConfObject == null)
                {
                    continue;
                }

                objData = new InternalCfgObjectData();
                objData.ObjectType = (ConfServerObjectType) realResponse.ObjectType;
                objData.ConfigurationObject =
                    realResponse.ConfObject as XmlDocument;

                Array foldersDbids = realResponse.FolderDbids;
                int objectsCount = objData.ConfigurationObject.DocumentElement.ChildNodes.Count;

                [color=red]if (foldersDbids != null)
                {[/color]
                    if (foldersDbids.GetLength(0) < objectsCount)
                        throw new InvalidOperationException("There are not enough folder dbids in the Read request result");
                [color=red]}[/color]
                objData.ObjectPaths = realResponse.ObjectPath as string;

                if (objData.ObjectPaths.Length < objectsCount)
                    throw new InvalidOperationException("There are not enough object paths in the Read request result");

                objData.Parameters = new KeyValueCollection[objectsCount];

                for (int i = 0; i < objectsCount; i++)
                {
                    objData.Parameters[i] = new KeyValueCollection();
                  [color=red] if (foldersDbids != null)
                    {[/color]
                        objData.Parameters[i].Add(MiscConstants.FolderDbidName, Convert.ToInt32(foldersDbids.GetValue(i)));
                    [color=red]}[/color]
                }

                result.ConfigObjectList.Add(objData);
            }
        }

Now it is working fine, whether the code will break in the future?

Offline rajee

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Platform SDK 7.5 > 7.6.2: COM's RetrieveMultipleObjects
« Reply #5 on: March 31, 2010, 12:11:36 PM »
Thnx a ton  :D

Your solution was fruitful for my 2 hrs of search in all documents and Genesys Discussion Forum. Finally sggu helped!!!!!