• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
don't import the service using eclipse I've found.

use wsimport.

resolved.
 
Would you like to try a free sample? Today we are featuring tiny ads:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic