Re: AW: trying to use ClientProxyFactoryBean but failing

2008-03-11 Thread h.stolzenberg

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 cxf

Re: trying to use ClientProxyFactoryBean but failing

2008-03-10 Thread Daniel Kulp

You're getting HTML back for some reason instead of a soap message.

My only suggestion would be to do:

client.getInInterceptor().add(new 
org.apache.cxf.interceptor.LoggingInInterceptor());

and see what it prints out.  The HTML might give a clue.

Dan



On Friday 07 March 2008, Daniel Lipofsky wrote:
 username/password are not wrong because I used the same
 username/password for each method and the first one works.

 I tried the change you suggested and now I get a different
 error.  Does this give you any more info?

   ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
   factory.setServiceClass(TxPortType.class);
   factory.setUsername(me);
   factory.setPassword(hello);
   factory.setAddress(http://localhost/ws/services/Tx;);
   TxPortType port = (TxPortType)factory.create();
   Client client = factory.getClientFactoryBean().getClient();
   HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
   httpConduit.getClient().setAllowChunking(false);
   httpConduit.getClient().setAutoRedirect(true);
   port.getObjects(new ArrayListSearchTerm(0), 0, 0);

 org.apache.cxf.binding.soap.SoapFault: No namespace on html element.
 at
 org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
es sage(ReadHeadersInterceptor.java:88)
 at
 org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
es sage(ReadHeadersInterceptor.java:56)
 at
 org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
rC hain.java:208)
 at
 org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429) at
 org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe
sp onse(HTTPConduit.java:1955)
 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)
 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.main(WSClient1.java:33)

 Thanks,
 Dan

 On Friday 07 March 2008, Daniel Kulp wrote:
  Your error is a bit strange.   It looks like it could be one of:
 
  1) The name/password might be wrong or something and the server is
  re-asking you to authenticate
 
  2) The server might be sending a redirect.
 
  You might want to put a wireshark/tcpdump trace on it to see what
  the server is sending back.
 
  That said, you can also try turning off the streaming and
  turning on the
  auto redirects.   Performance will be slightly lower (has to
  buffer the
  full message), but it can then retry the request.
 
   TxService txService = new TxService();
   TxPortType txPort = txService.getTxPort();
   Client client = ClientProxy.getClient(txPort);
   HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
   httpConduit.getClient().setAllowChunking(false);
   httpConduit.getClient().setAutoRedirect(true);
  ...
 
  Dan
 
  On Thursday 06 March 2008, Daniel Lipofsky wrote:
   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$MessageSenderEnd
 in
 
  gI nterceptor.handleMessage(MessageSenderInterceptor.java:64)
   at
 
  org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep
 to
 
  rC hain.java:208)
   at
 
  org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
 
   at
 
  org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
 

RE: trying to use ClientProxyFactoryBean but failing

2008-03-10 Thread Daniel Lipofsky
Ah, I should have though of that.
It's very informative.

The HTML I am getting back basically says it is a 401 error
with the message This request requires HTTP authentication.

It appears the auth info in not getting transmitted.
I added logging interceptors for both IN and OUT.
On the outbound I see

Headers: {SOAPAction=[], Accept=[*]}

If I use the other technique (where I call new
TxService().getTxPort() and add the auth to the
getRequestContext() map) I see

Headers: {Authorization=[Basic .=], SOAPAction=[], Accept=[*]}

So I tried this and it seemed to work for authorization:

  ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
  factory.setServiceClass(TxPortType.class);
  factory.setAddress(http://localhost/ws/services/Tx;);
  TxPortType port = (TxPortType)factory.create();
  Client client = factory.getClientFactoryBean().getClient();
  HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
  AuthorizationPolicy authorization = new AuthorizationPolicy();
  authorization.setUserName(...);
  authorization.setPassword(...);
  httpConduit.setAuthorization(authorization);
  ...
  port.getObjects(new ArrayListSearchTerm(0), 0, 0);




*BUT* now my next problem.  I am getting


 org.apache.cxf.binding.soap.SoapFault: Message part
 {http://jaxws.impl.ws.core.bricsnet.com/}getObjects was not recognized.

That namespace is clearly wrong, it should be using
{http://www.bricsnet.com/Tx}.  I can see the wrong namespace
in the outbound soap message.  But how do I fix that?

Thanks,
Dan



On Monday 10 March 2008, Daniel Kulp wrote:
 
 You're getting HTML back for some reason instead of a soap message.
 
 My only suggestion would be to do:
 
 client.getInInterceptor().add(new 
 org.apache.cxf.interceptor.LoggingInInterceptor());
 
 and see what it prints out.  The HTML might give a clue.
 
 Dan
 
 
 
 On Friday 07 March 2008, Daniel Lipofsky wrote:
  username/password are not wrong because I used the same
  username/password for each method and the first one works.
 
  I tried the change you suggested and now I get a different
  error.  Does this give you any more info?
 
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(TxPortType.class);
factory.setUsername(me);
factory.setPassword(hello);
factory.setAddress(http://localhost/ws/services/Tx;);
TxPortType port = (TxPortType)factory.create();
Client client = factory.getClientFactoryBean().getClient();
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
httpConduit.getClient().setAllowChunking(false);
httpConduit.getClient().setAutoRedirect(true);
port.getObjects(new ArrayListSearchTerm(0), 0, 0);
 
  org.apache.cxf.binding.soap.SoapFault: No namespace on html
element.
...


RE: trying to use ClientProxyFactoryBean but failing

2008-03-10 Thread Daniel Lipofsky
Yes it does.  That works!
Thanks,
Dan 

Willem Jiang wrote:
 
 Hi,
 
 Do your TxPortType.class has the @WebService annotation?
 If so, please use the JaxWsClientFactoryBean which will take care of 
 this annotation to create the proxy.
 Here is the  code snippet.
 
 ClientProxyFactoryBean factory = new 
 ClientProxyFactoryBean(new JaxWsClientFactoryBean());
 
 ...
 
 
 Willem.
 
 Daniel Lipofsky wrote:
  Ah, I should have though of that.
  It's very informative.
 
  The HTML I am getting back basically says it is a 401 error
  with the message This request requires HTTP authentication.
 
  It appears the auth info in not getting transmitted.
  I added logging interceptors for both IN and OUT.
  On the outbound I see
 
  Headers: {SOAPAction=[], Accept=[*]}
 
  If I use the other technique (where I call new
  TxService().getTxPort() and add the auth to the
  getRequestContext() map) I see
 
  Headers: {Authorization=[Basic .=], SOAPAction=[],
Accept=[*]}
 
  So I tried this and it seemed to work for authorization:
 
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(TxPortType.class);
factory.setAddress(http://localhost/ws/services/Tx;);
TxPortType port = (TxPortType)factory.create();
Client client = factory.getClientFactoryBean().getClient();
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
AuthorizationPolicy authorization = new AuthorizationPolicy();
authorization.setUserName(...);
authorization.setPassword(...);
httpConduit.setAuthorization(authorization);
...
port.getObjects(new ArrayListSearchTerm(0), 0, 0);
 
 
  *BUT* now my next problem.  I am getting
 
 
   org.apache.cxf.binding.soap.SoapFault: Message part
   {http://jaxws.impl.ws.core.bricsnet.com/}getObjects was 
 not recognized.
 
  That namespace is clearly wrong, it should be using
  {http://www.bricsnet.com/Tx}.  I can see the wrong namespace
  in the outbound soap message.  But how do I fix that?
 
  Thanks,
  Dan
 
 
 
  On Monday 10 March 2008, Daniel Kulp wrote:

  You're getting HTML back for some reason instead of a soap message.
 
  My only suggestion would be to do:
 
  client.getInInterceptor().add(new 
  org.apache.cxf.interceptor.LoggingInInterceptor());
 
  and see what it prints out.  The HTML might give a clue.
 
  Dan


AW: trying to use ClientProxyFactoryBean but failing

2008-03-07 Thread Holger Stolzenberg
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: trying to use ClientProxyFactoryBean but failing

2008-03-07 Thread Daniel Kulp


Your error is a bit strange.   It looks like it could be one of:

1) The name/password might be wrong or something and the server is 
re-asking you to authenticate

2) The server might be sending a redirect.

You might want to put a wireshark/tcpdump trace on it to see what the 
server is sending back.

That said, you can also try turning off the streaming and turning on the 
auto redirects.   Performance will be slightly lower (has to buffer the 
full message), but it can then retry the request.

 TxService txService = new TxService();
 TxPortType txPort = txService.getTxPort();
 Client client = ClientProxy.getClient(txPort);
 HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
 httpConduit.getClient().setAllowChunking(false);
 httpConduit.getClient().setAutoRedirect(true);
...

Dan




On Thursday 06 March 2008, Daniel Lipofsky wrote:
 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


Re: AW: trying to use ClientProxyFactoryBean but failing

2008-03-07 Thread Daniel Kulp

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


RE: trying to use ClientProxyFactoryBean but failing

2008-03-07 Thread Daniel Lipofsky

username/password are not wrong because I used the same
username/password for each method and the first one works.

I tried the change you suggested and now I get a different
error.  Does this give you any more info?

  ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
  factory.setServiceClass(TxPortType.class);
  factory.setUsername(me);
  factory.setPassword(hello);
  factory.setAddress(http://localhost/ws/services/Tx;);
  TxPortType port = (TxPortType)factory.create();
  Client client = factory.getClientFactoryBean().getClient();
  HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
  httpConduit.getClient().setAllowChunking(false);
  httpConduit.getClient().setAutoRedirect(true);
  port.getObjects(new ArrayListSearchTerm(0), 0, 0);

org.apache.cxf.binding.soap.SoapFault: No namespace on html element.
at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor.java:88)
at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMes
sage(ReadHeadersInterceptor.java:56)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:208)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
onse(HTTPConduit.java:1955)
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)
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.main(WSClient1.java:33) 

Thanks,
Dan

On Friday 07 March 2008, Daniel Kulp wrote:
 
 Your error is a bit strange.   It looks like it could be one of:
 
 1) The name/password might be wrong or something and the server is 
 re-asking you to authenticate
 
 2) The server might be sending a redirect.
 
 You might want to put a wireshark/tcpdump trace on it to see what the 
 server is sending back.
 
 That said, you can also try turning off the streaming and 
 turning on the 
 auto redirects.   Performance will be slightly lower (has to 
 buffer the 
 full message), but it can then retry the request.
 
  TxService txService = new TxService();
  TxPortType txPort = txService.getTxPort();
  Client client = ClientProxy.getClient(txPort);
  HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
  httpConduit.getClient().setAllowChunking(false);
  httpConduit.getClient().setAutoRedirect(true);
 ...
 
 Dan
 
 
 
 
 On Thursday 06 March 2008, Daniel Lipofsky wrote:
  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 

trying to use ClientProxyFactoryBean but failing

2008-03-06 Thread Daniel Lipofsky
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