You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Holger Stolzenberg <h....@ewerk.com> on 2008/02/21 13:43:54 UTC

[2.0.4] Service unit tests fail after upgrade from 2.0.2

We are using CXF for a shop backend. After we upgraded from 2.0.2 -> 2.0.4 the unit tests (TestNG) for the CXF services all fail with the same exception like the one below:

FAILED: testSaveCustomer
javax.xml.ws.soap.SOAPFaultException: Could not send Message.
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175)
	at $Proxy78.saveCustomer(Unknown Source)
	at com.ewerk.shop.backend.wsapi.customer.CustomerServiceTest.testSaveCustomer(CustomerServiceTest.java:246)
Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
	... 24 more
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:168)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1863)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:157)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 29 more

The services STILL just work fine from the backend system (a webapp), only the tests fail.

----------------------------------------------------------------------------------------------------------------------------------------------------------

The unit test setup is the following:

Maven dependencies: cxf-rt-frontend-jaxws, cxf-rt-transports-http (2.0.4)

<SNIP Service interface>

	@WebService( name = "CustomerService" )
	public interface ICustomerService	
	{
		@WebMethod( operationName = "saveCustomer" )
		@WebResult( name = "saveCustomerResult" )
		public BackendServiceStatus saveCustomer( @WebParam( name = "auth" ) ServiceAuthentication auth,
								 	@WebParam( name = "customer" ) Customer customer );
	}

</SNIP>


<SNIP CXF Server>

	JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean ();
	sf.setServiceClass( ICustomerService.class ); 
	sf.setServiceBean( getServiceImplementation() ); --> returns the service impl bean from spring context ('CustomerServiceImpl')
	sf.setAddress( "http://localhost:8080/Shop_Backend/wsapi/CustomerService" );

	// additionally setup JAXB context

	Server server = sf.create();

</SNIP>

<SNIP CXF Client>

	JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
	factory.setServiceClass( ICustomerService.class );
	factory.setAddress( "http://localhost:8080/Shop_Backend/wsapi/CustomerService" );
	ICustomerService client = (ICustomerService)factory.create();

	// call service
	BackendServiceStatus status = customerServiceProxy.saveCustomer( auth, customer );

</SNIP>

<SNIP spring context>

	<bean id="CustomerServiceImpl" class="com.ewerk.shop.backend.wsapi.customer.CustomerServiceImpl" />
	<jaxws:server	id="CustomerService"
				serviceBean="#CustomerServiceImpl" 
				address="/CustomerService">
	</jaxws:server>
</SNIP>

----------------------------------------------------------------------------------------------------------------------------------------------------------

Any solution is really appreciated. Thanks in advance.

Mit lieben Grüßen aus dem eWerk

  |  Holger Stolzenberg
  |  Softwareentwickler
  |
  |  Geschäftsführer: 
  |  Frank Richter, Erik Wende, Hendrik Schubert
  |
  |  eWerk IT GmbH
  |  Markt 16
  |  Leipzig 04109
  |  http://www.ewerk.com
  |  HRB 9065, AG Leipzig
  |  Hauptniederlassung Leipzig
  |
  |  fon +49.341.4 26 49-0
  |  fax +49.341.4 26 49-88
  |  mailto:h.stolzenberg@ewerk.com
  |
  |  Support:
  |  fon 0700 CALLME24 (0700 22556324)
  |  fax 0700 CALLME24 (0700 22556324)
  |
  | Auskünfte und Angebote per Mail
  | sind freibleibend und unverbindlich. 

Re: [2.0.4] Service unit tests fail after upgrade from 2.0.2

Posted by Daniel Kulp <dk...@apache.org>.

Any chance you can capture wire traces of the soap messages going to/from 
2.0.2 and 2.0.4?  That will probably provide the best clue as to what's 
happening.

I notice you aren't using a wsdl.   Thus, one possible culprit is that 
2.0.4 now honors any @XmlSchem(elementFormDefault=....) annotation that 
you may have in a package-info.java.   Thus, it may be sending out the 
message in a different qualification form than it did previously.  The 
wiretraces would help diagnose that.

Dan


On Thursday 21 February 2008, Holger Stolzenberg wrote:
> We are using CXF for a shop backend. After we upgraded from 2.0.2 ->
> 2.0.4 the unit tests (TestNG) for the CXF services all fail with the
> same exception like the one below:
>
> FAILED: testSaveCustomer
> javax.xml.ws.soap.SOAPFaultException: Could not send Message.
> 	at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175
>) at $Proxy78.saveCustomer(Unknown Source)
> 	at
> com.ewerk.shop.backend.wsapi.customer.CustomerServiceTest.testSaveCust
>omer(CustomerServiceTest.java:246) Caused by:
> org.apache.cxf.interceptor.Fault: Could not send Message. at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
>gInterceptor.handleMessage(MessageSenderInterceptor.java:64) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rChain.java:208) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222) at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135
>) ... 24 more
> Caused by: java.net.SocketException: Connection reset
> 	at java.net.SocketInputStream.read(SocketInputStream.java:168)
> 	at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> 	at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> 	at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> 	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
> 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
> 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:652)
> 	at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConn
>ection.java:1000) at
> java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe
>sponse(HTTPConduit.java:1863) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HT
>TPConduit.java:1791) at
> org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOut
>putStream.java:47) at
> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:157
>) at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66
>) at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
>gInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 29
> more
>
> The services STILL just work fine from the backend system (a webapp),
> only the tests fail.
>
> ----------------------------------------------------------------------
>-----------------------------------------------------------------------
>-------------
>
> The unit test setup is the following:
>
> Maven dependencies: cxf-rt-frontend-jaxws, cxf-rt-transports-http
> (2.0.4)
>
> <SNIP Service interface>
>
> 	@WebService( name = "CustomerService" )
> 	public interface ICustomerService
> 	{
> 		@WebMethod( operationName = "saveCustomer" )
> 		@WebResult( name = "saveCustomerResult" )
> 		public BackendServiceStatus saveCustomer( @WebParam( name = "auth" )
> ServiceAuthentication auth, @WebParam( name = "customer" ) Customer
> customer ); }
>
> </SNIP>
>
>
> <SNIP CXF Server>
>
> 	JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean ();
> 	sf.setServiceClass( ICustomerService.class );
> 	sf.setServiceBean( getServiceImplementation() ); --> returns the
> service impl bean from spring context ('CustomerServiceImpl')
> sf.setAddress(
> "http://localhost:8080/Shop_Backend/wsapi/CustomerService" );
>
> 	// additionally setup JAXB context
>
> 	Server server = sf.create();
>
> </SNIP>
>
> <SNIP CXF Client>
>
> 	JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> 	factory.setServiceClass( ICustomerService.class );
> 	factory.setAddress(
> "http://localhost:8080/Shop_Backend/wsapi/CustomerService" );
> ICustomerService client = (ICustomerService)factory.create();
>
> 	// call service
> 	BackendServiceStatus status = customerServiceProxy.saveCustomer(
> auth, customer );
>
> </SNIP>
>
> <SNIP spring context>
>
> 	<bean id="CustomerServiceImpl"
> class="com.ewerk.shop.backend.wsapi.customer.CustomerServiceImpl" />
> <jaxws:server	id="CustomerService"
> 				serviceBean="#CustomerServiceImpl"
> 				address="/CustomerService">
> 	</jaxws:server>
> </SNIP>
>
> ----------------------------------------------------------------------
>-----------------------------------------------------------------------
>-------------
>
> Any solution is really appreciated. Thanks in advance.
>
> Mit lieben Grüßen aus dem eWerk
>
>   |  Holger Stolzenberg
>   |  Softwareentwickler
>   |
>   |  Geschäftsführer:
>   |  Frank Richter, Erik Wende, Hendrik Schubert
>   |
>   |  eWerk IT GmbH
>   |  Markt 16
>   |  Leipzig 04109
>   |  http://www.ewerk.com
>   |  HRB 9065, AG Leipzig
>   |  Hauptniederlassung Leipzig
>   |
>   |  fon +49.341.4 26 49-0
>   |  fax +49.341.4 26 49-88
>   |  mailto:h.stolzenberg@ewerk.com
>   |
>   |  Support:
>   |  fon 0700 CALLME24 (0700 22556324)
>   |  fax 0700 CALLME24 (0700 22556324)
>   |
>   | Auskünfte und Angebote per Mail
>   | sind freibleibend und unverbindlich.



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog