我正在尝试将资源上传到HAPI。它基于资源类型基础,我已经为我想要捕获的概念创建了一个自定义配置文件(和扩展)。我已将这些StructureDefinitions上传到我正在使用的服务器(托管在本地主机上),但我还没有验证它的上传(仍然试图测试我用于我的xml的格式是否正确)。 / p>
我已经上传了以下软件包(实际软件包中有更多的记录,为了清晰起见,我刚刚编辑了它):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Bundle>
<meta>
<lastUpdated value="2016-10-28T16:29:43Z"/>
</meta>
<type value="transaction"/>
<entry>
<resource>
<Basic>
<text>
<status value="generated"/>
<div/>
</text>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/DateID">
<valueDate value="2016-11-01"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/SptSolution">
<valueCoding value="SptSolution.CatFurSPTSoln"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/MethodOfFollowUp">
<valueCoding value="FollowUpMethod.ClinicVisit"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/SPTDefinition">
<valueString value="A positive skin prick test result was defined as a mean wheal diameter of 3mm greater than that of the negative control"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/SubjectNo">
<valueString value="4320"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/AIW">
<valueInteger value="58"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/FollowUp">
<valueCoding value="FollowUp.MSAge1Y"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/Subject">
<valueCoding value="Person.StudySubject"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/VariableLabel">
<valueString value="Child sensitised to cat (age 1 spt)"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/SPTDataType">
<valueCoding value="SkinPrickTestData.SPTResult"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/DataSource">
<valueCoding value="DataSource.ClinicalMeasurement"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/ClinicalType">
<valueCoding value="ClinicalMeasurement.SkinPrickTest"/>
</extension>
<extension url="http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/DataSPTResult">
<valueCoding value="TestResult.Negative"/>
</extension>
</Basic>
</resource>
<request>
<method value="POST"/>
<url value="Basic"/>
</request>
</entry>
</Bundle>
由于我收到回复,因此似乎已正确上传:
<Bundle xmlns="http://hl7.org/fhir">
<id value="5d8d77ed-762f-4a64-b6b1-7a3aeacac52f"/>
<type value="transaction-response"/>
<link>
<relation value="self"/>
<url value="http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu2"/>
</link>
<entry>
<response>
<status value="201 Created"/>
<location value="Basic/1107/_history/1"/>
<etag value="1"/>
<lastModified value="2016-11-01T15:09:56.264+00:00"/>
</response>
</entry>
</Bundle>
但是,当我尝试通过URL访问时:
{{URL}}/Basic/1107
我收到以下回复:
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">error</td><td>[]</td><td><pre>Failed to call access method</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "Failed to call access method"
}
]
}
知道可能导致此问题的原因是什么?当我上传患者并尝试将它们拉回来时,它可以正常工作,但尝试将其用于基础似乎不起作用。
答案 0 :(得分:6)
这确实是HAPI中的一个错误。我正要办理入住手续。
FWIW你可以通过在叙述中不包括空<div/>
标签(或向div中添加内容)来解决这个问题。
答案 1 :(得分:2)
似乎是一个错误,我也可以在我们的服务器上重现这种行为:
这是完整的堆栈跟踪:
ca.uhn.fhir.parser.DataFormatException: String does not appear to be valid XML/XHTML (error is "Unexpected character ' ' (code 32) expected '>'
at [row,col {unknown-source}]: [1,6]"): <div/ xmlns="http://www.w3.org/1999/xhtml">
at ca.uhn.fhir.model.primitive.XhtmlDt.parse(XhtmlDt.java:127)
at ca.uhn.fhir.model.primitive.XhtmlDt.parse(XhtmlDt.java:41)
at ca.uhn.fhir.model.api.BasePrimitive.setValueAsString(BasePrimitive.java:112)
at ca.uhn.fhir.model.primitive.XhtmlDt.setValueAsString(XhtmlDt.java:152)
at ca.uhn.fhir.parser.ParserState$XhtmlState.attributeValue(ParserState.java:2592)
at ca.uhn.fhir.parser.ParserState.attributeValue(ParserState.java:117)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1346)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1271)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1334)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1271)
at ca.uhn.fhir.parser.JsonParser.doParseResource(JsonParser.java:226)
at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:641)
at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:689)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.toResource(BaseHapiFhirDao.java:1024)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.read(BaseHapiFhirResourceDao.java:768)
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy81.read(Unknown Source)
at ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider.read(BaseJpaResourceProvider.java:125)
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ca.uhn.fhir.rest.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:271)
at ca.uhn.fhir.rest.method.ReadMethodBinding.invokeServer(ReadMethodBinding.java:221)
at ca.uhn.fhir.rest.method.ReadMethodBinding.invokeServer(ReadMethodBinding.java:61)
at ca.uhn.fhir.rest.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:306)
at ca.uhn.fhir.rest.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:257)
at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:659)
at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:1203)
at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1179)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at de.gecko.hapi.filter.CorsFilter.doFilter(CorsFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32) expected '>'
at [row,col {unknown-source}]: [1,6]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:647)
at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3002)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2963)
at com.ctc.wstx.sr.BasicStreamReader.handleRootElem(BasicStreamReader.java:2100)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2080)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1131)
at org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:255)
at ca.uhn.fhir.model.primitive.XhtmlDt.parse(XhtmlDt.java:114)
... 62 common frames omitted
2016-11-02 15:03:46.679 [http-bio-8080-exec-26] ERROR c.u.f.r.s.i.ExceptionHandlingInterceptor [ExceptionHandlingInterceptor.java:126] Failure during REST processing
ca.uhn.fhir.rest.server.exceptions.InternalErrorException: Failed to call access method
at ca.uhn.fhir.rest.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:276)
at ca.uhn.fhir.rest.method.ReadMethodBinding.invokeServer(ReadMethodBinding.java:221)
at ca.uhn.fhir.rest.method.ReadMethodBinding.invokeServer(ReadMethodBinding.java:61)
at ca.uhn.fhir.rest.method.BaseResourceReturningMethodBinding.doInvokeServer(BaseResourceReturningMethodBinding.java:306)
at ca.uhn.fhir.rest.method.BaseResourceReturningMethodBinding.invokeServer(BaseResourceReturningMethodBinding.java:257)
at ca.uhn.fhir.rest.server.RestfulServer.handleRequest(RestfulServer.java:659)
at ca.uhn.fhir.rest.server.RestfulServer.doGet(RestfulServer.java:1203)
at ca.uhn.fhir.rest.server.RestfulServer.service(RestfulServer.java:1179)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at de.gecko.hapi.filter.CorsFilter.doFilter(CorsFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ca.uhn.fhir.rest.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:271)
... 31 common frames omitted
Caused by: ca.uhn.fhir.parser.DataFormatException: Failed to parse database resource[class ca.uhn.fhir.model.dstu2.resource.Basic/1375 (pid 1375, version DSTU2): String does not appear to be valid XML/XHTML (error is "Unexpected character ' ' (code 32) expected '>'
at [row,col {unknown-source}]: [1,6]"): <div/ xmlns="http://www.w3.org/1999/xhtml">
at ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.toResource(BaseHapiFhirDao.java:1039)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao.read(BaseHapiFhirResourceDao.java:768)
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy81.read(Unknown Source)
at ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider.read(BaseJpaResourceProvider.java:125)
... 35 common frames omitted
Caused by: ca.uhn.fhir.parser.DataFormatException: String does not appear to be valid XML/XHTML (error is "Unexpected character ' ' (code 32) expected '>'
at [row,col {unknown-source}]: [1,6]"): <div/ xmlns="http://www.w3.org/1999/xhtml">
at ca.uhn.fhir.model.primitive.XhtmlDt.parse(XhtmlDt.java:127)
at ca.uhn.fhir.model.primitive.XhtmlDt.parse(XhtmlDt.java:41)
at ca.uhn.fhir.model.api.BasePrimitive.setValueAsString(BasePrimitive.java:112)
at ca.uhn.fhir.model.primitive.XhtmlDt.setValueAsString(XhtmlDt.java:152)
at ca.uhn.fhir.parser.ParserState$XhtmlState.attributeValue(ParserState.java:2592)
at ca.uhn.fhir.parser.ParserState.attributeValue(ParserState.java:117)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1346)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1271)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1334)
at ca.uhn.fhir.parser.JsonParser.parseChildren(JsonParser.java:1271)
at ca.uhn.fhir.parser.JsonParser.doParseResource(JsonParser.java:226)
at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:641)
at ca.uhn.fhir.parser.BaseParser.parseResource(BaseParser.java:689)
at ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.toResource(BaseHapiFhirDao.java:1024)
... 49 common frames omitted
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32) expected '>'
at [row,col {unknown-source}]: [1,6]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:647)
at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3002)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2963)
at com.ctc.wstx.sr.BasicStreamReader.handleRootElem(BasicStreamReader.java:2100)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2080)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1131)
at org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:255)
at ca.uhn.fhir.model.primitive.XhtmlDt.parse(XhtmlDt.java:114)
... 62 common frames omitted
我将此问题发布到FHIR聊天: https://chat.fhir.org/#narrow/stream/hapi/subject/Basic.20Resource.20bug