How to Call a Web Service Using Web Experience Factory
By Hatim Quaid Joher
Sep 26, 2012 3:26 PM CDT
This article will show you how easy it is to call any Web service into your WebSphere Portal using Web Experience Factory. Web services allow different applications to talk to each other and share data and services among themselves. Other applications can also use Web services. For example, VB or .NET application can talk to java web services and vice-versa. So, Web services is used to make the application platform and technology independent. For testing purposes, we are using the Currency Converter.
Web service in this example as shown in Figure 1.
We start by creating a "Web Experience Factory" project and then creating an empty model inside it. To call any Web services, Web Experience Factory provides the Web Service Call builder.
Open the Web service call builder and write your WSDL URL and click on the Fetch WSDL button as shown in Figure 2. This will populate the list of operations supported by your WSDL.
Select the operation name that you want to execute from dropdown list. Check the "AutoCreate Input Vars" to automatically create Input Variable for Web Service, as shown below in Figure 3. That's it.
To test your service, we need to add Service Provider builder and Service Operation builder. When you add Service Provider builder, check the Add Testing Support and Generate Main options, as shown below in Figure 4.
Now Add Service Operation builder and call the Web service to execute. This is shown in Figure 5 below.
One important thing here is the sequence of builder. Service Operation builder always comes after Service Definition builder. So make the Service Definition builder first, then Web Service Call builder and then Service Operation builder.
Now save your work and run the model, as shown below in Figure 6.
We use this service in many consumer models to create a portlet and deploy it on Portal 8. The final look and feel is shown in the Consumer Model screenshot below (Figure 7).