此规则会标记对用来检索 SOAP 故障和字符串的方法的调用。Web Service 运行时环境所返回的缺省故障代码和字符串在 WebSphere Application Server V8 中已发生更改。
具体而言,标记了下列方法:
-
javax.xml.soap.SOAPFault.getFaultCode()
-
javax.xml.soap.SOAPFault.getFaultString()
-
com.ibm.websphere.webservices.soap.IBMSOAPFault.getFaultCode()
-
com.ibm.websphere.webservices.soap.IBMSOAPFault.getFaultString()
-
javax.xml.rpc.soap.SOAPFaultException.getFaultCode()
-
javax.xml.rpc.soap.SOAPFaultException.getFaultString()
-
com.ibm.websphere.webservices.soap.SOAPException.getFaultCode()
-
com.ibm.websphere.webservices.soap.SOAPException.getFaultString()
更改缺省故障代码和字符串是为了修正与使用 XML 加密的 Web Service 相关的潜在安全漏洞。 作为修正的一部分,从 Web Service 运行时环境所生成的任何 SOAP 故障中移除了详细信息。 缺省情况下,在 V 8 中, Web Service 运行时环境会将运行时环境生成的所有故障统一为包含以下故障代码的单一故障类型:
soapenv:Server
和故障字符串
Internal Error
.
如果应用程序期望运行时环境故障代码或字符串提供详细信息,那么您可能需要修改应用程序。
您还可以使用
webservices.unify.faults
用于更改缺省行为的 Java 虚拟机定制属性。
要还原为先前发行版的行为,请设置
webservices.unify.faults
至
false
.
在 WebSphere Application Server V8 之前,缺省行为是在故障代码或字符串中返回详细信息。 此问题也已在服务流(包括 6.0.2、6.1 和 7.0)中修正,但这些发行版中的缺省行为保持不变。
对于服务发行版,
webservices.unify.faults
缺省值为
false
. 将该值更改为
true
以获取与这些发行版中的 V 8 相同的行为。
JAX-WS 示例:
import javax.xml.ws.soap.SOAPFaultException;
import javax.xml.ws.soap.SOAPFault;
try {
// some code that causes a fault
...
} catch (SOAPFaultException e) {
SOAPFault soapFault = e.getFault();
String faultCode = soapFault.getFaultCode();
String faultString = soapFault.getFaultString();
...
}
JAX-RPC 示例:
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.namespace.QName;
try {
// some code that causes a fault
...
} catch (SOAPFaultException e) {
QName faultCode = e.getFaultCode();
String faultString = e.getFaultString();
...
}
在这两个示例中,调用
getFaultCode()
和
getFaultString()
方法将被标记。
有关更多信息,请参阅: