Using Web Services

Objectives

After completing this lesson, you will be able to:
  • Use web services
  • Create a web service based on proxy technology

Web Services

Business processes are divided into process steps. You can assign one or more functions to each of these steps and an executing software component to each of these functions. In a typical heterogeneous system landscape in a company, the necessary functions in a global process are not all implemented using the same technology or the same components. The integration of an ever-increasing number of business partners, in particular, complicates this problem further. A modern software infrastructure must therefore be able to integrate functions that are implemented on different software components into an efficient global process.

Internet technology provides the basis for calling and communicating with distributed services. Superimposed onto this simple, globally-accepted communication standard, XML provides the basis for defining additional necessary standards. Only when you move away from proprietary definitions and toward generally accepted standards, is there a guarantee of smoothly integrating all the functions and partners involved in the process. The result is web services.

A web service is an independent, modular, and self-describing application function or service. Based on XML standards, these application functions can be described, made available, located, transformed, or called using standard Internet protocols.

Each web service therefore encapsulates a function, which is used, for example, to forward a price query to a provider, check the availability of an item in a retail system, locate a telephone number, or run credit card checks, convert currencies, or execute payroll functions.

Features of Web Services are:

  • Web services are application functions and services.

  • Web services can be used through internet standards.

  • Web services are self-descriptive.

  • Web services can be published and traced.

Web Service Paradigm

The figure illustrates the most important web services and internet standards and how they interact.

Service Provider

A service provider provides access to a service. If a service is a web service, the service provider has a corresponding XML-based description that is a Web Services Description Language (WSDL) document. Any programming language can be used to implement the web service.

Based on HTTP, Simple Object Access Protocol (SOAP) is now established as the quasi-standard access protocol. In a client/server relationship, the service provider can be regarded as the server.

When publishing a service, the service provider transmits information about itself and a description of the service it offers to the Service Registry (SR). A Service Registry is a type of yellow pages for web services. An SR provides, among other things, information about calling the web service. The Service Registry therefore provides only a description of the web service. This description forms an abstraction layer, independent of the corresponding implementation. The web service itself is hosted by the service provider.

Service Requestor

A web service user is referred to as a service requester. A service requester can, for example, be someone who locates a web service using a web browser and then uses the service. In most cases, however, the service requester is an application that accesses the web service. The application can also bind to the service dynamically if required, that is, the application can dynamically create a web service client proxy at runtime and use this proxy to access the web service. The application obtains the necessary information for accessing the web service from the service description.

This information is then stored in the SR. However, if the application knows the provider and the call details, it can use the web service without having to access the SR. In a client/server relationship, the service requester is the application client.

Web Service Standards

Web services can exist in any implementation. Therefore, a standardized description is required if web services are to be called from any application. The WSDL best meets this demand. However, a web services description in WSDL alone is not sufficient. To find the right business partner and corresponding service quotation, you need a company registry to help you to find the required service.

The web service provider must also be able to make its offer publicly available as easily as possible. The Universal Description, Discovery and Integration (UDDI) offers a solution.

For more information, see http://uddi.xml.org.

UDDI Registry (Universal Description, Discovery and Integration)

With its UDDI Registry and UDDI specification, UDDI provides the necessary tools for making services public. The specification provides a detailed description of how to locate and register services. The UDDI Registry contains a list of registered web services in WSDL format. The UDDI Registry does not store documents or specifications, but only references them.

SOAP

To call web services based on Internet technologies, a suitable protocol definition is needed. SOAP has created a simple standard that allows web services to be accessed in decentralized, distributed landscapes. SOAP specifies a package of XML documents for transport via Internet protocols such HTTP(S), SMTP, or FTP. SOAP defines a so-called envelope. In this envelope, you will find the actual XML-based message with a header and a body, as well as further information about how the message should be processed.

WSDL (Web Service Description Language)

WSDL is an XML-based description language for web services. The WSDL Service Definition includes the description of distributed systems and provides instructions for automating data exchange between applications. The Web Service Definition Language is used to describe web services or electronic services in XML format. A service is defined as a collection of endpoints (ports) and the messages they work with. By using WSDL, a service provider can describe the requirements and features of their web service so that a potential customer understands them and interacts properly with the service.

The abstract part of the WSDL file defines only the operations with the message and data types without concrete implementation. This abstract definition allows the reuse of these definition. At SAP you can generate such an abstract WSDL file, for example, in the Enterprise Services Repository (ESR), by exporting a Service Interface definition.

Structure of a WSDL File

Definition

The definition element is the root element in which the different namespaces are defined.

Types

Describes the data in XML format.

Messages

A message typically corresponds to an operation. The message element consists of one or more logical parts. Each part element references a type defined in the types element. A part could represent, for example, a parameter of a message or a function call.

Operation

Operation is an abstract term for the possible SOAP action of a web service. Each operation consists of one to three messages in addition to the name: an input, an output and possibly a fault message.

Port Type

Defines the operation of a web services that can be performed.

Binding

Defines the operation as well as the interface and the data format (SOAP, HTTP-GET, and so on)

Service

A set of similar connection points or address defined in the port element.

Port

Defines the connection point or the address (URL) of a web service.

Web Services Inspection Language (WSIL)

Web Services Inspection Language (WSIL) defines how web service descriptions can be found on a provider system.

For ABAP based SAP systems, call the URL: http://<host>:<port>/sap/bc/srt/wsil?sapclient=<client>

For Java based SAP system, call the URL: http://<host>:<port>/inspection.wsil

Web Services Development – SAP Approach

Inside-Out

There are two different development approaches for developing ABAP Web Services: Inside-Out and Outside-In.

With the inside-out approach, independent function modules that were implemented as RFC-enabled function modules, as function groups, or as BAPIs are provided as a web service. The web service can be used across the entire internet using standard protocols and can easily be added to any development environment.

Outside-In

In the Outside-In approach, development of Service Interfaces starts in a platform independent format, mostly XML. The AEX provides you with the Enterprise Services Builder tool, which supports the platform independent development of Service Interfaces. Connected application systems can read these interfaces. Using the ABAP Proxy technology, a developer can create an ABAP Object that consists of one or more ABAP Methods. The name of the created Methods is identical to the name of the Operations in the Service Interfaces in the ESR.

Because development begins outside the application system, this approach is called Outside-In.

To create a web service using the Outside-In approach, follow this high level description:

Outside-In Procedure:

  1. Develop your Service Interface in the ESR of your PI system.

  2. Generate a provider proxy.

  3. Fill the operation with the required logic.

  4. Create a runtime configuration for the provider proxy using the SOAMANAGER tool.

  5. Test your service in the Web Service Navigator (WSNavigator).

Web Services Tools

For developing web services at SAP, some tools are needed. For the implementation of the functionalities on the provider side and the call of these functionalities on the consumer side, you need the ABAP Workbench for the development.

For the configuration of the web service on the provider side and on the consumer side SAP offers the tool SOAMANAGER. For testing web services, SAP offers the Web Service Navigator (WSNavigator), which is a web service client, implemented in Java.

SOAMANAGER

For developing web services, SAP offers the tool SOAMANAGER in the SAP back end, which allows you to configure web services based on the Proxy Technology. You can use the SOAMANAGER for the complete configuration of service provider and consumer proxies for a local system.

The figure shows the initial screen of the SOAMANAGER transaction. You can perform the following:

Service Administration
  • Functionality to set up configuration to support business processes with web services.

  • This functionality is intended for business administrators who manage business processes across systems in a system landscape.

Technical Administration

This functionality is intended for technical system administrators who set up connections between systems and who manage the security settings in a system landscape.

Logs and Traces

Manage and configure logs and traces for web service provider and consumer calls.

Monitoring

Check for errors in the message exchange between a service provider and a service consumer.

SOAMANAGER Prerequisites are:

  • You have Administration authorization (for example, SAP_BC_WEBSERVICE_ADMIN_TEC or SAP_BC_WEBSERVICE_CONFIGURATOR).

  • In transaction SICF, you have activated the following nodes:

    • /sap/bc/srt (including sub nodes).

    • /sap/bc/webdynpro/sap/appl_soap_management.

  • The service and proxy definitions that you want to configure are available as development objects in the back-end system.

  • If you want to work with SOA Manager in a system landscape, you need to configure communication between ABAP systems.

Note

To set up SOA Manager for local access, you do not need to perform any special steps. As soon as you start SOA Manager, you can begin working on your local system.

Starting the SOAMANAGER

To start the SOAMANAGER:

  • Use the transaction code SOAMANAGER.

  • Alternatively you can start the SOAMANAGER in an Internet Browser using the link: http://<host>:<port>/sap/bc/webdynpro/sap/appl_soap_management?sap-language=<logon language>

Check Your Web Service

After the activation of the web service, check if the Web Service is active in the related Business System. To check the Web Service, call transaction SICF and open:

  • /sap/bc/srt/rfc/sap to find Web Services, which were created using the Inside-Out approach.

  • /sap/bc/srt/xip/sap to find Web Services, which were created using the Outside-In approach.

Web Service Navigator (WSNavigator)

With the Web Service Navigator (WSNavigator), SAP offers a Java based Test tool. The WSNavigator simulates a web service client that can call messages synchronously and asynchronously.

To start the WSNavigator, use the URL: http://<host>:<port>/wsnavigator.

WSNavigator Prerequisites

  • You have Administration privileges for the J2EE.

  • Or role SAP_JAVA_WSNAVIGATOR is assigned to your user.

  • Or your user is assigned a role that includes WSNavigator action.

List of allowed Hosts

Normally you can use WSNavigator to test web services on your local host. If you want to test a web service on another host, you have to maintain this host in a list of Allowed Hosts.

You can maintain the settings of this list in the SAP NetWeaver Administrator Tool. Alternatively you can call the URL: http://<host>:<port>/nwa/middleware-settings --> WSNavigator

HTTP Proxy Settings

If your company uses a HTTP Proxy in your corporate network to access public networks, you can enter this proxy host in the HTTP Proxy Settings. To maintain the HTTP Proxy Settings, call the URL: http://<host>:<port>/nwa/middleware-settings --> HTTP Proxy

Create a Web Service

Business Scenario

You want to create a web service from an existing server proxy.

Exercise Information

Note

In this exercise, when the values include ##, replace the character with a two-digit number (01–30).

Exercise Options

You can perform this exercise in two ways:

  1. Live Environment: choose Start Exercise, and from the entry page choose Open PDF Document. Follow the steps described in this pdf in your own system landscape.
  2. Simulation: choose Start Exercise, and from the entry page choose Start Tutorial. Watch the step-by-step instructions within the simulation.

Note

We recommend running the simulation first.

Task 1: Create a Web Service

Steps

  1. Log on the business system (ZME, client 800).

    1. Log on to client 800 of the SAP Back-end system ZME, using your user name and password.

  2. Navigate to the server proxy SI_Material_Details in SWCV SC_BIT400_C and start the Web Service Configuration using transaction SOAMANAGER.

    1. In the ZME/800 system, run transaction SPROXY.

    2. On the Object Navigator screen, choose Enterprise Services Browser. The design objects of the ESR display on the lower left side of the screen.

    3. Choose SourceESRSWCsSC_BIT400_C 1.0 of education.comNamespacesurn:education.com:BIT400:CObjects.

    4. Choose SI_Material_Details.

    5. On the Display Service Provider SI_Material_Details screen, on the button bar, choose Start SOA Manager (Ctrl+F10).

      Result

      The SOA Management Tool opens in a new Internet Browser Window.

  3. Configure your web service.

    1. Verify that the WebService Definition name in transaction SPROXY in System ZME/800 is identical with the name of the Service Definition on the Web Service Configuration screen.

    2. In the Web Service Configuration (R3_800;ZME;800) screen, choose Create Service.

    3. Enter the Service Name S_BIT500_##_MatDetail_ESR_syn.

    4. Enter the New Binding Name B_BIT500_##_MatDetail_ESR_syn.

    5. Choose Next.

    6. In Step 2 Provider Security set the flag User ID/Password for the Transport Channel Authentication and choose Next.

    7. In Step 3 SOAP Protocol accept the default setting by choosing the Next button.

    8. In Step 3 Operation Settings verify, that the Operation Name SI_Material_Details is identical to Service Provider Name in ZME/800 Tx SPROXY.

    9. Choose Finish.

    10. In the Define Services and Bindings Screen area, you will find the Service S_BIT500_##_MatDetail_ESR_syn and the Binding B_BIT500_##_MatDetail_ESR_syn.

    11. In the Actions column, choose the browser icon Open Binding WSDL Generation.

    12. In the next screen, select the flavor SAP default WSDL representation.

  4. Check if the created Web Service exists in the business system ZME/800.

    1. In the WSDL Generation screen area, choose the button Open WSDL document for selected binding or service.

    2. A new window opens. Scroll down to end of the document and verify that the address location fits to the path in transaction SICF in the business system ZME/800.

    3. In system ZME/800 start transaction SICF.

    4. In the Maintain Services screen, press button Execute (F8).

    5. Expand default_host and follow the path shown in the address location in the WSDL file.

    6. Check that the service S_BIT500_##_MatDetail_ESR_syn and the binding B_BIT500_##_MatDetail_ESR_syn are active in system ZME.

Task 2: Test Your Web Service

Steps

  1. Test your web service with the Web Service Navigator.

    1. Go back to the SOA Management browser window.

    2. In WSDL Generation for Binding screen, choose the Open Web Service Navigator for Selected Binding button.

    3. Login with your credentials.

    4. In the next screen, enter the WSDL URL and choose Next.

    5. In the WSDL Generation screen area, choose Test button.

    6. A new window opens. If required, log on with your user credentials.

    7. The Web Service Navigator tool starts. Log on with your user credentials, if required.

    8. Choose Next.

    9. In the Operations screen, verify that the Operation name SI_Material_Details is correct and choose Next.

    10. In the Parameters screen area, the input field for MT_MaterialID appears. Enter P-100 and choose Next.

    11. The result appears on the right side of the screen with the following values:

      Field Name

      Value

      MaterialID

      P-100

      Description

      Pump PRECISION 100

      Industry Sector

      M

      BaseUnit

      ST

      MaterialGroup

      001

      MaterialType

      FERT