Requirements for a JAX-end endpoint

What WS requires

Certain JAX-WS endpoints ought to follow the following requirements and these are as follows:

The class that will be annotated must be annotated using the javax.jws. Webservice; or alternatively, the javax.jws.WebServiceProvider annotation. Secondly, having a JAX-WS endpoint requires that the implementing class have an explicit reference through the endpoint Interface element of the @Webservice annotation. However, contrary to what you may think, it is not required to do so. An SEI will be implicitly defined for the implementing class if it is provided that no endpoint Interface is going to be specified in the WebService. Thirdly, another requirement for having a JAX-end endpoint is that the business methods of the implementing class shout strictly be public, and should, at all costs, not be declared static or final. Furthermore, business methods are required to be exposed to web service clients. These business methods also ought to be exposed to web service clients and have JAXB-compatible parameters and certain return types. Surely, it will be a very helpful tool to aspiring businessmen as well. It may sound complicated but is definitely very useful. In addition, the implementing class must not be made abstract, and should be declared unfinal. It should not, more importantly define the finalize method, but instead, have a default public constructor. In doing so, the implementing class may use the javax.annotation.PostConstruct of the javax.annotation.PreDestroy annotations for lifecycle event callbacks. This method is usually called in by the container before the implementing class can even begin to respond to the web service clients.

 

JAX-WS starting point

Web services

If you are going to start out developing a JAX-WS web service then the starting point would be to have a Java class annotated with the javax.jws. WebService annotation. What will define the class as a web service endpoint is simply the @WebService annotation. The service endpoint interface or what can be also called the service endpoint implementation, or as a shortcut for it (SEI), is what can be described to be a certain Java interface or class. This certain Java interface or class will declare the methods that a client can impose on the service. When you are building a JAX-WS endpoint, it does not really so much require a JAX-WS endpoint, it only simply needs a web service implementation to define the SEI. If you are attempting to specify an explicit interface, this is what you can do. Simply add the endpointInterface element to the @WebService annotation in the implementation class. If you are going to create a web service and client, be sure to firstly code the implementation class. Second, after coding the implementation class, you should then compile the implementation class. After compiling the implementation class, you can then package the files into a WAR file. After packaging the files into a WAR file, you should then deploy the WAR file. Web service artifacts will be generated by the Glass Fish server during deployment. After deploying the WAR File, you may then start coding the client class, and successively start using a wsimport Ant task in order to generate and compile the web service artifacts which are needed to connect to the service.
Image by: java.globinch

Why you should use web services

Easy Web Service

One should make use of web services for four fundamental reasons. The first, being that web services expose the existing function on to the network. The second fundamental reason is that web services connect different applications’ interoperability. The third is because web services make use of standardized protocol. Finally, last of all, web services make it possible to have a low cost of communication. To elaborate, a service that exposes existing functions onto the network works via a unit of managed code that is capable of being remotely invoked using HTTP. This means that  several and varying web services can be activated using HTTP requests, allowing people to expose the functionality of the existing code which you made over the network. You want this to happen so that other applications can make use of your program. Because Web Services have the capacity to connect different applications, different applications are allowed to communicate with each other, thus being able to share data and services among themselves. This allows other applications to make use of the services of the web services, which in turn allows applications and other technological platforms independent. Service Transport, XML Messaging, Service  Description, and the Service Discovery layers use a standard industry protocol for communication, helping a lot of businesses reduce costs because of competition and at the same time, be able to increase the quality. Such are the advantages of having a standardized protocol when it comes to the protocol stack in Web Service.
Image by: manageengine.com

What are Web Services anyway?

How it works

A web service is a a piece of self-contained software which is a collection of open protocols and standards which are used to exchange data between applications or systems. The information of these web services are XML-based information. XML allows the usage of a language which can be used as a connection between different platforms and programming languages and still be capable of expressing several different complex messages and functions. This provides the infrastructure of the World Wide Web a means for their software to connect to other software applications. These different software applications can capably access different Web Services through HTTP, XML, or SOAP without encountering any form of trouble with regard to how these different Web services will be implemented. This helps solve interoperability challenges. This is done by giving your applications a means to integrate their data and business processes.  For instance, when somebody uses a web service by sending an XML message, they will in turn wait for a corresponding XML response. Recalling the fact that web services use XML to communicate, Java applications can talk with Perl; similarly Unix applications can communicate with Windows. Therefore, web services are not tied to using certain or specific operating systems or programming language. Simply said, software applications which are actually written in various programming languages and running on different platforms can use these web services to exchange data over the Internet. This similar to the inter-process communication that occurs on one computer. Lastly, it is discoverable through simple find mechanisms.

Building Web Services with JAX-WS

SOAP vs RESTful

If you are going to build web services for clients who communicate using the language XML, you ought to use Java API for XML Web Services. Using JAX-WS provides an opportunity for developers to write Remote Procedure Call-oriented (in short RPC-oriented) web services as well as message oriented web services. The web service operation invocation for the JAX-Web service is represented by an XML-based protocol. This XML-based protocol can be something like SOAP which should define the envelope structure. It does not only define the envelope structure, but also helps encode conventions that will represent the web service response and invocations, and also encode the corresponding rules for these as they are transmitted as SOAP messages over HTTP. These SOAP messages are XML files acting as calls and responses that are sent over the HTTP. It seems like an awfully complicated process but the JAX, web service API hides the complexity from the application developer. The server side only allows the deveoper to make specifications in the web service operations. On this server side, the methods are defined through an interface which is written in a Java programming code. It is the developer who codes more codes and or more classes which are used to implement the methods which were mentioned. The client programs on the other hand are easier to code. The client first creates a proxy program where the local object is supposed to represent the service. After which, the client invokes methods on the proxy. SOAP messages are not generated by the developer if he or she uses JAX-WS. Instead, the JAX-web service run time system is the one that converts API calls and responses to and from SOAP messages.
Image by: nicolas-zozol.developpez

Which type of web service should you use?

Which type of service to use?

If you’re thinking about what type of web service to use, then you should consider this carefully. What is advisable for you to do is to know what in the first place you are trying to do. If you’re trying to do integration over the web, then you should most probably use web services. However, if you are going into enterprise application integration scenarios which have an advance quality of service requirements, then it is very much advisable to use Big Web Services for that instead. Web services addresses addresses requirements which occur in enterprise computing. It is easier for JAX-WS to support WS-* set of protocols. This is because it provides standards for security and reliability as well as, and more importantly and significantly, inter operate with other clients and servers who inter operate with WS-servers. If you are aiming to write web applications that apply a handful of REST style constraints, then it’ll be easier to operate via JAX-RS so that you can produce properties which are favorable to the service. These are favorable properties can be something like loose coupling, because you can evolve the server without breaking existing clients. You will also get better scalability, and more importantly architectural simplicity. For architectural simplicity, you can use off-the-shell components such as proxies or HTTP routers. It is much easier to use JAX-RS for your web application because it is easier for several varying clients to consume RESTful web services while you are trying to evolve and scale the server side.

Restful web services

RESTful web services

There are two types of web services. The first type of the two web services is called “big” web services, and the second type of the two web services is called RESTful web services. REST stands for Representational State Transfer (RESTful) web servicesREST, as distinguished from Big Web Services, is better suited for more basic, ad hoc integration scenarios. Web services that make use of REST are more suited for integration with HTTP rather than being used with SOAP-based services; because in contrast to SOAP-based services, they do not require XML messages or WSDL services such as API definitions. A RESTful design is thoroughly considered appropriate only when the following conditions are met. Firstly, the web services are completely stateless. In order to test the statelessness of the web services, consider whether or not the interaction can survive the restart of the server. The second condition which should be considered for a RESTful design is the caching infrastructure. The caching infrastructure can be leveraged for performance In case the data the web service returns is not dynamically generated, then it can be still however, be leveraged to improve performance through the web servers and its other intermediaries. Third condition that a RESTful web service must meet is that the context and content of the service must have been understood mutually by the service producer and the service consumer. The two parties should agree on the schemes which describe the data being exchanged and on how to process it meaningfully. Fourth condition is bandwidth which should be limited. Limited-profile devices such as mobile phones and PDAs are better suited with REST.

 

Image by: Mechenic.com

Big Web Services

Big Web Services

There are two types of web services. The first type of the two web services is called “big” web services, and the second type of the two web services is called RESTful web services. Big Web services make use of XML messages. These XML messages follow an XML language that defines the message architecture and message formats. This language that Big Web services follows is called the Simple Object Access Protocol Standard or simply SOAP standard. Systems who follow this standard language contain a machine-readable explanation of the operations which are being offered by the service. This language in turn is written in WSDL, or what is called the Web Services Description Language. The Web Services Description Language is an XML language used to syntactically define interfaces. Both the aforementioned languages i.e, SOAP message format and the WSDL interface definition language have begun to gain widespread usage everywhere. A SOAP-based design must include elements such as a formal contract which must be established to describe the interface that the web service offers. The WSDL may in fact be used to discuss the details of the contract. The contract consists of the following: Messages, operations, bindings, and the location of the web service. If you don’t want to publish a WSDL, you can process the SOAP messages instead through a JAX-WS service.The architecture ought to address complex nonfunctional requirements such as transactions, security, addressing, trust, coordination, etc., and should strictly set a common vocabulary for them to ensure its safety.

Image Source by: powerof60.com

 

Most Popular Web Services Have Social Component

Facebook, arguably the most popular web service today, is a social site. But Facebook with all its security issues aside, one will notice that many of popular web services these days have a social component. Some examples of such web services include YouTube, Flickr, and even Google’s web search.

Visit just about any online service today and you’ll likely see a comments section or at least the most popular social sharing buttons. Of course, they all also have their own versions of the Like button, ranging from marking stuff as a favorite to voting interesting posts up. Some even have a system for voting things down.

When it comes to Google’s web search, the social component may not be as obvious in the sense that they don’t directly engage users. But if you are logged into your Google account while searching you’ll notice that Google will show stuff that are tailored to your interests as indicated by the stuff your social network (on Google plus) visits and likes.

So it seems that there is no escaping the fact that the Internet is getting more social despite privacy concerns about sharing personal stuff over the internet.

Image Credit

Facebook Ramps Up on Security Measures with HTTPs for All Pages

Google may have reinvented the web when it first came out with its super search engine. It also did the same thing with email when Gmail came out. But when it comes to social sites, Facebook still reigns supreme.
Unfortunately, Facebook is also known for its security breaches and not so friendly security and privacy settings. Of course it may be argued that you only need stay out of social media sites if you want total privacy and security, but seriously Facebook can make some improvements in terms of security.

Well Facebook knows that too, which is why they have started using HTTPS as the default protocol for all of its pages, not just your login page. For this month only US users will feel the changes, but according to the Facebook blog, it “will be soon rolling out to the rest of the world”. So no matter where you might be updating your status, whether on some prime piece of real estate in Osaka or at an internet shop in Texas, you can bet that your personal info on Facebook will be a tad be more secure.

Image via Facebook