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();
>   Map<String, 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

Reply via email to