Web Service
Web Service
Web Service
In simple terms a Web Service is an application or business logic that is accessible using standard Internet protocols For example, let's suppose I keep a database with up-to-date information about weather in the United States, and I want to distribute that information to anyone in the world. To do so, I could publish the weather information through a Web Service that, given a ZIP code, will provide the weather information for that ZIP code. What is web service: Is available over the Internet or private (intranet) networks Uses a standardized XML messaging system Is not tied to any one operating system or programming language Is self-describing via a common XML grammar Is discoverable via a simple find mechanism
There are two ways to view the web service architecture. The first is to examine the individual roles of each web service actor. The second is to examine the emerging web service protocol stack.
2) Can I access a web services from any application? A) Yes, if your application supports XML based object request and response.
A) Simple, you can use web services in anything you want; the BIG Point is that if you create some web services, programmers can consume those web services with any programming language. Example, lets say you have a manufacturing company, and for some reason you want to give your customers the latest info about your products, you can say well I can put that why my website and display the info I want in there, well true but what about if you want for some reason customer can integrate your products with some kind of programming in their end. So you can create a web service that return all the info of my products and you can build your service in c# but they can consume it using java. Or whatever programming they do.
4) How many types of web services in java? A) On the conceptual level, a service is a software component provided through a network-accessible endpoint. The service consumer and provider use messages to exchange invocation request and response information in the form of self-containing documents that make very few assumptions about the technological capabilities of the receiver. On a technical level, web services can be implemented in various ways. The two types of web services discussed in this section can be distinguished as big web services and Restful web service Big web services
Big web services use XML messages that follow the Simple Object Access Protocol (SOAP) standard, an XML language defining a message architecture and message formats. Such systems often contain a machine-readable description of the operations offered by the service, written in the Web Services Description Language (WSDL), an XML language for defining interfaces syntactically. The SOAP message format and the WSDL interface definition language have gained widespread adoption. Many development tools, such as Net Beans IDE, can reduce the complexity of developing web service applications. A SOAP-based design must include the following elements.
A formal contract must be established to describe the interface that the web service offers. WSDL can be used to describe the details of the contract, which may include messages, operations, bindings, and the location of the web service. You may also process SOAP messages in a JAX-WS service without publishing a WSDL. The architecture must address complex non-functional requirements. Many web service specifications address such requirements and establish a common vocabulary for them. Examples include transactions, security, addressing, trust, coordination, and so on. The architecture needs to handle asynchronous processing and invocation. In such cases, the infrastructure provided by standards, such as Web Services Reliable Messaging (WSRM), and APIs, such as JAX-WS, with their client-side asynchronous invocation support can be leveraged out of the box.
Restful web services In Java EE 6, JAX-RS provides the functionality for Representational State Transfer (Restful) web services. REST is well suited for basic, ad hoc integration scenarios. Restful web services, often better integrated with HTTP than SOAP-based services are, do not require XML messages or WSDL serviceAPI definitions. Because Restful web services use existing well-known W3C and Internet Engineering Task Force (IETF) standards (HTTP, XML, URI, MIME) and have a lightweight infrastructure that allows services to be built with minimal tooling, developing Restful web services is
inexpensive and thus has a very low barrier for adoption. You can use a development tool such as Net Beans IDE to further reduce the complexity of developing Restful web services. A Restful design may be appropriate when the following conditions are met.
The web services are completely stateless. A good test is to consider whether the interaction can survive a restart of the server. A caching infrastructure can be leveraged for performance. If the data that the web service returns is not dynamically generated and can be cached, the caching infrastructure that web servers and other intermediaries inherently provide can be leveraged to improve performance. However, the developer must take care because such caches are limited to the HTTP GET method for most servers. The service producer and service consumer have a mutual understanding of the context and content being passed along. Because there is no formal way to describe the web services interface, both parties must agree out of band on the schemas that describe the data being exchanged and on ways to process it meaningfully. In the real world, most commercial applications that expose services as Restful implementations also distribute so-called value-added toolkits that describe the interfaces to developers in popular programming languages. Bandwidth is particularly important and needs to be limited. REST is particularly useful for limited-profile devices, such as PDAs and mobile phones, for which the overhead of headers and additional layers of SOAP elements on the XML payload must be restricted. Web service delivery or aggregation into existing web sites can be enabled easily with a Restful style. Developers can use such technologies as JAX-RS and Asynchronous JavaScript with XML (AJAX) and such toolkits as Direct Web Remoting (DWR) to consume the services in their web applications. Rather than starting from scratch, services can be exposed with XML and consumed by HTML pages without significantly refactoring the existing web site architecture. Existing developers will be more productive because they are adding to something they are already familiar with rather than having to start from scratch with new technology.