我正在使用MedicationOrder資源在HAPI - FHIR DSTU2 HL7中編寫用於生成POST請求的java代碼。我遇到了幾個麻煩。構建MEdicationOrder資源的POST請求消息HAPI - FHIR
- 設置所包含資源的參考值。
- 包含的資源不存在於生成的XML消息中。
- 操作結果爲HTTP/1.1 500內部服務器錯誤消息期待外部元素稱爲'feed',找到:MedicationOrder。
任何人都可以熟悉MedicationOrder資源請幫助我嗎?下面
是java代碼
public int sendMessage(MedicationOrder medicationOrder) throws ClientProtocolException, IOException
{
FhirContext ctx = FhirContext.forDstu2Hl7Org();
IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu2");
HttpPost httpPost = new HttpPost("http://fhirtest.uhn.ca/baseDstu2");
String message = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(medicationOrder);
httpPost.setEntity((HttpEntity) new StringEntity(message, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
org.apache.http.HttpResponse response = client.getHttpClient().execute(httpPost);
return response.getStatusLine().getStatusCode();
}
目前尚不清楚你的要求。請包括您說您正在編寫的Java代碼 - 包含生成這些錯誤的Java代碼會更有幫助。請查看一些關於[如何提出一個好問題]的有用提示(http://stackoverflow.com/help/how-to-ask) - 詢問一個好問題可以提高獲得答案的機會。 但是,在發佈您的問題之前,您先搜索並做一些調查也同樣重要。還包括您嘗試過的內容,並指出您遇到的問題。 – ishmaelMakitla