service = Service.create(wsdlLocation, Migrate.QNAME);
} catch(WebServiceException e) {
throw new PlatoServiceException("Error creating web service.", e);
}
Migrate m = (Migrate) service.getPort(Migrate.class);
// create digital object that contains our sample object
DigitalObject dob = new DigitalObject.Builder( Content.byValue(sampleObject.getData().getData()) ).title("data").build();
FormatRegistry formatRegistry = FormatRegistryFactory.getFormatRegistry();
// create Planets URI from extension
URI sourceFormat = formatRegistry.createExtensionUri(sampleObject.getFormatInfo().getDefaultExtension());
URI targetFormat;
try {
targetFormat = new URI(action.getTargetFormat());
} catch (URISyntaxException e) {
throw new PlatoServiceException("Error in target format.", e);
}
List<Parameter> serviceParams = getParameters(action.getParamByName("settings"));
if (serviceParams.size() <= 0) {
serviceParams = null;
}
// perform migration
MigrateResult result = m.migrate(dob, sourceFormat, targetFormat, serviceParams);
MigrationResult migrationResult = new MigrationResult();
migrationResult.setSuccessful((result != null) && (result.getDigitalObject() != null));
if (migrationResult.isSuccessful()) {