IBM Cloud Authors: Yeshim Deniz, William Schmarzo, Elizabeth White, Karthick Viswanathan, Pat Romanski

Related Topics: IBM Cloud

IBM Cloud: Article

Developing Web Services with WebSphere Studio

Developing Web Services with WebSphere Studio

In my last article (WSDJ, Vol. 1, issue 4) I showed you how to use WebSphere Studio Application Developer (WSAD) to develop and publish a Web service. You saw how to use the Web services wizard to wrap an existing Java method as a Web service and expose the metadata required for invoking the service. You also saw how the UDDI Explorer is used to publish your service on a public registry so others can find and use it. This month's focus is on discovering the service and building a client that invokes the Web service. You'll learn more about how WSAD hides the complexity and mechanics of Web services by introducing a set of tools and wizards. You can do all your Web services development quickly and efficiently, without writing a single line of XML.

Last time I focused on the Web service developer (and publisher); this month I focus on the consumer - the developer of the client application that makes use of the Web service. WSAD supports not only Web service development but also Web service consumption, all using the same set of tools hiding the complex mechanics of the Web service.

Continuing the scenario introduced before, recall that the Web service that was developed used advanced optimization algorithms to create efficient driving routes. People who need to visit a set of locations during a workday access the service by passing in a set of latitude/longitude pairs that need to be visited. The Web service uses a smart routing and optimization engine and has access to historical traffic patterns with which it can suggest an optimal sequence to minimize driving time. The service can be used by applications for delivery trucks, service technicians, claims adjustors, and more.

The Java code that performed this optimization had a method with the following signature:

public int[]
getWorkOrderSequenceForEmployee(long[] lats, long[] longs)
It receives as input two arrays with the latitude and longitude coordinates for the places to be visited. The reply is an array with the sequence. For example, if it has passed 10 locations it may return an array of the form {4,6,2,3,1,8,9,7,0,5}, meaning the person should first visit the location with the fourth latitude/longitude, then the location with the sixth latitude/longitude, and so on. This was wrapped as a Web service and published on a UDDI registry. Let's move on to see how a client application developer becomes a consumer of this Web service.

Discovering and Importing the Service
As the Web service developer, you published the work order sequencing service on IBM's Test Business UDDI site - a public registry deployed on the Web. This month you're switching roles - you're now the consumer of the Web service. WSAD also supports this role.

As a Web consumer you want to be able to search the UDDI repository and find the business and service that will help you develop your application. Once you find it, you want to easily make use of the published service. WSAD helps you do both using a set of tools - you don't have to make complex UDDI API calls or hard-to-write SOAP messages.

The UDDI Explorer is used to discover the service. This is the same tool used for publishing the service. Now you need to use the import mode. The UDDI Explorer is a visual tool that allows you to navigate a UDDI repository instead of making UDDI API calls to search the repository.

To import a Web service use File ->Import from the menu bar, then select the UDDI option from the wizard. This brings up the UDDI Explorer. You use the UDDI Navigator - the left pane in the UDDI Explorer - to search for a business based on the classification categories you're interested in. Within the business entity, you can search for the business services offered by this business (see Figure 1). The final element you need to select is the actual service definition. This is the URL that contains the WSDL document defining the service. At this point you can go ahead and click the Import to Workbench tool highlighted in blue on the Actions toolbar of the UDDI Explorer (see Figure 2). You've now completed the first part of the consumption process - discovering the service and importing the WSDL file. Your project within WSAD will include the WSDL file you published last month.

Creating the Proxy and Running the Sample Test Application
Now that you have the WSDL you can see where the service implementation resides, what it assumes as input, and what kind of output it generates. You can build SOAP documents and send them over HTTP to be serviced by the last column's implementation . . . but should you? Not really. Once more, WSAD and the set of Web services tools make things simpler. Using the Web services wizard you can create a proxy that works on your behalf for generating the SOAP calls to the Web service.

Before looking at the wizard and the way WSAD generates the proxy, let's look at the proxy's role and the life cycle of an invocation. The proxy class is generated on your behalf by the Web services wizard based on the WSDL file. As its name suggests, it's a surrogate that lives in your program's address space, i.e., it's a local Java object. It has a method that conforms to the signature as defined by the WSDL file. Since the WSDL definition is based on the original method's signature, it mimics the signature of the method you originally wrapped as a Web service. When you invoke the proxy's method it generates the SOAP message based on the definitions within the WSDL and forwards this SOAP message to the endpoint as defined in the WSDL. On the server side, the rpcrouter (part of the Web services infrastructure) unpacks the SOAP message, converts the XML to the Java objects forming the input arguments, and makes the call on the object implementation. The method generates a return value that's converted by the rpcrouter to XML and returned to the proxy. Back on the client, the proxy converts the XML back to Java objects based on the encoding type. Figure 3 demonstrates this process.

Use the Web services wizard to import the Web service and generate the proxy. The wizard allows you to create a Web services client as shown in Figure 4. It takes you through a series of steps, asking simple questions such as whether you want to generate a sample application that uses the proxy, whether you want to launch the sample, etc. When you click the Finish button on the wizard, it goes to work and generates all the plumbing for you. Once more, you don't have to write a single line of code to be able to consume the Web service. It not only generates a proxy Java class, it generates a set of JSPs that use the proxy as a way for you to test the Web service (and, of course, to copy/paste from to build your own consuming application). It's really that simple.

A Peek Behind the Scenes
The plumbing generated by the Web services wizard is interesting. For every class you select in the wizard, a proxy class is created. An example is shown in Figure 5. For every method that serves a proxy method to a Web service, WSAD generates a method similar to that shown in Listing 1 (some of the details are omitted for the sake of brevity). As you can see, the proxy method uses a call object to package the invocation details. The call object is part of the underlying infrastructure within the Apache Web services package (used in the WebSphere Application Server as well as in WSAD).

Venturing into the Unknown
Let's live on the wild side. Web ser-vices are about interoperability and distributed systems, right? Let's take a brief look at what happens when you want to publish your Web services for use by a .NET client. It's actually quite simple. Visual Studio .NET has an import program similar to the Web services wizard in WSAD that takes the WSDL definition and creates a proxy that takes care of the plumbing. You invoke it using a command of the form

wsdl.exe /language:VB <URI-for-WSDL>

if you want to generate a proxy in VB, or a command of the form

wsdl.exe <URI-for-WSDL>

if you want the proxy in C#. A small part of the generated VB proxy is shown in Listing 2, and a small part of the C# proxy is shown in Listing 3. The proxy functions much like the one generated by WSAD. One interesting difference is that the proxy generated by WSAD uses a delegation model using an embedded call object while VS.NET proxies use an inheritance model - these proxies are subclasses of the SoapHttpClient-Protocol class where all the magic takes place. Therefore, the invocation is through the Me object in VB and through the this object in C#.


This column completes an introduction to using WSAD to develop Web services. The two-part series walked you through the fundamentals of developing and publishing a Web service using WSAD as well as discovering and invoking the Web service using the support infrastructure provided by WSAD and by WAS. What is important to take from this series is that the WebSphere tools make all this easy, and you don't have to know any of the low-level details to participate in this brave new world.

More Stories By Ron Ben-Natan

Ron Ben-Natan is Chief Technology Officer at ViryaNet Inc. Prior to that he worked for companies such as Intel, AT&T Bell Laboratories, Merrill Lynch and as a consultant at J.P. Morgan. He has a Ph.D. in Computer Science in the field of distributed computing and has been architecting and developing distributed applications for over 15 years. His hobby is writing about how technology is used to solve real problems and he has authored numerous books including “IBM WebSphere Application Server: The Complete Reference” published by Osborne/McGraw. He can be reached at

More Stories By Doron Sherman

Doron Sherman is the CTO of Collaxa, Inc., a Web Service Orchestration Server vendor and a BEA Partner located in Redwood Shores, California. He has been involved with Java since its early days and pioneered application server technology while being a founder and chief scientist at NetDynamics.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@ThingsExpo Stories
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
The standardization of container runtimes and images has sparked the creation of an almost overwhelming number of new open source projects that build on and otherwise work with these specifications. Of course, there's Kubernetes, which orchestrates and manages collections of containers. It was one of the first and best-known examples of projects that make containers truly useful for production use. However, more recently, the container ecosystem has truly exploded. A service mesh like Istio addr...
Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
Business professionals no longer wonder if they'll migrate to the cloud; it's now a matter of when. The cloud environment has proved to be a major force in transitioning to an agile business model that enables quick decisions and fast implementation that solidify customer relationships. And when the cloud is combined with the power of cognitive computing, it drives innovation and transformation that achieves astounding competitive advantage.
As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
DXWorldEXPO LLC announced today that "Miami Blockchain Event by FinTechEXPO" has announced that its Call for Papers is now open. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to info@dxworldexpo.com. Financial enterprises in New York City, London, Singapore, and other world financial capitals are embracing a new generation of smart, automated FinTech that eliminates many cumbersome, slow, and expe...
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of bus...
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by FinTechEXPO. ICOHOLDER give you detailed information and help the community to invest in the trusty projects. Miami Blockchain Event by FinTechEXPO has opened its Call for Papers. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to info@dxworldexpo.com. Miami Blockchain Event by FinTechEXPO also offers s...
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...