AgentPortType stub = new ODEClient().createStub(userDN, wsdlLoc);
CreateExperimentsRequestDocument experimentDoc = CreateExperimentsRequestDocument.Factory
.newInstance();
CreateCollectionsRequestType createCollectionReq = CreateCollectionsRequestType.Factory
.newInstance();
CollectionType collectionInfo = createCollectionReq
.addNewCollectionInfo();
MinimalLEADMetadata minimalLEADMetadata = new MinimalLEADMetadata(
userDN, experimentName, experimentDescription);
LEADResourceType leadResource = minimalLEADMetadata
.getLeadResourceDoc().getLEADresource();
ThemeType theme = leadResource.addNewData().addNewIdinfo()
.addNewKeywords().addNewTheme();
theme.addNewThemekey().setStringValue(instanceID);
theme.setThemekt("ROOT_WORKFLOW_ID");
theme = leadResource.addNewData().addNewIdinfo().addNewKeywords()
.addNewTheme();
theme.addNewThemekey().setStringValue(templateID);
theme.setThemekt("ROOT_WORKFLOW_INSTANCE_ID");
collectionInfo.setLEADresource(leadResource);
collectionInfo.setAssignNewResourceID(true);
experimentDoc.setCreateExperimentsRequest(createCollectionReq);
OperationResponseDocument res = stub.createExperiments(experimentDoc);
return res;