You are on page 1of 28

EUROPEAN Web Services and

SAP TECHNICAL Openness


EDUCATION
CONFERENCE 2002

WORKSHOP

Sept. 30 – Oct. 2, 02 Bremen, Germany

Building Web Services with ABAP


and SAP Web Application Server

SAP AG
Learning Objectives

As a result of this workshop, you will


be able to:
n Understand Web Service Technologies like SOAP & WSDL
n Understand Web Service inside Web AS
n Implementing a Web AS Web Service
n Browsing the Web Service Repository
n Accessing a Web AS Web Service with Visual Studio .NET
n Accessing a Web AS Web Service from ABAP

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 2


Agenda

n Introduction to Web Services


n SOAP, WSDL

n Web AS Web Services

n Demo & Hands-On Web Service


Repository Browsing

n Summary

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 3


Web Service Architektur

Extension
Extension ssnn Extension
Extension w
wnn

●●●

●●●
●●●

●●●
Extension
Extension ss11 Extension
Extension w
w11

Security
Security Workflow
Workflow

Routing
Routing Orchestration
Orchestration Extensions
Extensions ?
?

SOAP
SOAP WSDL
WSDL UDDI
UDDI

WebService
WebService WebService
WebService WebService
WebService
Runtime
Runtime Description
Description Registration
Registration
ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 4
SOAP (XML Messaging Protocol)

n Defines an XML Based Protocol


n Specifies an processing model
n Specifies an envelope for exchanging XML documents
n Specifies error handling
n Specifies how to use transport protocol with SOAP
u (HTTP, SMTP, MIME, ...)
n Specifies a simple encoding schema for common data types

n Version 1.1 published as W3C Note on May 8, 2000


n Submitted by 11 companies, including SAP
n W3C XML Protocol Working Group established in September 2000

n Version 1.2 available as W3C Working Draft

n Further information
n Working Group: http://www.w3.org/2000/xp/Group/
n Specification: http://www.w3.org/TR/soap12/

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 5


SOAP Message Example

<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/…“
xmlns:soapenc="http://schemas.xmlsoap.org/…" >
<soap:Header soap:mustUnderstand=“1“>
<h:MessageID xmlns:h="http://myheader.org/">
4711-88/15
</h:MessageID>
<soap:Header>
<soap:Body>
<GetOrderList xmlns="http://tempuri.org/">
<OrderNumber>order-nr-x</OrderNumber>
</GetOrderList>
</soap:Body>
</soap:Envelope>

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 6


WSDL (Web Service Description Language)

n WSDL defines a web service by specifying the


n Web service interface (IDL)
n One or more transport protocols, that could be used to access the web
service (SOAP, ...)
n The service endpoints (URL)

n Version 1.1 published as W3C Note on March 15, 2001


n Consolidates earlier concepts from IBM and Microsoft
n Submitted by 25 companies, including SAP
n W3C Web Services Description Working Group established in January
2002

n Version 1.2 available as W3C Working Draft

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

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 7


WSDL Example (incomplete)
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s0=".." ...>
<types>
<xsd:schema targetNamespace="urn:sap-com:document:sap:rfc:functions">
<xsd:element name="RFC_SYSTEM_INFO" />
<xsd:element name="RFC_SYSTEM_INFO.Response">
(definition)
</xsd:element>
</xsd:schema>
</types>

<message name="RFC_SYSTEM_INFOInput">
<part name="parameters" element="s0:RFC_SYSTEM_INFO"/>
</message>

<portType name="RFC_SYSTEM_INFOPortType">
<operation name="RFC_SYSTEM_INFO">
<input message="s0:RFC_SYSTEM_INFOInput"/>
<output message="s0:RFC_SYSTEM_INFOOutput"/>
</operation>
</portType>

<binding name="RFC_SYSTEM_INFOBinding" type="s0:RFC_SYSTEM_INFOPortType">


<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="RFC_SYSTEM_INFO">
<soap:operation soapAction="http://www.sap.com/RFC_SYSTEM_INFO"/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
</binding>

<service name="RFC_SYSTEM_INFO">
<port name="RFC_SYSTEM_INFOPortType" binding="s0:RFC_SYSTEM_INFOBinding">
<soap:address location="http://ls0302.wdf.sap-ag.de:8080/sap/bc/soap/rfc"/>
</port>
</service>
</definitions>

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 8


WSDL Example (IDL part)

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s0=".." ...>


<types>
<xsd:schema targetNamespace="urn:sap-com:document:sap:rfc">
<xsd:element name="RFC_SYSTEM_INFO" />
<xsd:element name="RFC_SYSTEM_INFO.Response">
...
</xsd:element>
</xsd:schema>
</types>
<message name="RFC_SYSTEM_INFOInput">
<part name="parameters" element="s0:RFC_SYSTEM_INFO"/>
</message>
<portType name="RFC_SYSTEM_INFOPortType">
<operation name="RFC_SYSTEM_INFO">
<input message="s0:RFC_SYSTEM_INFOInput"/>
<output message="s0:RFC_SYSTEM_INFOOutput"/>
</operation>
</portType>
</definitions>

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 9


WSDL Example (access description)

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s0=".." ...>


<binding name="RFC_SYSTEM_INFOBinding"
type="s0:RFC_SYSTEM_INFOPortType">
<soap:binding style="document„
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="RFC_SYSTEM_INFO">
<soap:operation
soapAction="http://www.sap.com/RFC_SYSTEM_INFO"/>
<input><soap:body use="literal"/></input>
<output><soap:body use="literal"/></output>
</operation>
</binding>
<service name="RFC_SYSTEM_INFO">
<port name="RFC_SYSTEM_INFOPortType"
binding="s0:RFC_SYSTEM_INFOBinding">
<soap:address
location="http://ls0302.wdf.sap-ag.de:8080/sap/bc/soap/rfc"/>
</port>
</service>
</definitions>

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 10


Web Service Deployment and Usage

Service Provider Web or UDDI Service User


Server
Web
publish Service read
Tool
Tool Description Tool
Tool

(WSDL)

rate
gen

e
d

era

gen
r ea

te

Web
Web Web
Web calls
Service Intra- or
Service Service
Service Service
Service Client
Client
Internet
Stub
Stub Proxy
Proxy

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 11


Agenda

n Introduction to Web Services


n SOAP, WSDL

n Web AS Web Services

n Demo & Hands-On Web Service


Repository Browsing

n Summary

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 12


Web Service within SAP Web Application Server

The SAP Web AS and its Web Service capability is

n the foundation for all mySAP.com solutions

n a scalable, reliable Web application infrastructure that delivers


high-performance Web Services

n offering Web Service functionality for the ABAP and J2EE


personality with a common architecture

n is allowing to expose existing functionality (BAPIs, RFMs,


IDOCs, EJBs) as Web Service

n Easily allows to consume Web Service from any source

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 13


Benefits

n Fully integrated into the well known and stable development environment

n Full fledged UDDI capabilities


u UDDI server implementation
u UDDI client functionality

n WSDL generation

n Support of client proxy generation for ABAP and J2EE

n Extensible SOAP Runtime

n Pluggable Features
u Security
u Transactions
u Protocols
u ....

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 14


Providing Web services based on Open Standards
SAP Web Development
Application Environment
lWeb Service Configuration
Server
lUDDI Publishing
UDDI

Business Application
lWSDL Generation

WSDL
Web Service
Configuration

SOAP Processing

RFM
Web Service
Interfaces
BAPI
lExtensible Runtime
lPluggable Features
SOAP
l Security

IDoc
l Transactions
l Protocols
Web Service

EJB
Consumer
ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 15
Consuming Web services based on Open Standards

Development SAP Web


Environment Application
lWeb Service Proxy Server
Generation
UDDI
Business Application

lProxy Configuration
lUDDI based Web Service
discovery
WSDL

Proxy
Config.

SOAP Processing
Web Service

lExtensible runtime
Proxies

lPluggable features SOAP


l Security
l Transactions
Web Service
l Protocols
Provider
ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 16
Web Service Technology Evolution in Web AS (ABAP)

n Web AS 6.10
n Rudimentary SOAP Runtime for remote function calls (RFC)
n Not officially released

n Web AS 6.20
n Completion of Web AS 6.10 SOAP runtime functionality
n Web Service Browser for RFCs (WSDL generation)
n Generally released according to OSS note 566955 (with Support
Package 15)

n Planned for later versions of Web AS


n Complete Web Service Runtime for RFC, BAPI, IDOC
n Tool support
n Security
n WSDL
n UDDI access

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 17


Agenda

n Introduction to Web Services


n SOAP, WSDL

n Web AS Web Services

n Demo & Hands-On Web Service


Repository Browsing

n Summary

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 18


Exercises

We will do four Exercises

n Write ABAP functions that are accessible as Web Services

n Discover the WSDL Description

n Create a C# Client with Microsoft Visual Studio .NET

n Create an ABAP Web Service Client for an ABAP Web Service

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 19


Exercises

Note! This functionality is available in


Web AS 6.20 under the restrictions described
in OSS note 566955
n Not all features in this demo will run on your Web AS if
the required support package is not installed

n Do not use earlier versions for productive environments

n For further information see


http://service.sap.com/connectors

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 20


Exercise 1: Create ABAP Functions

n Logon to R/3
n Choose group ID from the Table Schema below
n userID = WR5D03W1-<groupID>
n Logon to M25/801
n Create functions as described in the exercises notes
n Non-ABAP programmers may use ZVW_ADD, ZVW_SUB and ZVW_SUM for the
next exercises

n Estimated time: 15min Speaker

00 01 02 03 ...
Seat Rows

10 11 12 13 ...
20 21 22 23 ...
... ... ... ... ...
Seat Cols

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 21


Exercise 2: Browse the Web Service Description
n Start your Browser at

n http://iwdf9379.wdf.sap.corp:1081/sap/bc/bsp/sap/WebServiceBrowser/search.h
tml?sap-client=801
n Switch to Project Search
n Enter ZWS<group ID>*

n Hit [add all] button


n In project frame hit [view WSDL]
Button
n Keep this browser window, you
will need it for the next exercise.

n Estimated time: 5min

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 22


Exercise 3: Create C# Client with Visual Studio .NET

n Start Visual Studio .NET

n Create a new Project


n Choose a C#-Project and select a ‚Console Application‘
n Ambitious user may develop a GUI based application J

n Add the Web Reference


n using your web service definition URL from Exercise 2
u Have you still got your browser window open?

n Implement the client program as decribed within the exercise


document

n Test and Run

n Estimated time: 25min

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 23


Exercise 3: Caveats

Set the URL before making the request

n to add the SAP Client

n to change the port (sometimes .NET generates 80)

n to switch between stateful and stateless

Add a Cookie-Container

n for stateful communication


n Try out without a cookie-container if you want. What happens?

Add Credentials

n SOAP Runtime entry point in Web AS requires authentication

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 24


Exercise 4: Create ABAP WS Client for ABAP WS

Note that the SOAP Runtime client side is specific to calling RFCs as Web
Services. For more information on its limitations, see OSS note 566955.
Follow the instructions in the exercise document. The following hints will help
you with step 4 of this exercise.
n Replace method RFC_SYSTEM_INFO by ZWS<groupID>_SUM
n Adjust the parameters
n Declare 2 variables
u One of type ZZVALUES (a table of integer) for the IN-Parameter
u One of type I (integer) for the result (OUT-Parameter)
n Fill the integer table with the first N integer
u Use a report parameter for N
n Add the integer table to the SOAP document
u Use direction CSoapConstants=>ic_param_in

n Call the function and display the result


n You may look into our solution for help (report ZWS_VW_CALC_SOLUTION)

n Estimated time: 20min

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 25


ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 26
Summary

Now you understand

n Web Service basics like SOAP &


WSDL

n Web Services inside Web AS

n How to Implement a Web AS Web


Service with an ABAP function

n How to access an ABAP Web Service


from external programs and ABAP
reports

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 27


Copyright 2002 SAP AG. All Rights Reserved

n No part of this publication may be reproduced or transmitted in any form or for any purpose without the express
permission of SAP AG. The information contained herein may be changed without prior notice.
n Some software products marketed by SAP AG and its distributors contain proprietary software components of other
software vendors.
n Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks of
Microsoft Corporation.
n IBM®, DB2®, DB2 Universal Database, OS/2®, Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®, OS/390®,
OS/400®, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere®, Netfinity®, Tivoli®, Informix
and Informix® Dynamic ServerTM are trademarks of IBM Corporation in USA and/or other countries.
n ORACLE® is a registered trademark of ORACLE Corporation.
n UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group.
n Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® and
other Citrix product names referenced herein are trademarks of Citrix Systems, Inc.
n HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide Web Consortium,
Massachusetts Institute of Technology.
n JAVA® is a registered trademark of Sun Microsystems, Inc.
n JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and
implemented by Netscape.
n MarketSet and Enterprise Buyer are jointly owned trademarks of SAP Markets and Commerce One.
n SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com and other SAP products and services mentioned herein as well as
their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries
all over the world. All other product and service names mentioned are trademarks of their respective companies.

ã SAP AG 2002, TechED_02 Bremen, Slot #, Speaker Name / 28

You might also like