1
Vote

All calls after the 10th to ProvideAndRegisterDocumentSet fail when using any session (security, reliable session etc)

description

I found out that reason for this is that the connection to registry is not closed and 10 is the default value for maxium number of concurrent sessions.
 
I fixed this by closing the session as follows:
 
In DocumentRepository.cs
 
private XmlDocument ProcessProvideAndRegisterDocumentSet(....) {
...
 
//Message to be sent to Registry
                    try
                    {
                        //Sample RegistryResponse  - <RegistryResponse xmlns="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" />;                        
                        //Call the XDSRegistry Service
                        Message provideAndResgiterSetInput = null;
                        string xdsRegistryEndpointName = CommonUtility.GetXDSRegistryEndpointName();
                        xmlDocRegistryRequest = new XmlDocument();
                        nodeSubmitObjectsRequest = xmlDocRequest.SelectSingleNode(@"//*[local-name()='SubmitObjectsRequest']");
                        xmlDocRegistryRequest.LoadXml(nodeSubmitObjectsRequest.OuterXml);
                        XDSRegistry.XDSRegistryClient objRegsitryClient = new Microsoft.IHE.XDS.DocumentRepository.XDSRegistry.XDSRegistryClient(xdsRegistryEndpointName);
                        provideAndResgiterSetInput = Message.CreateMessage(msgVersion, GlobalValues.CONST_ACTION_REGISTERDOCUMENTSETB, new XmlNodeReader(xmlDocRegistryRequest));
                        registryMessage = objRegsitryClient.RegisterDocumentSet(provideAndResgiterSetInput);
=>FIX                objRegsitryClient.Close();
                    }
                    catch
                    {
                        throw new Exception("XDSRegistryNotAvailable");
                    }
....
}
 
I hope this helps somebody
 
-Arif

comments

Oganix wrote Feb 17, 2009 at 12:48 PM

Actually the registry call is in to places in the above method. Also of course it is better to put the close into the finally clause like
                XDSRegistry.XDSRegistryClient objRegistryClient = null;
                try
                {

                    //Sample RegistryResponse - <RegistryResponse xmlns="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" />;                        
                    //Call the XDSRegistry Service
                    Message msgProvideAndResgiterSetInput = null;
                    string xdsRegistryEndpointName = CommonUtility.GetXDSRegistryEndpointName();
                    xmlDocRegistryRequest = new XmlDocument();
                    nodeSubmitObjectsRequest = xmlDocRequest.SelectSingleNode(@"//*[local-name()='SubmitObjectsRequest']");
                    xmlDocRegistryRequest.LoadXml(nodeSubmitObjectsRequest.OuterXml);
                    objRegistryClient = new Microsoft.IHE.XDS.DocumentRepository.XDSRegistry.XDSRegistryClient(xdsRegistryEndpointName);
                    msgProvideAndResgiterSetInput = Message.CreateMessage(msgVersion, GlobalValues.CONST_ACTION_REGISTERDOCUMENTSETB, new XmlNodeReader(xmlDocRegistryRequest));
                    registryMessage = objRegistryClient.RegisterDocumentSet(msgProvideAndResgiterSetInput);
                }
                catch
                {
                    throw new Exception("XDSRegistryNotAvailable");
                }
                finally
                {
                    if (objRegistryClient != null)
                    {
                        objRegistryClient.Close();
                    }
                }

wrote Feb 14, 2013 at 6:17 PM