Ronaldo Lanhellas
Ronaldo Lanhellas

Reputation: 3356

Using webservices with javax.ws or javax.jws

I'm starting to choose a way to create my webservice, so i found 2 ways to do it:

1) Using the package javax.jws, with annotation @WebService:

 @WebService(...)
public class MyServiceImpl {

2) The other way is using javax.ws, with annotation @Path:

@Path("/MyService")
public class MyServiceImpl

In my understand using the second solution is more simple, because when i need to create the Client i just need make a HTTP call (GET/POST). Using the first solution i need create a WSDL client, more complex solution.

So, I would like to know which is the advantage in use FIRST SOLUTION.

Upvotes: 2

Views: 957

Answers (1)

EL missaoui habib
EL missaoui habib

Reputation: 1075

The SOAP/WSDL style is useful when a formal contract must be established to describe the interface that the web service offers.The Web Services Description Language (WSDL) describes the details such as messages, operations, bindings, and location of the web service.

Also the SOAP/WSDL style is useful when the application architecture needs to handle asynchronous processing and invocation (e.g. using JAX-WS the assynchronous clients can be created).

The disadvantages of SOAP/WSDL style are

its complexity: tools are required to create a client heavier on Bandwidth : SOAP requires a heavy XML wrapper arround each request or response complicated security rules

The advantages of REST style are

simplicity: REST client can be accessed from any browser (however, this is only true for GET method. Data creation request requires also the XML wrapper). lighter on Bandwidth : data on the wire are usually bare xml elements (not wrapped within the <Envelope><Body> tags). REST application security rules can be setup using the http standards: the administrator (or firewall) can discern the intent of each message by analyzing the HTTP command used in the request. For example, a GET request can always be considered safe because it can't, by definition, modify any data.

The disadvantage of REST style is that it still doesn't cover all business requirements

There is no common standard accepted yet for the formal REST service description REST requests (especially GET method) are not suitable for large amount of data REST doesn't cover all web services standards, like Transactions, Security, Addressing, Trust, Coordination,

Upvotes: 1

Related Questions