Sie sind auf Seite 1von 55

Providing and Consuming

Web Services in ABAP


Peter McNulty
SAP NetWeaver Product Management
Agenda

Overview of the Web Service technology

Inside-out approach: Creating a Web Service from existing


business functionality

Demo: Create a Web Service

Consuming a Web Service from an ABAP program

Demo: Consume a Web Service

Summary

© SAP AG 2005, SAP TechEd ’05 / CD153 / 2


Agenda

Overview of the Web Service technology

Inside-out approach: Creating a Web Service from existing


business functionality

Demo: Create a Web Service

Consuming a Web Service from an ABAP program

Demo: Consume a Web Service

Summary

© SAP AG 2005, SAP TechEd ’05 / CD153 / 3


Web Services Overview: Definition

WEB SERVICES are


SELF CONTAINED
and SELF DESCRIBING
APPLICATION FUNCTIONALITIES
that can be
PROCESSED
through
OPEN INTERNET STANDARDS

© SAP AG 2005, SAP TechEd ’05 / CD153 / 4


Web Services Overview: The Nature of Web Services

Web Services

act like a black-box that may require input and deliver


a result

work on top of any communication technology stack

can be published, discovered and invoked based on open


technology standards

work in synchronous and asynchronous scenarios

facilitate integration within an enterprise as well as cross


enterprises

© SAP AG 2005, SAP TechEd ’05 / CD153 / 5


Web Services Overview: The Paradigm

UDDI
UDDI
Service Directory

2 1
Discover Web service Direct WSDL exchange Create Web service
Develop Client App Create WSDL
Publish WSDL (opt.)

WSDL
WSDL
Document
Document

Web service

Web service
Client

SOAP

Bus. Functionality
Web service Execution Web service Provider

© SAP AG 2005, SAP TechEd ’05 / CD153 / 6


Web Services Overview: Examples

Intelligent product catalog search Publish and analyze financial


reports (XBRL based)
Product availability check
Electronic bill presentment and
Pricing inquiry payment
Customer credit check Matching vacancies and job
applicants profiles
Order status check
Postal service address check
Vendor managed inventory
Demand forecasts, stock UDDI registration and discovery
replenishment …
Automated web searches
Dynamic auctioning and bidding (Google)

© SAP AG 2005, SAP TechEd ’05 / CD153 / 7


Web Services Overview:
Example Get Employee Address Info
Manager Company Service Provider

CRM

Get
Employee Employee
Portal Contact
iView Address
Information Information

Archiving
Database
HR

Private
Address

= Web Service
© SAP AG 2005, SAP TechEd ’05 / CD153 / 8
Web Services Overview: Fundamental Elements of the
complete Web Service Solution

Open Technology
Standards for Web
Services
Referent
XML, WSDL, SOAP, UDDI, WSI
to business
semantics

RosettaNet,
Spec2000,
HR-XML,
Web Service XBRL, IFX,
Technology papiNet,
....
SAP NetWeaver

© SAP AG 2005, SAP TechEd ’05 / CD153 / 9


Web Services Overview: Standards – Overview

Examples for Supported


Standards in SAP NetWeaver
W3C
SOAP 1.1
WSDL 1.1
XML Schema
XML Signature
XSL
BPML
SAP NetWeaver is based on CIM
Open Standards OASIS
SAML
UBL
SAP NetWeaver Supports UDDI 2.0 / 3.0
Standards on Technology, WSRP
WS-Security
Framework and Business Level XML.org
Wf-XML
WS-I
Built on a consistent technology Basic Profile 1.0
and application stack XMLA
UDDI4J
JAX-RPC
JAXM
… and many others

© SAP AG 2005, SAP TechEd ’05 / CD153 / 10


Web Services Overview: Standards – UDDI

Universal Description, Discovery and Integration (UDDI)


Describes how to advertise and discover a Web service
Differentiates Web service provider, Web service and Web
service type
Holds metadata that can be used to search for services
(names, IDs, categories, types, etc.)
Specifies the interface for Web service registries

UDDI Business Registry


THE directory for Web services on the Internet
Publicly available, free of charge
Operated by SAP, IBM, Microsoft, and NTT Communications
UDDI Version 3 Beta available now
SAP’s node at http://uddi.sap.com

© SAP AG 2005, SAP TechEd ’05 / CD153 / 11


Web Services Overview: Standards – WSDL Overview

Web Service Description Language


Describes the basic characteristics of a Web service
Supported operations and their data format e.g. xCBL Order
Supported protocols e.g. SOAP
Network address e.g. http://a.com/order

Further information
Working Group: http://www.w3.org/2002/ws/desc/
Specification: http://www.w3.org/TR/wsdl12/

© SAP AG 2005, SAP TechEd ’05 / CD153 / 12


WSDL Document Structure
<definitions>
<types>
The data types used by the web service
</types>
<message>
The messages used by the web service
</message>
<portType>
The operations performed by the web service
</portType>
<binding>
The communication protocols used by the web service
</binding>
</definitions>
© SAP AG 2005, SAP TechEd ’05 / CD153 / 13
WSDL Types Element

Defines the data types used by the web service

XML Schema Definition Language

© SAP AG 2005, SAP TechEd ’05 / CD153 / 14


WSDL Message Element

Defines the data elements of an operation

© SAP AG 2005, SAP TechEd ’05 / CD153 / 15


WSDL portType Element

Defines the supported operations that can be performed


and the messages that are involved.

This is an example of a request-response operation

© SAP AG 2005, SAP TechEd ’05 / CD153 / 16


WSDL Bindings Element

Defines the message format and protocol details for a web


service
The soap:binding element has two attributes. In this example …
style attribute is document
transport attribute defines the SOAP protocol to use HTTP
The operation element defines each operation that the port exposes.
input and output operations are encoded as "literal”

© SAP AG 2005, SAP TechEd ’05 / CD153 / 17


WSDL Service Element

Defines the set of ports supported by the web service


For each supported protocol there will be one port element

© SAP AG 2005, SAP TechEd ’05 / CD153 / 18


Web Services Overview:
Standards – SOAP Structure and Features

Transport Binding
HTTP, SMTP, …
Message Format
SOAP
Protocol specific data
Header (e.g. quality of service)

Body Application-specific data


Application Data Type system

© SAP AG 2005, SAP TechEd ’05 / CD153 / 19


Web Services Overview: Standards – SOAP Example

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>


< SOAP-ENV:Envelope
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SAP="http://sap.com/xi/XI/Message/30">


<SOAP-ENV:Body >
<pns:getEmployeePersonalAddress
xmlns:pns="urn:AddressWSVi">
<employeeID >1001</employeeID>
<addressType>HM</addressType>
<actualDate >2005-08-22</actualDate>
</pns:getEmployeePersonalAddress>
</SOAP-ENV:Body >

</SOAP-ENV:Envelope >

© SAP AG 2005, SAP TechEd ’05 / CD153 / 20


Web Services Overview: Standards –
Web Services Interoperability Organization (WS-I)

“Accelerating the adoption of Web services by reducing the cost


associated with standards adoption”

Focus on Web service interoperability


Select, integrate and profile existing industry standards
Provide implementation guidance and tools

Deliverables
Profiles specify conformance requirements for Web services
Testing Tools can be used to test profile conformance
Sample Applications demonstrate interoperable implementations

WS-I Basic Profile 1.0


Industry’s common denominator for Web service applications
Covers HTTP, XML, XML Schema, SOAP, WSDL, and UDDI
Finalized August 12, 2003

© SAP AG 2005, SAP TechEd ’05 / CD153 / 21


Web Services Technology Overview:
Providing Web Services based on Open Standards
Development Environments

UDDI
UDDI
Registry WSDL

ABAP Java

Web service
Meta Data
WS
… … …
Client
XI Server Proxy

Virtual Interface
IDOC

Application
Interfaces
Standard

Business
SOAP Web service BAPI

Runtime RFC
Web service

EJB

Java Class

SAP Web Application Server

© SAP AG 2005, SAP TechEd ’05 / CD153 / 22


Web Services Technology Overview:
Consuming Web Services based on Open Standards
Development Environments

UDDI
UDDI
Registry
WSDL

ABAP Java

Web service
Meta Data
Web service Client

Web service
Application

Proxy

SOAP
Web service
Runtime

Web service
Bus. Functionality

Web service Provider


SAP Web Application Server

© SAP AG 2005, SAP TechEd ’05 / CD153 / 23


Web Services Technology Overview:
Value Added Web Services with XI
“Mediated”
Web services
with Routing, Adapter 3rd Party
Mapping and BPM

Web service SOAP SAP XI Adapter SAP System


Client Integration Server XI Protocol
or SOAP

Web service SOAP SAP Web AS


Client ≥ 6.40

Point-to-Point
“Basic” Web services

© SAP AG 2005, SAP TechEd ’05 / CD153 / 24


Agenda

Overview of the Web Service technology

Inside-out approach: Creating a Web Service from existing


business functionality

Demo: Create a Web Service

Consuming a Web Service from an ABAP program

Demo: Consume a Web Service

Summary

© SAP AG 2005, SAP TechEd ’05 / CD153 / 25


Two basic Ways of Developing an Interface

Inside-Out
Start of implementation in the backend system
Interface semantics pre-defined and reflects directly
implementation
Drawback: Implementation details are visible in the interface

Outside-In
Central design of interfaces that make business sense in
SAP XI Integration Repository
Using global data types
Reference to Governance Process for PIC
Generation of proxies from abstractly modeled interface
Implementation of “glue code” between proxy and business
function
Implementation can be changed without changes in interface

© SAP AG 2005, SAP TechEd ’05 / CD153 / 26


Creating a Web Service in less than ONE Minute

1
Implement No Web service specific programming
Business Application New or existing applications
Defines standard interfaces
Well known programming models

WS Configuration 2
WS Variant /Definition * Generate
Wizard based approach
Service/Virtual
Web Service Based on preconfigured profiles
Interface* Based on abstract behavior
Available for ABAP & Java

3
Activate /
Deployment in Java
Deploy Web Service
*Note: Activation in ABAP
The terms Service Interface
and Variant refer to the ABAP
7.0 implementation They
correlate to Virtual Interface
and WS Definition on the Java
stack and ABAP 6.40 release.

© SAP AG 2005, SAP TechEd ’05 / CD153 / 27


The Web Service Creation Wizard – Background

Out-of-the-box Web services enablement of SAP solutions

Allows to expose an existing endpoint as a Web Service with


a few mouse-clicks

Only shows the most important settings in the wizard


Default values (profiles) for other settings

Hides technical details

Implicitly creates all necessary objects

ABAP Web Service Wizard transaction: WS_WZD_START

© SAP AG 2005, SAP TechEd ’05 / CD153 / 28


Demo – Web Service Creation Wizard

Demo

© SAP AG 2005, SAP TechEd ’05 / CD153 / 29


Demo – Web Service Creation Wizard

Enter a
name of
the Service
Definition
and select
the endpoint
type.

© SAP AG 2005, SAP TechEd ’05 / CD153 / 30


Demo – Web Service Creation Wizard

Select the
Function
Module

© SAP AG 2005, SAP TechEd ’05 / CD153 / 31


Demo – Web Service Creation Wizard

Choose
authorization
profile and
release the
Web service

© SAP AG 2005, SAP TechEd ’05 / CD153 / 32


The Web Service Homepage …

… is available for each deployed Web Service

… shows the documentation for the Web Service

… allows to retrieve WSDL descriptions in different styles

… offers testing capabilities

… can be used to test SAP and non-SAP Web services

… is a JSP page which requires the Java stack to be installed

© SAP AG 2005, SAP TechEd ’05 / CD153 / 33


Demo – Web Service Homepage

Demo

© SAP AG 2005, SAP TechEd ’05 / CD153 / 34


Demo – Web Service Homepage

Overview
page

© SAP AG 2005, SAP TechEd ’05 / CD153 / 35


Demo – Web Service Homepage

Result of the
Web service
test.

© SAP AG 2005, SAP TechEd ’05 / CD153 / 36


Creating a Web Service Step-by-Step

The Step-by-Step approach


Create all objects by hand

Full flexibility and options

More expenses

… but still configuration only

© SAP AG 2005, SAP TechEd ’05 / CD153 / 37


Web Service Interface – Background

The Service Interface is the


interface visible to clients
(via WSDL, UDDI,…)

A Service Interface …

… provides abstraction from concrete implementation (=endpoint)

… allows to publish a “view” on existing implementations as Web Service Interfaces


i.e. renaming, hiding of parameters/methods, default values

… allows to define how the Web Service Interface is represented in the


SOAP message

Note: The term Service Interface refers to the ABAP 7.0 implementation. It
correlates to a Virtual Interface on the Java stack and ABAP 6.40 releases.

© SAP AG 2005, SAP TechEd ’05 / CD153 / 38


Web Service Interface – Background
<SOAP-ENV:Envelope> Response
<SOAP-ENV:Envelope> Request <SOAP-ENV:Body>
<SOAP-ENV:Body> <rpl:getHomeAddressResponse>
<ns1:getHomeAddress> <rpl:Response>
<ns1:Employee>1001</ns1:Employee> <tns:street>10 Main Street</tns:street>
</ns1:getHomeAddress> <tns:city>Ottawa</tns:city>
</SOAP-ENV:Body> <tns:province>Ontario</tns:province>
</SOAP-ENV:Envelope> <tns:country>CAN</tns:country>
</rpl:Response>
</rpl:getHomeAddressResponse>
Rename Rename </SOAP-ENV:Body>
methods parameters Provide default values and
</SOAP-ENV:Envelope>
hide parameters

getHomeAddress
Employee Default Value street city province country
(I) HM (O) (O) (O) (O)

Virtual
Interface

getEmployeePrivateAddress

i_employee i_address e_street e_city e_county e_country


ID (I) _type(I) (O) (O) (O) (O)
Implementation
Layer

© SAP AG 2005, SAP TechEd ’05 / CD153 / 39


Demo – Web Service / Virtual Interface

Demo

© SAP AG 2005, SAP TechEd ’05 / CD153 / 40


Demo – Web Service Interface

© SAP AG 2005, SAP TechEd ’05 / CD153 / 41


Web Service Variant / Definition *

A Web service Variant /


Definition is the assignment
of behavior to a Web Service
Interface via features

Motivation
A Web service is not only described by its interface but also by its behavior with respect to
stateless/stateful communication,
transactional behavior,
security requirements, …

Idea
describe this kind of behavior via abstract features
leave it to the Web Service Configurator to assign technical protocols to these
abstract features
Example:
Feature: Stateful
Technical Protocols: Stateful via HTTP-Cookies,
Stateful via URL-Extensions

Note: The term Web Service Variant refers to the ABAP 7.0 implementation. It correlates to a
Web Service Definition on the Java stack and ABAP 6.40 releases.

© SAP AG 2005, SAP TechEd ’05 / CD153 / 42


Web Service Variant / Definition

Benefits
The same Web Service Variant / Definition can be deployed to
various application servers which may differ in their technical
capabilities

Web Service Client implementations do not depend on technical


server information
Clients are generated based on implementation-independent Web
Service variants / definitions
Technical details are configured separately in the Web Service Client
Runtime

© SAP AG 2005, SAP TechEd ’05 / CD153 / 43


Demo – Web Service Variant / Definition

Demo

© SAP AG 2005, SAP TechEd ’05 / CD153 / 44


Demo – Web Service Variant / Definition

© SAP AG 2005, SAP TechEd ’05 / CD153 / 45


Web Service Configuration & Deployment

A Web Service Configuration is


the assignment of technical
protocols to abstract features

Based on the Web Service capabilities of the


specific SAP Web Application Server

Configuration of additional Web Service Runtime features


Logging, Tracing, Monitoring
Security Roles

Deployment as usual
SDM deployment in Java

© SAP AG 2005, SAP TechEd ’05 / CD153 / 46


Demo – Web Service Configuration

Demo

© SAP AG 2005, SAP TechEd ’05 / CD153 / 47


Demo – Web Service Configuration

© SAP AG 2005, SAP TechEd ’05 / CD153 / 48


Agenda

Overview of the Web Service technology

Inside-out approach: Creating a Web Service from existing


business functionality

Demo: Create a Web Service

Consuming a Web Service from an ABAP program

Demo: Consume a Web Service

Summary

© SAP AG 2005, SAP TechEd ’05 / CD153 / 49


Creating a Web Service Client Application

1
From UDDI
Retrieve WSDL Via URL (from server)
From local Server
From File System
From XI repository

2
Generate
Web Service Proxy Environment specific
Available for ABAP & Java

3
Develop
Client Application Focus on Business Application
SOAP / XML handling hidden by proxy

© SAP AG 2005, SAP TechEd ’05 / CD153 / 50


Demo – Creating a Web Service Client

Demo

© SAP AG 2005, SAP TechEd ’05 / CD153 / 51


Demo – Creating a Web Service Client

Create
Proxy
Object

© SAP AG 2005, SAP TechEd ’05 / CD153 / 52


Agenda

Overview of the Web Service technology

Inside-out approach: Creating a Web Service from existing


business functionality

Demo: Create a Web Service

Consuming a Web Service from an ABAP program

Demo: Consume a Web Service

Summary

© SAP AG 2005, SAP TechEd ’05 / CD153 / 53


Summary

The Enterprise Service Architecture (ESA), SAP’s


approach for building services-oriented business
applications utilizes Web Services as vital part of its
communication and integration strategy

SAP’s rich business functionality, in conjunction with


state-of-the-art technology, enables you to establish
cross-company business processes as an integrated
part of your development efforts based on Web Services

SAP NetWeaver Application Server offers an easy,


convenient way to build Web services

© SAP AG 2005, SAP TechEd ’05 / CD153 / 54


Questions?

Q&A

© SAP AG 2005, SAP TechEd ’05 / CD153 / 55

Das könnte Ihnen auch gefallen