Objective:
In the previous article How to validate XML against XSD in java we have learned about XML validation method. In this article we will learn about Role of XML in java platform, Introducing web services concept, Web services standard, API’s and tools to develop Java Services.
XML:
XML is a simple text based language which was designed to store and transport data in plain text format. It stands for Extensible Markup Language. Following are some of the salient features of XML.
XML is a markup language.
XML is a tag based language like HTML.
XML tags are not predefined like HTML.
You can define your own tags which is why it is called extensible language.
XML tags are designed to be self descriptive.
XML is W3C Recommendation for data storage and transport.
Example:
<?xml version="1.0"?>
<Class>
<Name>First</Name>
<Sections>
<Section>
<Name>A</Name>
<Students>
<Student>Rohan</Student>
<Student>Mohan</Student>
<Student>Sohan</Student>
<Student>Lalit</Student>
<Student>Vinay</Student>
</Students>
</Section>
<Section>
<Name>B</Name>
<Students>
<Student>Robert</Student>
<Student>Julie</Student>
<Student>Kalie</Student>
<Student>Michael</Student>
</Students>
</Section>
</Sections>
</Class>
Role of XML in Java Platform:
The features of XML and Java are:
- Platform Independent
- Security
- Scalability
- Reliability
The advantages of developing Web application using XML are:
- Supports Exchange of data between heterogeneous databases and Systems.
- Distributes data processing load to the web browser.
- Integrates Java servers with Web browsers.
- XML is the natural choice of developing enterprise level web applications using java because of its data portability and platform independence features.
- Developers can implement the platform independent features of java to develop applications and exchange application data using XML.
Web services concept:
Web Services tutorial is designed for beginners and professionals providing basic and advanced concepts of web services such as protocols, SOAP, RESTful, java web service implementation, JAX-WS and JAX-RS tutorials and examples.
A Web Service is can be defined by following ways:
- is a client server application or application component for communication.
- method of communication between two devices over network.
- is a software system for interoperable machine to machine communication.
- is a collection of standards or protocols for exchanging information between two devices or application.
- SOAP: SOAP is an acronym for Simple Object Access Protocol.
SOAP is a W3C recommendation for communication between applications.
SOAP is XML based, so it is platform independent and language independent. In other words, it can be used with Java, .Net or PHP language on any platform.
2. WSDL: WSDL is an acronym for Web Services Description Language.
WSDL is a xml document containing information about web services such as method name, method parameter and how to access it.
WSDL is a part of UDDI. It acts as a interface between web service applications.
WSDL is pronounced as wiz-dull.
3. UDDI: UDDI is an acronym for Universal Description, Discovery and Integration.
UDDI is a XML based framework for describing, discovering and integrating web services.
UDDI is a directory of web service interfaces described by WSDL, containing information about web services.
UDDI is an XML-based standard for describing, publishing, and finding web services.
- UDDI stands for Universal Description, Discovery, and Integration.
- UDDI is a specification for a distributed registry of web services.
- UDDI is a platform-independent, open framework.
- UDDI can communicate via SOAP, CORBA, Java RMI Protocol.
- UDDI uses Web Service Definition Language(WSDL) to describe interfaces to web services.
- UDDI is seen with SOAP and WSDL as one of the three foundation standards of web services.
- UDDI is an open industry initiative, enabling businesses to discover each other and define how they interact over the Internet.
- PIP2A2 : Enables a partner to query another for product information.
- PIP3A2 : Enables a partner to query the price and availability of specific products.
- PIP3A4 : Enables a partner to submit an electronic purchase order and receive acknowledgment of the order.
- PIP3A3 : Enables a partner to transfer the contents of an electronic shopping cart.
- PIP3B4 : Enables a partner to query the status of a specific shipment.
RESTful web services:
RESTful web services are built to work best on the Web. Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. In the REST architectural style, data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web. The resources are acted upon by using a set of simple), well-defined operations. The REST architectural style constrains an architecture to a client/server architecture and is designed to use a stateless communication protocol, typically HTTP. In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.
The following principles encourage RESTful applications to be simple, lightweight, and fast:
- Resource identification through URI: A RESTful web service exposes a set of resources that identify the targets of the interaction with its clients. Resources are identified by URIs, which provide a global addressing space for resource and service discovery. See The @Path Annotation and URI Path Templates for more information.
- Uniform interface: Resources are manipulated using a fixed set of four create, read, update, delete operations: PUT, GET, POST, and DELETE. PUT creates a new resource, which can be then deleted by using DELETE. GET retrieves the current state of a resource in some representation. POST transfers a new state onto a resource. See Responding to HTTP Methods and Requests for more information.
- Self-descriptive messages: Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others. Metadata about the resource is available and used, for example, to control caching, detect transmission errors, negotiate the appropriate representation format, and perform authentication or access control. See Responding to HTTP Methods and Requests and Using Entity Providers to Map HTTP Response and Request Entity Bodies for more information.
- Stateful interactions through hyperlinks: Every interaction with a resource is stateless; that is, request messages are self-contained. Stateful interactions are based on the concept of explicit state transfer. Several techniques exist to exchange state, such as URI rewriting, cookies, and hidden form fields. State can be embedded in response messages to point to valid future states of the interaction. See Using Entity Providers to Map HTTP Response and Request Entity Bodies and “Building URIs” in the JAX-RS Overview document for more information.
API's:
JAXP:
The Java API for XML Processing (JAXP) is for processing XML data using applications written in the Java programming language.
JAXP leverages the parser standards Simple API for XML Parsing (SAX) and Document Object Model (DOM) so that you can choose to parse your data as a stream of events or to build an object representation of it.
JAXP also supports the Extensible Stylesheet Language Transformations (XSLT) standard, giving you control over the presentation of the data and enabling you to convert the data to other XML documents or to other formats, such as HTML.
JAXP also provides namespace support, allowing you to work with DTDs that might otherwise have naming conflicts. Finally, as of version 1.4, JAXP implements the Streaming API for XML (StAX) standard.
Designed to be flexible, JAXP allows you to use any XML-compliant parser from within your application. It does this with what is called a pluggability layer, which lets you plug in an implementation of the SAX or DOM API.
The pluggability layer also allows you to plug in an XSL processor, letting you control how your XML data is displayed.
SAX:
This lesson focuses on the Simple API for XML (SAX), an event-driven, serial-access mechanism for accessing XML documents.
This protocol is frequently used by servlets and network-oriented programs that need to transmit and receive XML documents, because it is the fastest and least memory-intensive mechanism that is currently available for dealing with XML documents, other than the Streaming API for XML (StAX).
Setting up a program to use SAX requires a bit more work than setting up to use the Document Object Model (DOM). SAX is an event-driven model (you provide the callback methods, and the parser invokes them as it reads the XML data), and that makes it harder to visualize. Finally, you cannot "back up" to an earlier part of the document, or rearrange it, any more than you can back up a serial data stream or rearrange characters you have read from that stream.
For those reasons, developers who are writing a user-oriented application that displays an XML document and possibly modifies it will want to use the DOM mechanism described in Document Object Model.
However, even if you plan to build DOM applications exclusively, there are several important reasons for familiarizing yourself with the SAX model:
- Same Error Handling: The same kinds of exceptions are generated by the SAX and DOM APIs, so the error handling code is virtually identical.
- Handling Validation Errors: By default, the specifications require that validation errors be ignored. If you want to throw an exception in the event of a validation error (and you probably do), then you need to understand how SAX error handling works.
- Converting Existing Data: As you will see in Document Object Model, there is a mechanism you can use to convert an existing data set to XML. However, taking advantage of that mechanism requires an understanding of the SAX model.
Comments
to be actually something that I think I would never understand.
It seems too complex and extremely broad for me.
I am looking forward for your next post, I'll try to get the hang of it!
we be in contact extra about your article on AOL?
I require a specialist in this area to solve my problem.
Maybe that's you! Having a look ahead to see you.
accessible on net?
this website includes remarkable and genuinely good stuff in support of visitors.
I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good results.
If you know of any please share. Kudos!
won blog.
I really hope to see the same high-grade content by you in the future as well.
In fact, your creative writing abilities has encouraged me to get my own site now ;)
but this article is genuinely a nice article, keep it up.
I will make sure to bookmark your blog and definitely will come back down the road.
I want to encourage one to continue your great writing, have
a nice holiday weekend!
It was really informative. Your website is very useful. Thank you for sharing!
at here.
am browsing this web page and reading very informative articles or reviews at this place.
A design like yours with a few simple tweeks would really make my blog stand out.
Please let me know where you got your design. Kudos
visiting this site dailly and get fastidious data from here every
day.
Simple but very precise information… Thank you for sharing
this one. A must read article!
Keep up the good work! You know, lots of people are hunting round for this info, you could help them greatly.
someone to do it for you? Plz reply as I'm looking to create my own blog and would like to find out where
u got this from. kudos
You certainly understand how to bring an issue to light and make it important.
More and more people should look at this and understand this
side of the story. I was surprised you are not
more popular given that you certainly possess the gift.
a part 2?
Look complicated to more added agreeable from you!
By the way, how can we be in contact?
revisiting. I surprise how so much attempt you set to create one of these excellent informative
website.
Where can I find out more?
against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any suggestions?
I came to check it out. I'm definitely enjoying the information. I'm
bookmarking and will be tweeting this to my followers! Outstanding
blog and outstanding style and design.
RSS feed for comments to this post