public IResource loadResource(IRestfulClient theClient) throws IOException {
		if (myResource != null) {
			return myResource;
		}
		IdDt resourceId = getReference();
		if (resourceId == null) {
			throw new IllegalStateException("Reference has no resource ID defined");
		}
		String resourceUrl = resourceId.getValue();
		ourLog.debug("Loading resource at URL: {}", resourceUrl);
		HttpClient httpClient = theClient.getHttpClient();
		FhirContext context = theClient.getFhirContext();
		if (!resourceUrl.startsWith("http")) {
			resourceUrl = theClient.getServerBase() + resourceUrl;
		}
		HttpGet get = new HttpGet(resourceUrl);
		HttpResponse response = httpClient.execute(get);
		try {
			// TODO: choose appropriate parser based on response CT
			IParser parser = context.newXmlParser();
			Reader responseReader = BaseClient.createReaderFromResponse(response);
			myResource = parser.parseResource(responseReader);
		} finally {
			if (response instanceof CloseableHttpResponse) {
				((CloseableHttpResponse) response).close();
			}
		}
		return myResource;
	}
public IResource loadResource(IRestfulClient theClient) throws IOException {
		if (myResource != null) {
			return myResource;
		}
		IdDt resourceId = getReference();
		if (resourceId == null) {
			throw new IllegalStateException("Reference has no resource ID defined");
		}
		String resourceUrl = resourceId.getValue();
		ourLog.debug("Loading resource at URL: {}", resourceUrl);
		HttpClient httpClient = theClient.getHttpClient();
		FhirContext context = theClient.getFhirContext();
		if (!resourceUrl.startsWith("http")) {
			resourceUrl = theClient.getServerBase() + resourceUrl;
		}
		HttpGet get = new HttpGet(resourceUrl);
		HttpResponse response = httpClient.execute(get);
		try {
		
			IParser parser = context.newXmlParser();
			Reader responseReader = BaseClient.createReaderFromResponse(response);
			myResource = parser.parseResource(responseReader);
		} finally {
			if (response instanceof CloseableHttpResponse) {
				((CloseableHttpResponse) response).close();
			}
		}
		return myResource;
	}
public iresource loadresource(irestfulclient theclient) throws ioexception { if (myresource != null) { return myresource; } iddt resourceid = getreference(); if (resourceid == null) { throw new illegalstateexception("reference has no resource id defined"); } string resourceurl = resourceid.getvalue(); ourlog.debug("loading resource at url: {}", resourceurl); httpclient httpclient = theclient.gethttpclient(); fhircontext context = theclient.getfhircontext(); if (!resourceurl.startswith("http")) { resourceurl = theclient.getserverbase() + resourceurl; } httpget get = new httpget(resourceurl); httpresponse response = httpclient.execute(get); try { iparser parser = context.newxmlparser(); reader responsereader = baseclient.createreaderfromresponse(response); myresource = parser.parseresource(responsereader); } finally { if (response instanceof closeablehttpresponse) { ((closeablehttpresponse) response).close(); } } return myresource; }