Links: Table of Contents | Single HTML | Single PDF

FAQ

Table of Contents

1. Does JAX-WS 2.0 support JAX-RPC 1.X?
2. What is the difference between JAX-RPC and JAX-WS ?
3. Can a JAX-WS and a JAX-RPC based service co-exist?
4. Is it downloadable from maven repository ?
5. How do I find out which version of the JAX-WS RI I'm using?
6. How can I change the Web Service address dynamically for a request ?
7. How do I do basic authentication in JAX-WS ?
8. Which standards are supported by JAXWS?

1. Does JAX-WS 2.0 support JAX-RPC 1.X?

No. Although, JAX-WS's roots come from JAX-RPC, JAX-WS is a completely different component than JAX-RPC.

2. What is the difference between JAX-RPC and JAX-WS ?

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.

3.  Can a JAX-WS and a JAX-RPC based service co-exist?

Yes.

4.  Is it downloadable from maven repository ?

Yes from https://maven.java.net/content/repositories/releases/com/sun/xml/ws.

5. How do I find out which version of the JAX-WS RI I'm using?

Run the following command

$ wsgen or wsimport -version

Alternatively, each JAX-WS jar has version information in its META-INF/MANIFEST.MF.

6. How can I change the Web Service address dynamically for a request ?

((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "..."); 
            

7. How do I do basic authentication in JAX-WS ?

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.

  • Use java.net.Authenticator class in your client application.
  • Provide a local access to the WSDL using catalog. There is a catalog sample in the jax-ws distribution.
  • Configure web.xml to allow GET requests without authentication

8. Which standards are supported by JAXWS?

  • 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

  • MTOM