Runtime components : Core components : Contexts : Tasks : Working with contexts : Working with services defined in the context
  
Working with services defined in the context
To show how to work with a service defined in the context, the example code assumes that the definition files contain the following definitions:
Context definition
<context id="myContext" type="test" parent="nil">
  <refKColl refId="contextCollection">
  </refKColl>
  <refService refId="myCSService" alias="clientsess" type="cs"/>
</context>
Service definition
<CSClient id="myCSService" serverName="http://127.0.0.1:80"/>
Data definition
<kColl id="contextCollection">
  <field id="field1"/>
  <field id="field2"/>
</kColl>
To work with a service (in this case, associating a session with the context), use code like the following example:
Context ctxt = (Context) Context.readObject("myContext");
ctxt.setValueAt("field1","Hello");
CSClientService myClient;
myClient = ((CSClientService) getService("clientsess"));
myClient.establishSession();
Go up to
Working with contexts