cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: trying to use ClientProxyFactoryBean but failing
Date Mon, 10 Mar 2008 18:17:28 GMT

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 ArrayList<SearchTerm>(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();
> > >   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$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)
> >
> > >     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(HttpURLCo
> >nn
> >
> > >ec tion.java:1012)
> > >     at
> >
> > java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:36
> >7)
> >
> > >     at
> >
> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handle
> >Re
> >
> > >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$MessageSenderEnd
> >in
> >
> > >gI nterceptor.handleMessage(MessageSenderInterceptor.java:62)
> > >     ... 8 more
> > >
> > >
> > > Thanks,
> > > Dan
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



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

Mime
View raw message