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 ArrayList<SearchTerm>(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 ArrayList<SearchTerm>(0), 0, 0);
> >
> > org.apache.cxf.binding.soap.SoapFault: No namespace on "html"
element.
...

Reply via email to