Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX-WS - please help convert proxy to BindingProvider for HTTP auth

 
Jonah Black
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I'm running eclipse 3.6, tomcat 5.5 config, metro 2.0.1.

I am setting up a WS using basic http authentication, and it works in the browser, I get prompted for the user name and password, I enter it and can access the necessary wsdl

The service looks like this -

@WebService(serviceName="wsofferssvc")
public class wsoffers {

@WebMethod
@RolesAllowed(value = {"basicUser"})
public String offerlist(String id)
{
return id;
}
}


I then create a web service client in eclipse, point to the wsdl and i get the classes:

Wsoffers.java
WsoffersPortBindingStub.java
WsoffersProxy.java

Wsoffersssvc.java

wsofferssvcLocator.java.



I create an instance which works without authentication, using the Proxy object

WsoffersProxy x = new WsoffersProxy();

This works, but now with the authentication set up I need to call code similar to this, right?:

/*
HelloService service = new HelloService();
Hello proxy = (service.getHelloPort());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "userfoo");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "passbar");
*/

but using the wsoffersProxy I cannot get the BindingProvider.

How do I do that, since the wsdl is already imported and the classes mentioned above already created?

This must be simple, but I cannot figure out which object to cast. Is the WsoffersProxy the right object to use?

thanks in advance.




 
Jonah Black
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this works in netbeans btw.

so is it eclipse?
 
Jonah Black
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't import the service using eclipse I've found.

use wsimport.

resolved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic