Creating Outside-In Web Services

Prerequisites

  • You have created an EJB project 3.0.

    More information: Creating EJB 3.0 Projects in the Developer Studio .

  • You have created an Enterprise Application Project and the EJB project 3.0 is added to it.

  • You have configured the AS Java settings in Start of the navigation pathWindow Next navigation step Preferences  Next navigation step  SAP AS JavaEnd of the navigation path. More information: Configuring the Application Server in the Developer Studio

  • The application server and Web service runtime are set in the SAP NetWeaver Developer Studio from Start of the navigation pathWindow  Next navigation step  Preferences  Next navigation step  Web Services  Next navigation step  Server and RuntimeEnd of the navigation path. In the Server field, choose SAP Server , and in the Web service runtime , choose SAP NetWeaver .

  • If you want to use the WSDL of a Service Interface modeled in the ESR, open the Enterprise Service Browser. In this case you can start the wizard directly from the Enterprise Service browser. More information: Browsing Enterprise Services from the SAP NetWeaver Developer Studio .

  • If you want to use customization files, you should have them available in advance.

  • Optionally, you can configure resource management settings of the SAP NetWeaver Developer Studio.

    More Information: Configuring Resource Management Settings

Context

You can create a Web service using a WSDL document as a basis.

In this case, the Web service framework generates the skeleton of the implementation bean containing the Web service methods' declarations for the operations in the WSDL document. You have to provide your own implementation to the Web service methods.

The Java EE Web service tools generate outside-in Web services with EJB endpoints only. By default, the framework creates a stateless session EJB for an endpoint.

As a basis for the outside-in Web service generation, you can use a WSDL document located in the Services Registry, the Enterprise Services Repository, or on a file system, or at a remote location (such as a URL). Some WSDL documents, such as those for Service Interfaces (SI) modeled in the ESR may not contain service, port, and/or binding information. During the Web service generation, the framework updates the WSDL document with the necessary information. By default, when the WSDL document does not contain binding information, the Web service framework updates the WSDL and sets the binding to SOAP over HTTP. You cannot change this default setting.

More information: Collision Resolution and Global Customizations

Procedure


  1. Import the WSDL document which you want to use to create a Web service. More information: Importing WSDL Documents in the SAP NetWeaver Developer Studio .

  2. To create a Web service from a WSDL document you imported, in the Project Explorer of the Java EE perspective, choose the WSDL document, and then from the context menu choose Start of the navigation pathWeb Services Next navigation step Generate Java bean skeletonEnd of the navigation path.

  3. On the Web Services screen, proceed as follows:

    1. Move the slider to the Develop Service position.

      In this case, the Web service framework only generates the relevant artifacts (it does not deploy them on the application server) and you can provide an implementation of the generated Java bean skeleton.

    2. Under Configuration , choose Service EAR Project , and make sure that the correct service EAR project is selected in the Service project field.

    3. Choose Next .

    4. If the imported WSDL document does not contain a service endpoint, the Update WSDL window opens.

      • To update the WSDL document with a service endpoint or binding, choose Update WSDL . At a later stage, the system overwrites the WSDL document using the values that you provide.

      • To preserve the original WSDL document, choose Do not update WSDL . At a later stage, the system creates a new WSDL document using the values that you provide.

    5. On the Select output path screen, proceed as follows:

      1. If necessary, specify the output folder in which you want the Java artifacts to be generated.

      2. Choose the way in which you want to resolve the possible collisions in the WSDL to Java mapping during the conversion of the WSDL document to Java artifacts.

      The table below provides information about the separate options and their meaning:

      Option

      Meaning

      Resolve collisions interactively

      The Web service framework resolves collisions based on input from you.

      More information: Using Interactive Conflict Resolution

      Resolve collisions automatically

      The Web service framework resolves collisions compliant with a predefined algorithm.

      More information: Using Automatic Conflict Resolution

      Specify JAX-WS customization files

      You can use JAX-WS 2.0-compliant customization files prepared in advance to apply customizations. This option is available only when the WSDL document is imported in the SAP NetWeaver Developer Studio.

      More information: Using JAX-WS Customization Files

      Apply WSDL without customizations

      The Web service framework processes the WSDL document as it is. If the WSDL document itself contains customizations in that, for example, it was manually edited, the framework will process these customizations.

      More information: Using No Customizations

      Depending on the customizations level you choose on this screen, the wizard provides different options on the subsequent screens. In addition, depending on the settings, which you provided in the Start of the navigation pathWindow  Next navigation step  Preferences  Next navigation step  Web Services  Next navigation step  Resource ManagementEnd of the navigation path window, the tools prompt you to confirm creation of resources or check out of updated existing resources.

Results

The implementation bean is generated. For every property of a design time feature, such as authentication level, or WSRM enablement, which is configured in the WSDL document, the Web service framework has generated the corresponding design time annotations. Next steps:

  1. Provide implementation to the business methods of the Web service.

  2. When you implement the Web service, you can configure the properties of design time or runtime features for this Web service by using annotations provided by SAP. More information: Configuring Web Services at Design Time .

    If you want to provide a WS-RM-enabled Web service, or a Web service, which uses TU&C/C, In the application-j2ee-engine.xml file of the EAR containing the Web service, add a runtime reference to the WS-RM application on the application server as shown in the code sample below:

    <?xml version="1.0" encoding="UTF-8"?>
    <application-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">
      <reference reference-type="hard">
        <reference-target target-type="application" provider-name="sap.com">tc~esi~esp~wsrm~app</reference-target>
      </reference>
    </application-j2ee-engine>
    
                   

    More information: Providing TU&C/C Web Services

  3. Deploy the implemented Web service. More information: Building, Publishing and Removing Published Java EE Applications .

  4. Configure the Web service in the SAP NetWeaver Administrator. More information: Configuring Web Services and Web Service Clients in the SAP NetWeaver Administrator