try {
startVersionScope();
request.execute();
responseStream = request.getResponseStream();
if (responseStream == null) {
throw new ServiceException("Unable to obtain service document");
}
S serviceDoc = serviceClass.newInstance();
serviceDoc.parse(extProfile, responseStream);
return serviceDoc;
} catch (InstantiationException e) {
throw new ServiceException("Unable to create service document instance",
e);
} catch (IllegalAccessException e) {
throw new ServiceException("Unable to create service document instance",
e);
} finally {
endVersionScope();
if (responseStream != null) {
responseStream.close();