Advance Java Interview Questions

So, which approach will you choose

Post Views: 39,539 The best practice is to use “contract-first”, and here is the link that explains this much better with examples –>  contract-first versus contract-last web services In a nutshell, the contract-last is more fragile than the “contract-first”.You will have to decide what is most appropriate based on your requirements, tool sets you use, etc. Note: More Java Web Services interview questions and answers including WSDL, SOAP, UDDI, JAXR, SAAJ, etc are covered in Java/J2EE Job Interview Companion with…

Read More

What are the pros and cons of each approach, and which approach would you prefer

Post Views: 39,442 Contract-first Web service PROS: Clients are decoupled from the server, hence the implementation logic can be revised on the server without affecting the clients. Developers can work simultaneously on client and server side based on the contract both agreed on. You have full control over how the request and response messages are constructed — for example, should “status” go as an element or as an attribute? The contract clearly defines it. You can change OXM (i.e. Object…

Read More

What are the different approaches to developing a SOAP based Web service

Post Views: 39,439 These two approaches The contract-first approach, where you define the contract first with XSD and WSDL and the generate the Java classes from the contract. The contract-last approach where you define the Java classes first and then generate the contract, which is the  WSDL file from the Java classes. Note: The WSDL describes all operations that the service provides, locations of the endpoints (i.e.e where the services can be invoked), and simple and complex elements that can…

Read More

Web services when you can use traditional style middle-ware such as RPC, CORBA, RMI and DCOM

Post Views: 39,404 The traditional middle-wares tightly couple connections to the applications and it can break if you make any modification to your application. Tightly coupled applications are hard to maintain and less reusable. Generally do not support heterogeneity. Do not work across Internet. Can be more expensive and hard to use. Web Services support loosely coupled connections. The interface of the Web service provides a layer of abstraction between the client and the server. The loosely coupled applications reduce…

Read More

What is the difference between SOA and a Web service

Post Views: 39,371 SOA is a software design principle and an architectural pattern for implementing loosely coupled, reusable and coarse grained services. You can implement SOA using any protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP (i.e. EJB uses IIOP), RPC etc. Messages can be in XML or Data Transfer Objects (DTOs). Web service is an implementation technology and one of the ways to implement SOA. You can build SOA basedapplications without using Web services – for example by…

Read More

How would you decide what style of Web Service to use? SOAP WS or REST

Post Views: 39,367 In general, a REST based Web service is preferred due to its simplicity, performance, scalability, and support for multiple data formats. SOAP is favored where service requires comprehensive support for security and transactionalreliability. The answer really depends on the functional and non-functional requirements. Asking the questions listed below will help you choose. Does the service expose data or business logic? (REST is a better choice for exposing data, SOAP WS might be a better choice for logic).Do…

Read More

What are the differences between both SOAP WS and RESTful WS

Post Views: 39,349 The SOAP WS supports both remote procedure call (i.e. RPC) and message oriented middle-ware (MOM) integration styles. The Restful Web Service supports only RPC integration style. The SOAP WS is transport protocol neutral. Supports multiple protocols like HTTP(S), Messaging, TCP, UDP SMTP, etc. The REST is transport protocol specific. Supports only HTTP or HTTPS protocols. The SOAP WS permits only XML data format.You define operations, which tunnels through the POST. The focus is on accessing the named…

Read More