A virtual interface (VI) is the visual representation of a Web service to the outside world. Using VIs, you can define several views of the interface of an EJB and publish them separately. In a VI you can:
· Hide operations and parameters
· Replace names for operations and parameters with meaningful names
· Set fixed values for hidden parameters
· Convert parameter data types
· Define parameter representation in the SOAP message
In the following sections, there is a description of how to create a Web service using the example of an EJB.
To create a VI, proceed as follows:
...
1. Select the EJB, and choose New → Virtual Interface in the context menu.
2. Enter the name of a package and of the VI in the dialog box that appears.
3. Choose Next, then select the methods that you want to include in the VI.
Choose Finish.
4. On the Mapping tab in the VI Editor, make the settings for the methods and parameters contained in the EJB.
¡ Remove the tick in the Exposed checkbox if you do not want to offer the method in the Web service.
¡ If necessary, change the name of the method in the New Name field. The name of the method appears in the WSDL document.
¡ If necessary, change the following parameter options by selecting a parameter.
Field: |
Procedure: |
New Name
|
Enter a new name for the parameter. |
New Type Name |
Choose a new data type. You can make standard conversions for primitive data types that conform to Java types. |
Initial value |
Check this indicator if you want to set a default value. For parameters of type String, this is empty string; for type Integer is 0, and so on. |
Fixed value |
Enter a specific value for the parameter in compliance with the parameter’s type. |
To specify the format for SOAP messages of a Web service in detail, you can maintain SOAP extensions.
a. Choose Workbench → Preferences → Web Services.
b. Choose SOAP Extensions visible in the virtual interface editor.
c. Maintain the SOAP Extensions.(see: Maintaining SOAP Extensions).
5. Choose the Documentation tab. Create the documentation for the VI.
For more information on the Types tab, refer to the section Maintaining SOAP Extensions.
6. Save your entries using Save Editor Contents.
When you create a VI, a Web service consistency check is performed. To speed up the processing of creating a VI, you can suppress this check as follows: Select an EJB project and choose Properties, then Web Service Consistency Check from the context menu. Deactivate the consistency check by removing the tick the appropriate field.
You have created a virtual interface. It is displayed in the EJB Explorer under Virtual Interfaces:
Create a Web Service Definition.