Java 8_162 中添加了错误的命名空间元素 SOAPFault 详细信息元素

Erroneous Namespace elements being added SOAPFault Detail Element in Java 8_162

我的应用程序正在使用 JAX-WS,对于 Java 版本 8_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_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_121 是

<detail>

但是8_162是

<detail xmlns="urn:hl7-org:v3" xmlns:itk="urn:nhs-itk:ns:201005">

这会阻止客户端 JAX-WS 代码正确解析 SOAPFault,并且会丢失 detail 元素。

实现确实有绑定注释来设置这些命名空间,但它们都是为 'detail' 不在的包设置的。我无法确定为什么要添加它们,而且只能添加一次我转到版本 121 以上。

有没有人知道是什么原因导致了这种情况,我该如何防止这种情况发生,或者如果不是这样,有什么关于我如何进一步诊断原因的提示吗?

好吧,因为什么都没有,所以我从来没有弄清楚,但我的解决方法是,如果您发现自己在这里遇到类似问题,那就是:

我在输出处理程序链中使用了一个处理程序来手动删除错误的命名空间声明。