JAX-WS stands for Java API for XML-Web Services. It is a standardized API for creating and Consuming SOAP Web Services. JAX-WS is one of the Java XML programming APIs. It’s a part of the Java SE and Java EE platforms It is XML based JAVA API to build web services server and client application
JAX-WS (Java API for XML Web Services) is a set of APIs for creating web services in XML format. According to oracle docs, web services can be defined as Web services are client and server applications that communicate over the World Wide Web’s (WWW) Hypertext Transfer Protocol (HTTP). Web services provide a standard means of inter operating between software applications running on a variety of platforms and frameworks. Main characteristics of the Web Services are: For example in simple words, when we call somebody so the person dialling and calling is the client application , while person receiving the call is server application and “hello” word is the protocol as similar to HTTP request . SOA (Service-Oriented Architecture) is an architectural pattern that makes possible for services to interact with one another independently. Web Services is a realization of SOA concept, that leverages XML, JSON, etc. and common Internet protocols such as HTTP(S), SMTP, etc. SOA is a system-level architectural style that tries to expose business. WOA is an interface-level architectural style that focuses on the means by which these service capabilities are exposed to consumers. SOAP (Simple Object Access Protocol) is a transport protocol for sending and receiving requests and responses on XML format, which can be used on top of transport protocols such as HTTP, SMTP, UDP, etc. REST (REpresentational State Transfer) is an architectural style by which data can be transmitted over transport protocol such as HTTP(S). Below are the main differences between REST and SOAP web service “REST vs SOAP” we can rephrase to “Simplicity vs Standard”. Of course, “Simplicity” with REST at most cases wins, it wins in performance, and scalability and support for multiple data formats, but SOAP is favoured where service requires comprehensive support for security (WS-security) and transactional safety (ACID). “SOAP” WSDL (Web Services Description Language) is an XML format for describing web services and how to access them. JAXB (Java Architecture for XML Binding) is a Java standard that defines how Java objects are converted from and to XML. It makes reading and writing of XML via Java relatively easy. Yes, we can send different formats such as PDF document, image or other binary file with soap messages as an attachment. Messages send using the binary data. SOAP messages are attached with MIME extensions that come in multipart/related. An example: MIME-Version: 1.0 Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml; start=”<claim061400a.xml@ interviewgig.com>” Content-Description: This is the optional message description. <?xml version=’1.0′ ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”> <SOAP-ENV:Body> .. <theSignedForm href=”cid:[email protected]”/> .. </SOAP-ENV:Body> </SOAP-ENV:Envelope> –MIME_boundary Content-Type: image/tiff Content-Transfer-Encoding: binary Content-ID: <[email protected]> …binary TIFF image… –MIME_boundary— MTOM (Message Transmission Optimization Mechanism) is a mechanism for transmitting large binary attachments with SOAP messages as raw bytes, allowing for smaller messages. XOP (XML-binary Optimized Packaging) is a mechanism defined for the serializationof XML Information Sets that contain binary data, as well as deserialization back into the XML Information Set. SOAP envelop element is the root element of a SOAP message which defines the XML document as a SOAP message. An example: <?xml version=”1.0″?> <soap:Envelope xmlns:soap=”http://www.w3.org/2001/12/soap-envelope” soap:encodingStyle=”http://www.w3.org/2001/12/soap-encoding”> … Message information … </soap:Envelope> SOAP namespace defines the Envelope as a SOAP Envelope. An example: xmlns:soap=http://www.w3.org/2001/12/soap-envelope SOAP encoding is a method for structuring the request which is suggested within the SOAP specification, known as the SOAP serialization. SOAP encodingStyle defines the serialization rules used in a SOAP message. This attribute may appear on any element, and is scoped to that element’s contents and all child elements not themselves containing such an attribute. There is no default encoding defined for a SOAP message. An example: SOAP-ENV:encodingStyle=”http://www.w3.org/2001/12/soap-encoding” A header entry is identified by its fully qualified element name, which consists of the namespace URI and the local name. All immediate child elements of the SOAP Header element must be namespace-qualified. The SOAP encodingStyle attribute may be used to indicate the encoding style used for the header entries. The SOAP mustUnderstand attribute and SOAP actor attribute may be used to indicate how to process the entry and by whom. The wsimport tool is used to parse an existing Web Services Description Language (WSDL) file and generate required files (JAX-WS portable artifacts) for web service client to access the published web services: https://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html The wsgen tool is used to parse an existing web service implementation class and generates required files (JAX-WS portable artifacts) for web service deployment: http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsgen.html SOAPUI tool for SOAP WS: http://www.soapui.org/ SOAP is simple to use and it is non – symmetrical unlike DCOM or CORBA is highly popular and usually have complexity in them. SOAP provides greater platform independent with the language independence unlike DCOM or CORBA doesn’t provide any of these. SOAP uses HTTP as its transport protocol and the data are being saved in XML format that can be ready by human, whereas DCOM or CORBA have their own binary formats that are used to transport the data in complicated manner. SOAP identifies the object other than URL endpoint. SOAP objects are stateless and it is hard to maintain that. Whereas, it is not hard to maintain in case of other remote access techniques. A resource is a unique URL with representation of an object which we can get contents via GET and modify via PUT, POST, and DELETE. It is not possibly, because GET can’t change a resource. Need to use PUT when can update a resource completely through a specific resource. For example, if know that an article resides at http://interviewgig /article/123, can PUT a new resource representation of this article through a PUT on this URL. If do not know the actual resource location for instance, when add a new article, can use POST. PUT is idempotent, while POST is not. It means if use PUT an object twice, it has no effect. WADL (Web Application Description Language) is a XML description of a deployed RESTful web application. Jersey, Restlet, EasyRest, etc. Restlet is a lightweight, comprehensive, open source RESTful web API framework for the Java platform. It has advantages such as Jersey is open source framework for developing RESTful Web Services in Java that provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339) Reference Implementation. It has advantages such as RESTeasy is a JBoss project, which implements of the JAX-RS specification. It has benefits such as In Ajax, the request are sent to the server by using XMLHttpRequest objects; REST have a URL structure and a request/response pattern the revolve around the use of resources; Ajax eliminates the interaction between the customer and server asynchronously; REST requires the interaction between the customer and server; Ajax is a set of technology; REST is a type of software architecture and a method for users to request data or information from servers.What is JAX-WS?
What are web services?
What is the difference between SOA and a web service?
What is SOAP?
What is REST?
What is the difference between a REST web service and a SOAP web service?
How to decide which one of web service to use REST or SOAP?
What is WSDL?
What is JAXB?
Can we send soap messages with attachments?
What is MTOM?
What is XOP?
What is a SOAP envelope element?
What does a SOAP namespace defines?
What is the SOAP encoding?
What does SOAP encodingStyle attribute defines?
What are 2 styles web service’s endpoint by using JAX-WS?
What is encoding rules for header entries?
What is the wsimport tool?
What is the wsgen tool?
What the tool are required to test SOAP services?
What is the difference between SOAP and other remote access techniques?
What is a resource in a REST?
What are HTTP methods supported by REST?
Whether can use GET request instead of POST to create a resource?
What is the difference between PUT and POST?
What is WADL?
What are frameworks available to implement REST web services?
What is the Restlet framework?
What is the Jersey framework?
What is the RESTeasy framework?
What is the difference between AJAX and REST?
Related posts:
- Core Java Interview Questions and Answers
- Hibernate Interview Questions and Answers 2021
- Java Multithreading Interview Question and Answers
- Java Threading Interview Questions and Answers
- JBOSS Interview Questions and Answers
- JDBC Interview Questions and Answers
- JSF Interview Questions and Answers
- Portal and Portlet Interview Questions and Answers