Show TOC

Using Web Services in Visual ComposerLocate this document in the navigation structure

Use

This document describes how to generate a Web service, based on an interface defined in Visual Composer, in order to consume the Web service in Visual Composer.

You can define a service component within a Visual Composer model, which serves as a placeholder for a Web service implementation. From the service component, you can automatically create a WSDL file, which can then be used, outside of Visual Composer, to define the detailed Java implementation of the Web service. Once the implementation is complete, you can consume the Web service in your Visual Composer model.

The workflow involves the following steps:

  1. Defining the Interface of the Service Component

    In your Visual Composer model, you create a service component that serves as a placeholder for a Web service component. You use the interface defined by the service component to create a WSDL file, with a matching interface definition.

  2. Implementing the Web Service

    The developer uses the WSDL file to develop the necessary implementation in Java, create a Web service, and then deploy it. All this is done outside of Visual Composer.

    The modeler can continue working on the model in Visual Composer.

  3. Consuming the Web Service

    In Visual Composer, you can now search for the deployed Web service and consume it by dragging and dropping it into your model, either as a new component, or to replace an existing service component.

Prerequisites
  • You have created the EJB development component in the JEE perspective.

  • You have created the Enterprise Application (EA) development component in the JEE perspective, which references the EJB development component that you created.

  • You have created a development component and model in Visual Composer.

Procedure

Defining the Interface of the Service Component

  1. In the Visual Composer perspective, create a Composite View model.

  2. Drag a new Service Component from the Compose task panel into your model.

  3. Create the interface for the Web service:

    1. Drill down into the Service Component .

    2. Add connectors as required by the planned interface of the service component to be generated:

      Data In for in ports

      Data Out for out ports

    3. Define the planned data structure for each port.

    4. Save and close the new Service Component model.

  4. In the Composite View model, redefine the ports on the Service Component placeholder to add the newly defined ports.

    For more information, see Redefine Ports/Reload Component/Reload Data Service/Replace Comp .

  5. Save the model.

Note

These instructions can also be performed by accessing Visual Composer in the browser.

Implementing the Web Service

  1. In your model, from the Service Component context menu, select Generate WSDL .

    The Select an EJB Development Component dialog box opens, listing all the possible EJB target projects.

  2. From the list of Matching items , select an existing EJB to contain the new component.

    Answer Yes to the message that asks you whether to open the WSDL file.

  3. Change to the Java EE perspective.

  4. Locate the WSDL file within your EJB structure.

  5. From the WSDL context menu, select Start of the navigation path Web Services Next navigation step Generate Java bean skeleton End of the navigation path.

    The Web Service wizard opens. For more information, see Providing Web Services .

  6. Click Finish .

    A Java Bean skeleton is created with the necessary Java classes corresponding to the ports and data structure defined in the Service Component placeholder in Visual Composer.

  7. Code the implementation, create a Web service, and deploy the Web service to the JEE server.

    Make a note of the generated WSDL URL of the deployed service.

    For more information, see Creating an Inside-Out Web Service from an Enterprise Java Bean .

Consuming the Web Service

Note

The following instructions can be performed either in Visual Composer or in SAP NetWeaver Developer Studio.

  1. Define a destination for the Web service, using the WSDL URL generated in the previous procedure.

    For more information, see Creating Web Service Destinations and Creating Web Service Physical Destinations .

  2. In the Visual Composer perspective, search for the defined Web service.

    For more information, see Finding Web Services .

  3. Drag the Web service operation into your model to replace the Service Component placeholder.

    For more information, see Replacing Components .

  4. Connect the relevant In or Out ports to other elements, to create the logic and flow of the application. For more information, see Connecting Model Elements .

Note

These instructions can also be performed by accessing Visual Composer in the browser.

Caution

When working in SAP NetWeaver Developer Studio, you must define on the JEE server a Web service destination for the generated WSDL URL, with the same name as in the Developer Studio.