You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
What Are Web Services?
Web services are client and server applications that follow Web Services W3C standards while transferring messages over the Internet with HyperText Transfer Protocol (HTTP). Simple services can interact with each other to provide composite services.
Web services can be distinguished as “big” or SOAP-based web services and “RESTful” web services.
Big web services use XML messages that follow the Simple Object Access Protocol (SOAP) standard. A message architecture and message formats are defined in XML with machine-readable descriptions written in the Web Services Description Language (WSDL).
Representational State Transfer (RESTful) web services do not require XML and much easier to develop and consume than “big” SOAP-based web services. RESTful services use HTTP methods: GET, POST, PUT and DELETE while transferring information and managing data over the Internet.
Java Enterprise Edition (EE) supports SOAP-based web services with JAX-WS API and RESTful services with JAX-RS API.
JAX-WS: addresses advanced Quality of Service (QoS) requirements and supports the WS-* set of protocols, which provide standards for security and reliability often important for enterprise and their clients.
JAX-RS: makes it easier to write web applications and makes less constraints than “big” services, allows for more flexibility and simplicity.
Creating a SOAP-based Web Service
Let us create a web service using JAX-WS. We will provide an annotation @WebService, a hint for JAX-WS to do some work for us. To further simplify the code we provide another annotation @Stateless. This annotation simplifies some of the configuration issues and gives us nice options such as transactions and security.
Here is the example of a web service class below. Eclipse can create the WSDL file, which helps to discover and operate the service. Compressed in a war file, this class can be deployed into an application server, such as Tomcat and can be invoked over the Internet.
@Stateless
@WebService(
portName = "TrainingPort",
serviceName = "TrainingService",
targetNamespace = "http://ITUniversity.us/wsdl",
endpointInterface = "com.javaschool.Training.ws.TrainingWs")
public class Training implements TrainingWs {
private String trainingCourseName;
public String getTrainingCourseName() {
return trainingCourseName;
}
public void setTrainingCourseName(String trainingCourseName) {
this.trainingCourseName = trainingCourseName;
}
}
Was it clear so far?
Note, that the last line in the WebService annotation named endpoint interface.
First of all what is endpoint?
A web service endpoint is a server-side resource, usually a Java class, that can be referenced as the address for web services. A WSDL file provides descriptions for such a resource. The descriptions include the endpoint URL, which can be used to invoke a web service. These endpoint descriptions can also be used on the client side to generate code that can communicate SOAP messages to and from the web service.
And what is endpoint interface?
A full name is (SEI). SEI works as a usual Java Interface. It defines business methods that are implemented by a Java class that serves as a web service endpoint.
Strictly speaking, endpoint interfaces are not required, but recommended, especially, if more than one implementation is possible.
import javax.jws.WebService;
@WebService(targetNamespace = "http://ITUniversity.us/wsdl")
public interface TrainingWs {
public String getTrainingCourseName();
public void setTrainingCourseName(String trainingCourseName);
}
Assignments:
Create 4 QnA on the subject and email to dean@ituniversity.us
In Eclipse open a new Dynamic Web Project ItsWS and add to the Java Resources – src – a new package com.javaschool.Training.ws. Create the interface TrainingWs and then the implementation class Training.
Do right-mouse click on the implementation class and select Web Services – Create Web Service options. Select Server Runtime: Tomcat and Web Service Runtime: Apache Axis. Generate and deploy WSDL and test deployment.
Package all for deployment at a remote server and provide instructions for deployment in the same zip file.
Email to dean@ituniversity.us
Enhance the last project done in DataService framework to allow service access to major functions of the project.
Compress all sources in another zip file and email with deployment instructions to dean@ituniversity.us
Was it clear so far?
onclick="window.location.href='/BASE/jsp/demo.jsp?checkFlavor=itsp&issueID=20&intro=general&group=aitu&ur=f'">
Note, that the last line in the WebService annotation named endpoint interface.
First of all what is endpoint?
A web service endpoint is a server-side resource, usually a Java class, that can be referenced as the address for web services. A WSDL file provides descriptions for such a resource. The descriptions include the endpoint URL, which can be used to invoke a web service. These endpoint descriptions can also be used on the client side to generate code that can communicate SOAP messages to and from the web service.
And what is endpoint interface?
A full name is (SEI). SEI works as a usual Java Interface. It defines business methods that are implemented by a Java class that serves as a web service endpoint.
Strictly speaking, endpoint interfaces are not required, but recommended, especially, if more than one implementation is possible.
Create 4 QnA on the subject and email to dean@ituniversity.us
In Eclipse open a new Dynamic Web Project ItsWS and add to the Java Resources – src – a new package com.javaschool.Training.ws. Create the interface TrainingWs and then the implementation class Training.
Do right-mouse click on the implementation class and select Web Services – Create Web Service options. Select Server Runtime: Tomcat and Web Service Runtime: Apache Axis. Generate and deploy WSDL and test deployment.
Package all for deployment at a remote server and provide instructions for deployment in the same zip file.
Email to dean@ituniversity.us
Enhance the last project done in DataService framework to allow service access to major functions of the project.
Compress all sources in another zip file and email with deployment instructions to dean@ituniversity.us