permaculture playing cards*
The moose likes Web Services and the fly likes JAX-WS - please help convert proxy to BindingProvider for HTTP auth Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS - please help convert proxy to BindingProvider for HTTP auth" Watch "JAX-WS - please help convert proxy to BindingProvider for HTTP auth" New topic
Author

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

Jonah Black
Greenhorn

Joined: Dec 26, 2010
Posts: 4
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

Joined: Dec 26, 2010
Posts: 4
this works in netbeans btw.

so is it eclipse?
Jonah Black
Greenhorn

Joined: Dec 26, 2010
Posts: 4
don't import the service using eclipse I've found.

use wsimport.

resolved.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX-WS - please help convert proxy to BindingProvider for HTTP auth
 
Similar Threads
How to add the security header in SOAP request?
Change address location webservice
JAX-WS Authentication problem -javax.xml.ws.WebServiceException Response: '401: Unauthorized'
WebServiceException: HTTP Status-Code 404
JAX-WS Consuming Exchange Web Services with java using glassfish, error authentication: Unauthorized