Turning Web Sites into Web Services
Pages: 1, 2, 3, 4

Figure 12 shows the final mappings for the method. Notice how the method declaration takes shape after the choices you make for the mappings. This declaration shows that the method takes two String parameters (name and number) and returns the type PhoneStatus. You press OK to create the mapping.

The final mapping
Figure 12. The final mapping

In the example, I have explained the same process for the two other robots and have generated methods for these (see Figure 13). After creating the mappings, the only thing left to configure is the communication protocol. This is the protocol that the control uses when communicating with RoboServer. Figure 13 shows how to add a new protocol.

Adding a new protocol
Figure 13. Adding a new protocol

There are two kinds of protocols: the socket protocol and the JMS protocol. The socket protocol must be used for synchronous communication and is the simplest to configure. You just specify the URL of the machine on which the RoboServer is running and the port for the communication. The JMS protocol must be used for asynchronous communication, and I will not discuss it here. If you just start a RoboServer using the default script that comes with RoboSuite, it starts with a socket protocol on port 50000, and you can just select the default values for the socket protocol used by the control (see Figure 14). This holds as long as you run RoboServer on the same machine as your WebLogic Server.

The protocol dialog
Figure 14. The protocol dialog

When the configuration of the control is completed, you press the Create button as Figure 15 shows, and the control is generated.

The fully configured control
Figure 15. The fully configured control

The next steps in creating the Web service involve adding operations for each of the control methods. Figure 16 shows how an operation is added to the Web service by dragging the control method onto the Web service.

Creating an operation from a control method
Figure 16. Creating an operation from a control method

Figure 17 shows the complete Web service with all the operations added.

The complete Web service
Figure 17. The complete Web service

Before you can test the Web service there is one more thing you must configure. The search operation of the Web service will return a list that is of Java type java.util.List. Since WebLogic Workshop does not know the type of the object on this list, you need to specify what types the return may include—in this case, that the search operation may include the Java type controls.Phone.PhoneNumber. Figure 18 shows how this is specified.

Specifying the include Java types
Figure 18. Specifying the included Java types

The Web service is now ready to be tested. For testing, a RoboServer must be running on the local machine (the same as the one on which WebLogic Server is running), and this machine must be using a socket protocol on port 50000. So be sure that you have such a RoboServer running before you test the Web service. Press the Start icon in WebLogic Workshop when the Web service is shown in the Design View (or Source View). This starts the WebLogic Workshop Test Browser (see Figure 19) from which you may test the Web service.

Testing the Web service
Figure 19. Testing the Web service

To test the add operation, you simply enter a name and a phone number in the test form for the add method as Figure 19 shows, and then press the button marked add. This calls the Web service, and the browser then shows the result, as Figure 20 displays.

The result of testing the add operation
Figure 20. The result of testing the add operation


This article has shown a very fast way to turn a Web-enabled application into a Web service. But I have only just scratched the surface of what you can do with the RoboSuite Control. In general, the controls generated may be used anywhere other types of controls are used, for example in page flows, custom controls, or process workflows. I also haven't told you about the numerous other special RoboSuite features for WebLogic Workshop included in RoboSuite BEA WebLogic Edition. These features include clipping portlets, Web service generation, a tag library for calling robots from JSP pages, and the Java API for writing custom Java code to execute robots. I may cover some of these more advanced features in a future article.


Although I recommend that you follow the instructions in this article and create your own Web service and control, I include the code of the example here for you:

  • The Web service: phone.jws - should be placed in the root of your Web service project.
  • The control: phone.jcx - should be placed in a folder called controls in the root of your Web service.
  • The robot library: phone.robotlib - should be placed in a folder called controls in the root of your Web service.

Additional Reading

Jesper Jørgensen is the Director of Engineering at Kapow Technologies, located in Denmark. Jesper J�rgensen holds a Ph.D. and M.Sc. in Computer Science from University of Copenhagen.