Creating and Using a Service Control

A service control makes it easy to access a web service from your application. You create a new service control to access an existing web service (the target web service).

You can create a service control for a target web service if that web service publishes a WSDL file.

If the target web service was developed with Workshop, you can generate a WSDL file by right clicking on the web service .java file and choosing Web Services > Generate WSDL.

Creating a Web Service Control from a WSDL File

This procedure describes how to create a service control from the WSDL file for the target web service.

  1. Import (or drag and drop) the WSDL file for the web service into a package under the project's src folder. The project should be a web service project.

  2. Browse to the WSDL file in the Project Explorer view.

  3. Right-click on the WSDL file name and select Web Services > Generate Service Control.

Working with Complex Data Types

When you generate a service control, you will be prompted to create a JAR file that contains the complex data types, if the web service returns data that is not standard Java data types (integer, string, etc.).

If you want to work with the complex types without generating a service control, you can right click on the WSDL and click Web Services > Generate Types JAR File to generate a JAR file containing the classes needed to support the WSDL's complex types.

Using a Service Control

You use a service control in a client just as you would use any other control: first you declare the control in the client and then you invoke methods on the control.

You declare the control as follows:

    @Control
    private HelloWorldServiceControl helloWorldCtrl;

You invoke methods as follows:

    helloWorldCtrl.helloWorld();

For more information on invoking control methods in a client, see Invoking a Control Method and Handling Control Events.

Related Topics

Overview: Web Service Controls


Still need help? Post a question on the Workshop newsgroup.