We have some config information we would like to store in softPro "somewhere". We have a custom package and would like to read and write some of params and config information for our package. The config information only has to be at a sytem level not a user level.
I remeber something about Registration Services in a demo but dont have a sample.
Got a simple sample how to-do that?
Thanks
David
Registration Services
-
- Posts: 411
- Joined: Thu Sep 11, 2008 11:35 am
- Location: Raleigh, NC, USA
- Contact:
Re: Registration Services
You need to register an xml file with the server. This xml file will contain your settings. Once this is done, our client APIs allow you read your settings as needed. Here are the steps to accomplish this:
1. Create an xml file that contains you settings. Here is a sample:
Make sure you generate a unique guid for the service id. You will need to know that service id when you attempt to retrieve the attribute value on the client side.
2. Register the xml file with the server using the sps.exe tool located in the server's installation folder. This is a command line tool. It is located at C:\Program Files (x86)\Common Files\SoftPro\Select Server\Instances\spssvr.
3. At this point, the server has the settings stored. In order to retrieve the values on the client side, you can use the SelectServer object and the Registration service to retrieve the settings. Like this:
1. Create an xml file that contains you settings. Here is a sample:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<Services xmlns="http://schemas.softprocorp.com/select/integration/registration/2008/04">
<Service name="MyCustomService" id="{insert-new-guid-here}">
<Endpoints />
<Events />
<Attributes>
<Attribute name="MySettingName" value="MySettingValueAsString" />
</Attributes>
</Service>
</Services>
2. Register the xml file with the server using the sps.exe tool located in the server's installation folder. This is a command line tool. It is located at C:\Program Files (x86)\Common Files\SoftPro\Select Server\Instances\spssvr.
Code: Select all
C:\Program Files (x86)\Common Files\SoftPro\Select Server\Instances\spssvr> sps.exe register /s:http://localhost:8080 MySettingsFile.xml
Code: Select all
using SoftPro.ClientModel.Integration;
using SoftPro.Select.Client;
//If running inside a SoftPro Select package, you can obtain the server reference using a GetService call.
//There is no need to create a new instance. You can reuse the client's instance.
SelectServer sps = GetService<SelectServer>();
Registration reg = sps.GetService<Registration>();
ServiceEntry entry = reg.Query(new Guid("{your-new-guid-from-xml-file}"));
ServiceAttribute attr = entry.Attributes.Single(a => a.Name == "MySettingName");
string value = attr.Value;
John Morris
Sr. Software Architect
SoftPro
Sr. Software Architect
SoftPro