我正在使用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