オブジェクトを作成し、その属性の設定が完了したら、そのオブジェクトを Service Registry に発行します。それには、LifeCycleManager.saveObjects メソッドを呼び出すか、BusinessLifeCycleManager.saveOrganizations や BusinessLifeCycleManager.saveServices などの、オブジェクトに固有の保存メソッドを呼び出します。単一のオブジェクトではなく、常にオブジェクトのコレクションを発行します。保存メソッドは、保存されたオブジェクトのキー (すなわち、一意の識別子) を含む BulkResponse オブジェクトを返します。次のコードでは、ある組織を保存したあと、そのキーを取得しています。
// Add organization and submit to registry
// Retrieve key if successful
Collection orgs = new ArrayList();
orgs.add(org);
BulkResponse response = blcm.saveOrganizations(orgs);
Collection exceptions = response.getExceptions();
if (exceptions == null) {
System.out.println("Organization saved");
Collection keys = response.getCollection();
Iterator keyIter = keys.iterator();
if (keyIter.hasNext()) {
javax.xml.registry.infomodel.Key orgKey =
(javax.xml.registry.infomodel.Key) keyIter.next();
String id = orgKey.getId();
System.out.println("Organization key is " + id);
}
}
オブジェクトのいずれかがすでに存在しており、そのデータの一部が更新されている場合、保存メソッドはそのデータを更新して置換します。通常は、これによって、オブジェクトの新しいバージョンが作成されます (「レジストリ内のオブジェクトの状態の変更」を参照)。