我遇到以下错误:
java.util.concurrent.ExecutionException:
javax.xml.ws.soap.SOAPFaultException:解组错误:文本大小
超出限制(134217728)
只是说通过SOAP Web服务存在最大文本大小限制。
根据Securing CXF Services文档,可以在CXF.xml文件中定义以下属性:
org.apache.cxf.stax.maxTextLength
我的问题是怎么做?在文件中应该写在哪里?
我是Java新手,谢谢您的帮助
最佳答案
也许为时已晚... :)
对我来说,这适用于JBoss EAP 6.4:
首先,将文件命名为webservice-conf.xml到WEB-INF /中:
<?xml version="1.0" encoding="UTF-8"?>
<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0 schema/jbossws-jaxws-config_4_0.xsd">
<endpoint-config>
<config-name>Sample</config-name>
<property>
<property-name>org.apache.cxf.stax.maxTextLength</property-name>
<property-value>268435456</property-value>
</property>
</endpoint-config>
</jaxws-config>
您可以通过设置org.apache.cxf.stax.maxTextLength的属性值(以字节为单位)来指定最大大小。
然后,在您的Web服务实现中,添加@EndpointConfig批注:
@WebService
@EndpointConfig(configName = "Sample", configFile = "WEB-INF/webservice-conf.xml")
public class SampleService implements ISampleService {
}
请注意,注释中的configName值必须与XML文件中的config-name匹配。
对我有用