Table of Contents
No. Although, JAX-WS's roots come from JAX-RPC, JAX-WS is a completely different component than JAX-RPC.
One of the main difference between JAX-RPC and JAX-WS is the programming model. A JAX-WS based service uses annotations (such @WebService) to declare webservice endpoints. Use of these annotations obviates the need for deployment descriptors. With JAX-WS, you can have a webservice deployed on a Java EE compliant application server without a single deployment descriptor. Apart from these, other additional features (such asynchronous callbacks etc) are also present.
Run the following command
$ wsgen or wsimport -version
Alternatively, each JAX-WS jar has version information in its META-INF/MANIFEST.MF.
You can do the following:
HelloService service = new HelloService(); Hello proxy = (service.getHelloPort()); ((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "userfoo"); ((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "passbar");
USERNAME_PROPERTY, PASSWORD_PROPERTY are used primarily for service requests. I think when you instantiate Service, it fetches WSDL and the server is returning 401. You could try any one of the following solutions.
Web Services Addressing 1.0 - Core
Web Services Addressing 1.0 - SOAP Binding
Web Services Addressing 1.0 - Metadata
Web Services Addressing 1.0 - WSDL Binding (RI specific support)
WS-Addressing - Member Submission
SOAP 1.1 and 1.2
REST and XML/HTTP
WS-I Basic Profile 1.2 and 2.0
WS-I Simple SOAP Binding Profile 1.0
WS-I Attachment Profile 1.0