epr = EndpointReferenceHelper.fromString(eprAttr);
} else {
epr = new EndpointReference(service.getId());
}
TargetService targetService = new TargetService(epr);
String[] types = service.getAttributes(DiscoveryConstants.ATTR_TYPES);
if (types != null) {
targetService.setTypes(Util.toQNameArray(types));
}
String[] scopes = service.getAttributes(DiscoveryConstants.ATTR_SCOPES);
if (scopes != null) {
targetService.setScopes(Util.toURIArray(scopes));
}
String[] xAddresses = service.getAttributes(DiscoveryConstants.ATTR_XADDRESSES);
if (xAddresses != null) {
targetService.setXAddresses(Util.toURIArray(xAddresses));
}
String mdv = service.getAttribute(DiscoveryConstants.ATTR_METADATA_VERSION);
if (mdv != null) {
targetService.setMetadataVersion(Integer.valueOf(mdv));
} else {
// Set a default metadata version
targetService.setMetadataVersion(1);
}
return targetService;
}