我的应用程序使用JAX-WS,对于Java版本8\u 121,当发生SOAPFault时,一切正常,生成的响应如下:
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<Action xmlns="http://www.w3.org/2005/08/addressing" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" S:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">A36AE1D2-B060-465D-9C7A-D5F40B2429BF</MessageID>
<RelatesTo xmlns="http://www.w3.org/2005/08/addressing">ABCDE-12345-ABCDE</RelatesTo>
<To xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</To>
</S:Header>
<S:Body>
<S:Fault xmlns="" xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Client</faultcode>
<faultstring>An error has occurred - please see the detail element for further information</faultstring>
<detail>
<itk:ToolkitErrorInfo xmlns="urn:hl7-org:v3" xmlns:itk="urn:nhs-itk:ns:201005">
<itk:ErrorID>ADF9356D-2191-4D2D-9649-2B4A7EEFA2AF</itk:ErrorID>
<itk:ErrorCode>3000</itk:ErrorCode>
<itk:ErrorText>Unable to process request</itk:ErrorText>
<itk:ErrorDiagnosticText>Client ID forbidden</itk:ErrorDiagnosticText>
</itk:ToolkitErrorInfo>
</detail>
</S:Fault>
</S:Body>
</S:Envelope>
但是,当我将Java版本设置为8\U 164时,同一应用程序会输出以下内容:
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header xmlns="http://www.w3.org/2005/08/addressing" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<Action xmlns="http://www.w3.org/2005/08/addressing" S:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</Action>
<MessageID>7A8D2AEE-37E5-4CD1-BFF7-957E59130EA2</MessageID>
<RelatesTo>ABCDE-12345-ABCDE</RelatesTo>
<To>http://www.w3.org/2005/08/addressing/anonymous</To>
</S:Header>
<S:Body xmlns="" xmlns:ns3="http://www.w3.org/2003/05/soap-envelope">
<S:Fault>
<faultcode>S:Client</faultcode>
<faultstring>An error has occurred - please see the detail element for further information</faultstring>
<detail xmlns="urn:hl7-org:v3" xmlns:itk="urn:nhs-itk:ns:201005">
<itk:ToolkitErrorInfo xmlns:itk="urn:nhs-itk:ns:201005">
<itk:ErrorID>A70FE962-B17D-4DFF-A866-BC02AC73AB79</itk:ErrorID>
<itk:ErrorCode>3000</itk:ErrorCode>
<itk:ErrorText>Unable to process request</itk:ErrorText>
<itk:ErrorDiagnosticText>Client ID forbidden</itk:ErrorDiagnosticText>
</itk:ToolkitErrorInfo>
</detail>
</S:Fault>
</S:Body>
</S:Envelope>
JAX-WS似乎向“Detail”元素添加了额外的、不需要的名称空间,因此对于8\u 121来说
<detail>
但对于8\u 162来说
<detail xmlns="urn:hl7-org:v3" xmlns:itk="urn:nhs-itk:ns:201005">
然后,这会阻止客户端JAX-WS代码正确解析SOAPFault,并丢失detail元素。
该实现确实有绑定注释来设置这些名称空间,但它们都是为“detail”不在其中的包设置的。我无法确定为什么要添加它们,而且只有在版本121以上时才会添加。
有没有人知道这可能是什么原因,以及我如何防止它发生,或者如果没有,有没有关于我如何进一步诊断原因的提示?