|By Andre Tost, Denise Gabardo||
|April 15, 2003 12:00 AM EDT||
Last month we described two new specifications that define the handling of Web services in J2EE, JSR101/JAX-RPC, and JSR109. Both will be part of the J2EE 1.4 release, which is scheduled to go public by the end of the summer. In this article, we will show an example of an implementation of both new standards, which is provided in the Web Services Tech Preview for WebSphere Application Server 5.
This tech preview comes as a free download from the Web, giving you a head start on the new APIs. We will show you two examples, one that takes you through the creation of a Web service that is offered to external clients, and a second showing how to develop a client to an existing Web service.
We will assume that you are familiar with the basic Web services technologies like SOAP and WSDL. See the Resources section at the end for pointers to more material on those topics. We will also assume that you have read our previous article, "Web Services Standards" (WSDJ, Vol. 2, issue 3), describing the JSR101 and JSR109 specifications, or are otherwise familiar with them.
The WAS 5 Web Services Tech Preview
WebSphere Web Services for J2EE Technology Preview is based on the open-source Apache Axis project as a runtime engine, but also includes some enhancements, such as specialized serializers/deserializers for complex objects to obtain better performance. Axis is SAX-based, which makes it faster than implementations based on DOM parsers. Moreover, the deployment model is different; it follows the JSR109 specification, which Axis does not support.
It is important to note that the preview does not "support Axis"; instead, it supports the new standards and reuses some of the Axis work where it makes sense.
To obtain the tech preview installable package (approx. 10MB), download it from the WebSphere Developer Domain site at www7b.boulder.ibm.com/wsdd/downloads/ web_services.html. Before installing it, you must already have either WebSphere Application Server (WAS) version 5 or WebSphere Application Client version 5 installed. The installation process is pretty straightforward; simply follow the instructions.
For our example, the generated EAR (enterprise application archive) file will be deployed using the usual WAS deployment mechanisms, either through the Admin Console, or via the wsadmin tool. The tech preview installation modifies the WAS administration code so that there are two additional "dialogs" in the WAS Admin Console (and additional prompts using wsadmin). We'll show you what they look like later in the article.
There is not much more to say about the tech preview in particular. It implements both JAX-RPC and JSR109, so all the things we described in our earlier article are supported. Having said that, let's dive into a concrete example.
Creating a New Web Service
There are different approaches to creating a new Web service, depending on your environment and your requirements. If some business function implementation already exists (in the form of a JavaBean or EJB), you would use the so-called bottom-up approach (see Figure 1). The tech preview provides a tool called "Java2WSDL" to generate the WSDL description from existing Java code.
On the other hand, a case may arise in which your Web services interface has already been defined in the form of a WSDL document (for example, if a service interface has been standardized for a particular industry). In this case, you would use the so-called top-down approach (see Figure 2). Again, the tech preview offers a tool to handle automatic generation of code and other artifacts. This tool, called WSDL2Java, not only generates the appropriate deployment descriptors, it can also create the service endpoint interface and an implementation class with stubs for the required methods.
We will take you through an example using the bottom-up approach. We will assume that we have a class called WorkOrderManager that lets you create new WorkOrder objects or retrieve an existing WorkOrder by its number. We will then generate a WSDL file for this Java code using the Java2WSDL tool, followed by the WSDL2Java tool to create the deployment descriptor files. Finally, we will assemble all of these into a Web module and EAR, which we can install into the application server.
The first artifact that we will create is the service endpoint interface (SEI). It represents the Web service's port type to be published and contains all the methods we want to expose (see Listing 1).
Note how the interface extends java.rmi.Remote and how every method throws a java.rmi.Remote Exception. This is mandated by the JAX-RPC specification.
Next is the source code for the WorkOrder class (see Listing 2). What you should note here is that the class implements java.io.Serializable. This is a requirement for a nonbasic Java type that appears on the interface of a Web service (similar to parameters on an EJB's remote interface).
The WorkOrder class will be mapped to an XML Schema by the Java2WSDL tool. This schema then becomes part of the WSDL definition for our Web service.
Finally, Listing 3 shows the code for the WorkOrderManagerImpl class, which implements the service. We kept the code very simple, because we want to focus on the creation of the Web service artifacts here. A real business application would certainly look different.
After you have compiled these three classes (WorkOrder, WorkOrderManager, and WorkOrderManagerImpl), you are ready to generate the WSDL document.
The Java2WSDL Tool
The first of the tech preview tools that we will use is the Java2WSDL tool, which generates the WSDL file from the SEI class. It is located in the <was_install_root>\bin directory.
We assume here that the code exists in the c:\was5tp\tech\preview directory, and that you have added c:\was5tp to your classpath. Make c:\was5tp your current directory and enter this command:
This will create a WSDL file called WorkOrderManager. wsdl. You will receive a message indicating that "the -location was not set,...". The location point of the Web service will be specified when you install the application in WAS, so you can ignore this message for now.
We have now created the contract that our Web service exposes and can use as the input for creating all other artifacts needed to deploy the service.
The WSDL2Java Tool
We will now use the WSDL2Java tool with the generated WorkOrderManager.wsdl file as input to generate the Web service deployment descriptor templates:
wsdl2java -verbose -META-INF-Only
-server-side Bean -output . WorkOrderManager.wsdl
This will create two directories, META-INF and WEB-INF, with the following Web service deployment descriptor files:
-webservicesclient.xml: This file is the deployment descriptor for any client that uses the Web service and runs in a J2EE client container.
-WorkOrderManager_mapping.xml: This file contains the mapping between a namespace that is used in the WSDL document and the Java package that is used in the Java code.
-ibm-webservicesclient-bnd.xml: This file is used to create definitions for securely accessing the Web service.
-webservices.xml: This is the Web service deployment descriptor that defines the new Web service to the application server.
-WorkOrderManager_mapping.xml: This file is an exact copy of the one created in the META-INF directory.
-ibm-webservices-bnd.xml: Again, this file is used if you want to secure your Web service.
Generally, the files in the META-INF directory are used for a client to the Web service, whereas the files in the WEB-INF directory are used for server-side deployment. The only files defined in the standard are the webservices. xml and webservicesclient.xml deployment descriptors; the other files are specific to WebSphere.
The only modification you need to make is in the webservices.xml file. Make this change :
This binds the Web service to a particular implementation, the WorkOrderManager class. We will reuse this value later when we assemble the application (i.e., it will go into the web.xml deployment descriptor for the Web application).
Creating the EAR File
Now we can go ahead and assemble the generated files into an archive file that we can install into the application server. Do this using the Application Assembly Tool (AAT) that comes with WAS. You can start it by entering "assembly" on the command line.
Choose to create a new Web module. Since this is all standard AAT business, we won't describe it in detail here and will simply refer to the AAT documentation for more info. Name the new Web module "WorkOrderManager Web.war".
Add all of the class files to the new Web module. They go into the \WEB-INF\classes\tech\preview directory. Moreover, you need to add a new Web component, a servlet. Its name is WorkOrderManager (this is referenced from within the webservices.xml file) and its class is tech.preview.WorkOrderManagerImpl. Note that even though this class is not really a servlet, it is defined as one in the Web module deployment descriptor. During deployment the application server will make this class accessible as a Web service (by effectively wrapping it into a servlet that receives the SOAP request and invokes the appropriate method on the bean). Save the new Web module and exit the AAT.
Now move the WorkOrderManager.wsdl file into the c:\was5tp\WEB-INF directory. On the command line, type the following command to add the remaining files to the module:
jar -uvf WorkOrderManagerWeb.war WEB-INF/*
Using the AAT again, create the EAR application (WorkOrderManager.ear) and import the Web module WorkOrderManagerWeb.war. Make its context root "/workorder". This is all business as usual and does not require any special steps for the Web service.
Installing the Application
Now you are ready to deploy and install the enterprise application into WebSphere Application Server. As we already mentioned, the installation process is similar to that of any other enterprise application. After installing the technical preview, there are two additional steps. First, the system asks for the location to place the WSDL files. Enter "c:\was5tp" into that field. This will export the resulting WSDL file to the c:\was5tp\WorkOrderManager.ear\WorkOrderManagerWeb.war\ WorkOrderManagerService directory. We will need it later when we create the client.
The second new step requires information about the protocol, hostname, and port on which the Web service will run. You can leave all the defaults. The WSDL file in the Web module is updated with the new endpoint, and a copy is exported to the defined directory.
After installing the enterprise application, save the configuration, start the WorkOrderManager.ear application, and your Web service is ready to go!
Accessing an Existing Web Service
Now that you have a Web service ready and waiting to be called, we want to create a client to use this service. We will access the service that we just created; however, this could also be any other Web service described by a WSDL document.
The client interface we will use is based on the JAX-RPC standard, as described earlier. A JAX-RPC-compliant Web service client can run stand-alone or in a J2EE client container. We will keep things simple here by running the client from the command line.
The only input we will need is the exported WSDL file from the installation of the enterprise archive with the Web service. Feel free to delete the files generated before; they are all safely installed in the application server and we don't need them here anymore. Copy the WorkOrderManager.wsdl file to the c:\was5tp directory. Now use the WSDL2Java tool again to create the client-side bindings for the service: wsdl2java WorkOrderManager.wsdl
This will create the classes we need on the client side. All of the generated Java files go into the tech\preview directory:
The WSDL2Java tool created a number of deployment descriptor files in the META-INF directory. These files would be needed if we were to access the Web service from within a J2EE client container. We already described them earlier when creating the server-side deployment descriptions. We won't need them here, because we will run the client from the command line. (In Java standards lingo, we are using a "J2SE client.")
Go ahead and compile all of the generated Java files. To do so, you need the following set of JAR files in your classpath. They can be found in the <was_install_root> \lib directory: axis.jar, qname.jar, jaxrpc.jar, j2ee.jar, commons-logging-api.jar, commons-discovery.jar, and saaj.jar.
And finally, Listing 4 is a small test application that uses the Web service, which creates two new WorkOrder objects and then retrieves one of them.
The new standards for providing and consuming Web services will help developers create portable and interoperable Web services applications across a variety of application servers. While this is coming later this year in the J2EE 1.4 specification, IBM provides you with an early implementation of the new standards on top of WebSphere Application Server 5, allowing you to get a head start on becoming familiar with the new APIs. Also later this year, complete tooling will follow as part of WebSphere Studio Application Developer.
SYS-CON Events announced today that Grape Up will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company specializing in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the U.S. and Europe, Grape Up works with a variety of customers from emergi...
Apr. 26, 2017 05:30 PM EDT Reads: 2,134
@ThingsExpo has been named the Most Influential ‘Smart Cities - IIoT' Account and @BigDataExpo has been named fourteenth by Right Relevance (RR), which provides curated information and intelligence on approximately 50,000 topics. In addition, Right Relevance provides an Insights offering that combines the above Topics and Influencers information with real time conversations to provide actionable intelligence with visualizations to enable decision making. The Insights service is applicable to eve...
Apr. 26, 2017 05:15 PM EDT Reads: 2,760
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Apr. 26, 2017 05:00 PM EDT Reads: 900
Bert Loomis was a visionary. This general session will highlight how Bert Loomis and people like him inspire us to build great things with small inventions. In their general session at 19th Cloud Expo, Harold Hannon, Architect at IBM Bluemix, and Michael O'Neill, Strategic Business Development at Nvidia, discussed the accelerating pace of AI development and how IBM Cloud and NVIDIA are partnering to bring AI capabilities to "every day," on-demand. They also reviewed two "free infrastructure" pr...
Apr. 26, 2017 03:15 PM EDT Reads: 1,417
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Apr. 26, 2017 03:00 PM EDT Reads: 1,158
New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists will examine how DevOps helps to meet th...
Apr. 26, 2017 02:30 PM EDT Reads: 1,442
NHK, Japan Broadcasting, will feature the upcoming @ThingsExpo Silicon Valley in a special 'Internet of Things' and smart technology documentary that will be filmed on the expo floor between November 3 to 5, 2015, in Santa Clara. NHK is the sole public TV network in Japan equivalent to the BBC in the UK and the largest in Asia with many award-winning science and technology programs. Japanese TV is producing a documentary about IoT and Smart technology and will be covering @ThingsExpo Silicon Val...
Apr. 26, 2017 02:30 PM EDT Reads: 389
Five years ago development was seen as a dead-end career, now it’s anything but – with an explosion in mobile and IoT initiatives increasing the demand for skilled engineers. But apart from having a ready supply of great coders, what constitutes true ‘DevOps Royalty’? It’ll be the ability to craft resilient architectures, supportability, security everywhere across the software lifecycle. In his keynote at @DevOpsSummit at 20th Cloud Expo, Jeffrey Scheaffer, GM and SVP, Continuous Delivery Busine...
Apr. 26, 2017 01:45 PM EDT Reads: 897
SYS-CON Events announced today that Hitachi, the leading provider the Internet of Things and Digital Transformation, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Hitachi Data Systems, a wholly owned subsidiary of Hitachi, Ltd., offers an integrated portfolio of services and solutions that enable digital transformation through enhanced data management, governance, mobility and analytics. We help globa...
Apr. 26, 2017 01:30 PM EDT Reads: 1,158
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Apr. 26, 2017 12:45 PM EDT Reads: 1,126
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
Apr. 26, 2017 12:00 PM EDT Reads: 1,149
Apr. 26, 2017 11:45 AM EDT Reads: 9,015
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Apr. 26, 2017 10:45 AM EDT Reads: 3,070
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Apr. 26, 2017 10:30 AM EDT Reads: 2,166
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend @CloudExpo | @ThingsExpo, June 6-8, 2017, at the Javits Center in New York City, NY and October 31 - November 2, 2017, Santa Clara Convention Center, CA. Learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
Apr. 26, 2017 10:30 AM EDT Reads: 1,253
Most technology leaders, contemporary and from the hardware era, are reshaping their businesses to do software in the hope of capturing value in IoT. Although IoT is relatively new in the market, it has already gone through many promotional terms such as IoE, IoX, SDX, Edge/Fog, Mist Compute, etc. Ultimately, irrespective of the name, it is about deriving value from independent software assets participating in an ecosystem as one comprehensive solution.
Apr. 26, 2017 10:00 AM EDT Reads: 487
SYS-CON Events announced today that Hitachi Data Systems, a wholly owned subsidiary of Hitachi LTD., will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City. Hitachi Data Systems (HDS) will be featuring the Hitachi Content Platform (HCP) portfolio. This is the industry’s only offering that allows organizations to bring together object storage, file sync and share, cloud storage gateways, and sophisticated search an...
Apr. 26, 2017 10:00 AM EDT Reads: 527
Apr. 26, 2017 09:45 AM EDT Reads: 2,365
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
Apr. 26, 2017 06:00 AM EDT Reads: 904
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in compute, storage and networking technologies, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/...
Apr. 26, 2017 04:45 AM EDT Reads: 2,236