1
我正在使用SPring 3.2.11.RELEASE和CXF 2.7.18。我有htis在我的Spring應用程序上下文文件,必要的與Web服務通信...有沒有辦法讓CXF在與Web服務通信時忽略maxElementCount?
<jaxws:client id="myWebServiceClient"
serviceClass="org.mainco.bsorg.MyWebService"
address="${wsdl.url}"
/>
<cxf:bus>
<cxf:properties>
<entry key="org.apache.cxf.stax.maxElementCount" value="10000000"/>
</cxf:properties>
</cxf:bus>
在我的Maven pom.xml文件,我有這個配置的插件...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<target>2.1</target>
<wsdlDirectory>${basedir}/src/wsdl</wsdlDirectory>
<sourceDestDir>${basedir}/src/main/java</sourceDestDir>
<packageName>org.mainco.bsorg</packageName>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
</configuration>
</execution>
</executions>
</plugin>
Unfrotunately當我執行一個特定呼叫對我的web服務,我得到這個錯誤...
07:16:26,088 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-2) Interceptor for {http://mainco.org/bsorg/}MyWebServiceService#{http://mainco.org/bsorg/}searchOrgs has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Maximum Number of Child Elements limit (50000) Exceeded
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:907) [cxf-rt-databinding-jaxb-2.7.15.jar:2.7.15]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:711) [cxf-rt-databinding-jaxb-2.7.15.jar:2.7.15]
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:172) [cxf-rt-databinding-jaxb-2.7.15.jar:2.7.15]
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:107) [cxf-api-2.7.15.jar:2.7.15]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) [cxf-api-2.7.15.jar:2.7.15]
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:849) [cxf-api-2.7.15.jar:2.7.15]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626) [cxf-rt-transports-http-2.7.15.jar:2.7.15]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1515) [cxf-rt-transports-http-2.7.15.jar:2.7.15]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1317) [cxf-rt-transports-http-2.7.15.jar:2.7.15]
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) [cxf-api-2.7.15.jar:2.7.15]
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632) [cxf-rt-transports-http-2.7.15.jar:2.7.15]
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) [cxf-api-2.7.15.jar:2.7.15]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) [cxf-api-2.7.15.jar:2.7.15]
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572) [cxf-api-2.7.15.jar:2.7.15]
如果我從改變我的maxElementCount值「10000000」爲「1000000」,我得到「Maximu上述錯誤m子元素數量限制(1000000)超出「。有沒有辦法讓CXF忽略maxElementCount限制?這是一個痛苦,不得不擺脫最大值。我很樂意在Spring中使用natoher技術來配置Web服務,但如果您提出建議,請提供我需要的Maven和Spring配置。
你有沒有嘗試從配置中排除'maxElementCount'或將值設置爲-1? – Veeram