You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nicolas Wieseke <n....@ewerk.com> on 2008/12/08 20:30:18 UTC

Problem with chunked SOAP results

Hi,

I'm writing a web service client (with maven and spring) which calles a  
web service periodically (using the quarz framework for job scheduling).  
The whole code is running in a web application deploied with Tomcat  
6.0.18. The client requests data from a web service and copies the  
response into a local file. For small responses everything work fine. But  
if the answer from the web service has a larger size the following  
exception is thrown.

com.ewerk.epex.md.miner.converter.EpexConverterException: Error converting  
market data for EPEX Futures Power daily options overview to xml.
         at  
com.ewerk.epex.md.miner.converter.xml.futures.EpexFuturesPowerXmlConverter.convertPowerOptionsMarketResults(EpexFuturesPowerXmlConverter.java:158)
         at  
com.ewerk.epex.md.miner.transporter.xml.AbstractXmlTransporter.createPowerOptionsMarketResults(AbstractXmlTransporter.java:458)
         at  
com.ewerk.eex.shop.backend.modules.scheduler.sysjobs.EpexPowerFuturesXmlTransportJob.doExecute(EpexPowerFuturesXmlTransportJob.java:77)
         at  
com.ewerk.eex.shop.backend.modules.scheduler.sysjobs.SystemJobImpl.execute(SystemJobImpl.java:113)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
         at  
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: javax.xml.ws.soap.SOAPFaultException: Error reading  
XMLStreamReader.
         at  
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
         at $Proxy57.dailyOptionsOverview(Unknown Source)
         at  
com.ewerk.epex.md.miner.converter.xml.futures.EpexFuturesPowerXmlConverter.convertPowerOptionsMarketResults(EpexFuturesPowerXmlConverter.java:135)
         ... 5 more
Caused by: org.apache.cxf.binding.soap.SoapFault: Error reading  
XMLStreamReader.
         at  
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:183)
         at  
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:56)
         at  
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
         at  
org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:633)
         at  
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2064)
         at  
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1942)
         at  
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1867)
         at  
org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
         at  
org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:170)
         at  
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
         at  
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:595)
         at  
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
         at  
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
         at  
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
         at  
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
         ... 7 more
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at  
[row,col {unknown-source}]: [1,0]
         at  
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
         at  
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
         at  
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
         at  
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
         at  
com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1095)
         at  
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:85)
         ... 24 more

Calling the WebCervice from a different client (Visual Web Service Client)  
works well, so I guess the problem is on the client side. Using tcpmon I  
figured out, that the error only occurs if the response is chunked.

here ist spring.xml file for the web service client:
<?xml version="1.0" encoding="UTF-8"?>
<beans 	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:s="http://jax-ws.dev.java.net/spring/core"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:cxf="http://cxf.apache.org/core"
	xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://cxf.apache.org/core
			http://cxf.apache.org/schemas/core.xsd
			http://www.springframework.org/schema/beans
			http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
			http://www.springframework.org/schema/context
			http://www.springframework.org/schema/context/spring-context-2.5.xsd
			http://cxf.apache.org/jaxws
			http://cxf.apache.org/schemas/jaxws.xsd">

	<context:component-scan base-package="com.ewerk.epex.md.miner.wsc" />
	
	<!-- EPEX context imports -->
	<import resource="classpath:/spring/epex-core.context.xml"/>
	
	<bean	id="additionalJaxbClassesDetector"
		class="com.ewerk.java.utilities.AnnotatedClassesDetector">
		<property name="basePackage" value="com.ewerk.epex.api" />
		<property name="markerAnnotation"  
value="com.ewerk.epex.core.annotations.AdditionalJaxbClass" />
	</bean>
	<bean	id="additionalJaxbClasses"
		factory-bean="additionalJaxbClassesDetector"
		factory-method="findClassesAsArray" />

	<bean 	id="epexFuturesPowerWebServiceClient"
		class="com.ewerk.epex.api.futures.EpexFuturesPowerDomain"
		factory-bean="epexFuturesPowerWebServiceClientFactory"
		factory-method="create" />

	<bean 	id="epexFuturesPowerWebServiceClientFactory"
		class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
		<property 	name="serviceClass"
				value="com.ewerk.epex.api.futures.EpexFuturesPowerDomain" />
		<property name="address" value="${build.epex.futures.power.ws.address}"  
/>
		<property name="properties">
			<map>
				<entry key="jaxb.additionalContextClasses">
					<ref bean="additionalJaxbClasses" />
				</entry>
			</map>
		</property>
	</bean>
	
	<bean id="epexFuturesCoalWebServiceClientFactory"
		class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
		<property name="serviceClass"  
value="com.ewerk.epex.api.futures.EpexFuturesCoalDomain" />
		<property name="address" value="${test.epex.futures.coal.ws.address}" />
		<property name="properties">
             <map>
				<entry key="jaxb.additionalContextClasses">
					<ref bean="additionalJaxbClasses" />
				</entry>
             </map>
         </property>
	</bean>
</beans>


and this is spring.xml file for the web service
<?xml version="1.0" encoding="UTF-8"?>
<beans 	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:s="http://jax-ws.dev.java.net/spring/core"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:cxf="http://cxf.apache.org/core"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://cxf.apache.org/core
			http://cxf.apache.org/schemas/core.xsd
			http://www.springframework.org/schema/beans
			http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
			http://www.springframework.org/schema/context
			http://www.springframework.org/schema/context/spring-context-2.5.xsd
			http://cxf.apache.org/jaxws
			http://cxf.apache.org/schemas/jaxws.xsd">

	<!-- CXF imports -->
	<import resource="classpath:META-INF/cxf/cxf.xml"/>
   	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
   	<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>

	<cxf:bus>
		<cxf:inInterceptors>
			<ref bean="incomingSoapMonitorInterceptor" />
		</cxf:inInterceptors>
		<cxf:outInterceptors>
			<ref bean="outgoingSoapMonitorInterceptor" />
		</cxf:outInterceptors>
	</cxf:bus>

	<context:component-scan base-package="com.ewerk.epex.md.provider.ws" />

	<!-- EPEX context imports -->
	<import resource="classpath:/spring/epex-md-provider-dao.context.xml"/>

	<!-- setup DataSource -->
	<bean 	id="marketDataDataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource">
         	<property name="driverClass" value="${build.md.ds.driver}"/>
	        <property name="jdbcUrl" value="${build.md.ds.url}"/>
	        <property name="user" value="${build.md.ds.user}"/>
	        <property name="password" value="${build.md.ds.pass}"/>
	        <property name="minPoolSize"  
value="${build.md.ds.min.pool.size}"/>
	        <property name="maxPoolSize"  
value="${build.md.ds.max.pool.size}"/>
	        <property name="acquireIncrement" value="${build.md.ds.acq.inc}"/>
	    </bean>

	<bean	id="additionalJaxbClassesDetector"
		class="com.ewerk.java.utilities.AnnotatedClassesDetector">
		<property name="basePackage" value="com.ewerk.epex.api" />
		<property name="markerAnnotation"  
value="com.ewerk.epex.core.annotations.AdditionalJaxbClass" />
	</bean>

	<bean	id="additionalJaxbClasses"
		factory-bean="additionalJaxbClassesDetector"
		factory-method="findClassesAsArray" />

	<jaxws:server 	id="epexFuturesPowerWebServiceServer"
			serviceBean="#epexFuturesPowerWebService"
			address="${build.epex.futures.power.ws.address}">
		 <jaxws:properties>
			<entry key="jaxb.additionalContextClasses">
				<ref bean="additionalJaxbClasses" />
			</entry>
		</jaxws:properties>
	</jaxws:server>
</beans>

For unknown reasons the test classes (testng) for the client did also work  
well. For the test I create a web service using  
JaxWsServerFactoryBean.create().
The only difference in the test spring.xml file is that I additionaly  
defined a bean for the web service and I imported cxf and jetty transport.

	<import resource="classpath:META-INF/cxf/cxf.xml"/>
   	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
   	<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
	
	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />

	<bean id="epexFuturesCoalWebServiceServer"
		class="com.ewerk.epex.md.provider.ws.futures.EpexFuturesCoalWebService"  
/>

I am grateful for any kind of advice.

Nicolas Wieseke