Re: AW: trying to use ClientProxyFactoryBean but failing
Thanks a lot Dan, your fix worked. Now we can run our complete test suite again. Using CXF 2.0.2, not sure but, I remember having cxf-rt-transports-http-jetty artefact on classpath without specifying explicitly in the POM what is now neccessary for 2.0.4. Also not sure about the spring import declaration for the jetty extension. Just a suggestion: Maybe a better error message could help the users identify the problem ?? dkulp wrote: Your case is very different. I honestly have no idea how that would have worked even with 2.0.2. In your case, your client is specifically using the URL: http://localhost:8080/cxf/TestService However, your service is using some Mock thing that isn't opening up any port. The simple fix is to change your cxf.context.xml to remove the import of cxf-servlet and add: import resource=classpath:META-INF/cxf/cxf-extension-http-jetty.xml / Thus, when the service pops up, jetty will properly open the port, the client will connect, the test passes. Maybe we had some sort of dependency issue with 2.0.2 that cxf-servlet also brought in jetty or something like that that is now fixed. Don't really know. Dan On Friday 07 March 2008, Holger Stolzenberg wrote: I can´t tell you whats going on, just wanted to mention that it seems that your problem is related to mine, which I originally postet under thread http://www.nabble.com/-2.0.4--Service-unit-tests-fail-after-upgrade-fr om-2.0.2-to15610639.html Somehow my last response on that thread didn´t make it to the list. What I can say is that this probable issue also happens with CXF 2.0.2. I have put together a simple maven test project that can reproduce the issue. It is available under: http://lando23.net/simple-cxf-test.zip (12,6 KB) The project contains a simple service interface+impl, 1 spring config file and 1 test case. Running 'mvn test' will throw the exception described by Dan Lipofsky. Maybe someone of the CXF crew can have a look at it ;-) Thanks in advance -Ursprüngliche Nachricht- Von: Daniel Lipofsky [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 7. März 2008 01:00 An: cxf-user@incubator.apache.org Betreff: trying to use ClientProxyFactoryBean but failing Can anyone tell me why the first form works but the second doesn't? I am trying to start using the factory stuff but it is failing. What am I doing wrong? Works: TxService txService = new TxService(); TxPortType txPort = txService.getTxPort(); MapString, Object context = ((BindingProvider) txPort).getRequestContext(); context.put(BindingProvider.USERNAME_PROPERTY, me); context.put(BindingProvider.PASSWORD_PROPERTY, hello); context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, http://localhost/ws/services/Tx;); txPort.getObjects(searchTerms, 0, 0); Fails: ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); factory.setServiceClass(TxPortType.class); factory.setUsername(me); factory.setPassword(hello); factory.setAddress(http://localhost/ws/services/Tx;); TxPortType client = (TxPortType)factory.create(); client.getObjects(searchTerms, 0, 0); Error: org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin gI nterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto rC hain.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.frontend.ClientProxy.invoke(ClientProxy.java:68) at $Proxy36.getObjects(Unknown Source) at client.WSClient1.download(WSClient1.java:41) at client.WSClient1.main(WSClient1.java:29) Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConn ec tion.java:1012) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe sp onse(HTTPConduit.java:1863) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HT TP Conduit.java:1791) 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 gI nterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 8 more Thanks, Dan -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog -- View this message in context: http://www.nabble.com/trying-to-use-ClientProxyFactoryBean-but-failing-tp15887234p15975706.html Sent from the
AW: trying to use ClientProxyFactoryBean but failing
I can´t tell you whats going on, just wanted to mention that it seems that your problem is related to mine, which I originally postet under thread http://www.nabble.com/-2.0.4--Service-unit-tests-fail-after-upgrade-from-2.0.2-to15610639.html Somehow my last response on that thread didn´t make it to the list. What I can say is that this probable issue also happens with CXF 2.0.2. I have put together a simple maven test project that can reproduce the issue. It is available under: http://lando23.net/simple-cxf-test.zip (12,6 KB) The project contains a simple service interface+impl, 1 spring config file and 1 test case. Running 'mvn test' will throw the exception described by Dan Lipofsky. Maybe someone of the CXF crew can have a look at it ;-) Thanks in advance -Ursprüngliche Nachricht- Von: Daniel Lipofsky [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 7. März 2008 01:00 An: cxf-user@incubator.apache.org Betreff: trying to use ClientProxyFactoryBean but failing Can anyone tell me why the first form works but the second doesn't? I am trying to start using the factory stuff but it is failing. What am I doing wrong? Works: TxService txService = new TxService(); TxPortType txPort = txService.getTxPort(); MapString, Object context = ((BindingProvider) txPort).getRequestContext(); context.put(BindingProvider.USERNAME_PROPERTY, me); context.put(BindingProvider.PASSWORD_PROPERTY, hello); context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, http://localhost/ws/services/Tx;); txPort.getObjects(searchTerms, 0, 0); Fails: ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); factory.setServiceClass(TxPortType.class); factory.setUsername(me); factory.setPassword(hello); factory.setAddress(http://localhost/ws/services/Tx;); TxPortType client = (TxPortType)factory.create(); client.getObjects(searchTerms, 0, 0); Error: org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI nterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC hain.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.frontend.ClientProxy.invoke(ClientProxy.java:68) at $Proxy36.getObjects(Unknown Source) at client.WSClient1.download(WSClient1.java:41) at client.WSClient1.main(WSClient1.java:29) Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec tion.java:1012) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp onse(HTTPConduit.java:1863) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP Conduit.java:1791) 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$MessageSenderEndingI nterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 8 more Thanks, Dan
Re: AW: trying to use ClientProxyFactoryBean but failing
Your case is very different. I honestly have no idea how that would have worked even with 2.0.2. In your case, your client is specifically using the URL: http://localhost:8080/cxf/TestService However, your service is using some Mock thing that isn't opening up any port. The simple fix is to change your cxf.context.xml to remove the import of cxf-servlet and add: import resource=classpath:META-INF/cxf/cxf-extension-http-jetty.xml / Thus, when the service pops up, jetty will properly open the port, the client will connect, the test passes. Maybe we had some sort of dependency issue with 2.0.2 that cxf-servlet also brought in jetty or something like that that is now fixed. Don't really know. Dan On Friday 07 March 2008, Holger Stolzenberg wrote: I can´t tell you whats going on, just wanted to mention that it seems that your problem is related to mine, which I originally postet under thread http://www.nabble.com/-2.0.4--Service-unit-tests-fail-after-upgrade-fr om-2.0.2-to15610639.html Somehow my last response on that thread didn´t make it to the list. What I can say is that this probable issue also happens with CXF 2.0.2. I have put together a simple maven test project that can reproduce the issue. It is available under: http://lando23.net/simple-cxf-test.zip (12,6 KB) The project contains a simple service interface+impl, 1 spring config file and 1 test case. Running 'mvn test' will throw the exception described by Dan Lipofsky. Maybe someone of the CXF crew can have a look at it ;-) Thanks in advance -Ursprüngliche Nachricht- Von: Daniel Lipofsky [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 7. März 2008 01:00 An: cxf-user@incubator.apache.org Betreff: trying to use ClientProxyFactoryBean but failing Can anyone tell me why the first form works but the second doesn't? I am trying to start using the factory stuff but it is failing. What am I doing wrong? Works: TxService txService = new TxService(); TxPortType txPort = txService.getTxPort(); MapString, Object context = ((BindingProvider) txPort).getRequestContext(); context.put(BindingProvider.USERNAME_PROPERTY, me); context.put(BindingProvider.PASSWORD_PROPERTY, hello); context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, http://localhost/ws/services/Tx;); txPort.getObjects(searchTerms, 0, 0); Fails: ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); factory.setServiceClass(TxPortType.class); factory.setUsername(me); factory.setPassword(hello); factory.setAddress(http://localhost/ws/services/Tx;); TxPortType client = (TxPortType)factory.create(); client.getObjects(searchTerms, 0, 0); Error: org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin gI nterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto rC hain.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.frontend.ClientProxy.invoke(ClientProxy.java:68) at $Proxy36.getObjects(Unknown Source) at client.WSClient1.download(WSClient1.java:41) at client.WSClient1.main(WSClient1.java:29) Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConn ec tion.java:1012) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe sp onse(HTTPConduit.java:1863) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HT TP Conduit.java:1791) 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 gI nterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 8 more Thanks, Dan -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog