Unit 5 The SAP Web Application Server as the Application Platform of SAP NetWeaver. Unit Overview This unit deals with the technological basis of SAP NetWeaver, the SAP Web Application Server. The first lesson in the first unit in the course already described how the SAP NetWeaver evolved across different releases. This unit now provides an overview of SAP Web AS Java on the SAP Web Application Server, the Web Service Framework, and the Web Dynpro.
Unit Objectives After completing this unit, you will be able to: ·
Explain what Java components there are
·
explain how the Java development and runtime environment is integrated into the SAP Web Application Server
·
Explain what Web services are and how the interaction between the Web service provider and the requester takes place
·
Create a Web service based on an RFC-compliant function module
·
Include a Web service in a program
·
Explain the basic principles of Web Dynpro
Unit Contents Lesson: Web Application Server Java (Web AS Java) ....................214 Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro............................................................................226 Exercise 11: Including a Web Service ...................................239
2005/Q4
© 2005 SAP AG. All rights reserved.
213
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Lesson: Web Application Server Java (Web AS Java) Lesson Overview The lesson gives you an overview about the integration of Java components into SAP Web Application Server 6.40.
Lesson Objectives After completing this lesson, you will be able to: ·
Explain what Java components there are
·
explain how the Java development and runtime environment is integrated into the SAP Web Application Server
Business Example You already use Java applications in your company. You want to continue to implement Java and ABAP applications, and want to know how to use the SAP NetWeaver platform for this purpose.
Java in general – Java Components – Java Contexts What is Java? When answering the question what Java is, most of the time keywords like “programming language,” “Internet,” or “World Wide Web” and “platform-independent programming language” come up, in which some companies of the IT industry are vehement advocates of the concept as a programming language and would like to define Java exclusively as a programming language. However, if you consider how the most important advantages of the language (for example the platform independency) are accomplished, then it becomes discernible that Java must additionally be seen as programming platform. This platform is realized through the Java Virtual Machine (Java VM). A Java program is written for this Java VM. The Java VM is a specification of the runtime environment that a Java program needs on every target system on which it can be executed. The spezifikation is available online under http://www.Javasoft.com.
214
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: Web Application Server Java (Web AS Java)
Figure 89: Java Compilation and flow of the Virtual Machine
Java source text is converted into a machine-independent bytecode format by the compiler. This source text can run on a hypothetical machine, the Java Virtual Machine (Java VM). Bytecode is small and can be transmitted efficiently via a network. Any machine on which a Java VM is installed can execute this object code. Network browsers like HotJava or Netscape have a Java runtime system integrated.
A Java program can run in different contexts, depending on how it is made available to the virtual machine. A Java program is always specifically written for a context. To be able to start a Java program, you need a Java VM. This VM should be supplied by the producer of the operating system. Alternatively, browser producers write own Java VMs in their browsers.
2005/Q4
Š 2005 SAP AG. All rights reserved.
215
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Figure 90: Java and its Contexts
If a Java program runs directly on the Virtual Maschine, that means, it is started with the Virtual Maschine, then it is a Java application or a standalone Java program. If a Java program is started in a browser, it is an applet. The browser (Frontend) receives source text, interpretes it, and executes it. If a Java program is started in a Web server, it is a servlet. For example, to create HTML pages, Java Server Pages (JSP), and servlets are executed. Java Server Pages enable the dynamic creation of Web content. It is about text-based documents that describe how request from a browser to a server and responses of the server to the browser are to be carried out. In JSPs, you describe the static part of a Web site – which does not change – using HTML code. You program the dynamic, changeable part in Java. JSPs are HTML source text, complemented by Java source text. Java Server Pages are converted into a servlet and subsequently executed. If you use an J2EE server, you can implement and execute application logic with access to database contents in so called Java beans.
The execution of EJB, JSPs, and servlets is carried out by the infrastructure provided by the J2EE server. It contains so called Container. In object-oriented programming, containers are objects that provide a flow environment for other objects.
216
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: Web Application Server Java (Web AS Java)
Architecture of the SAP Web Application Server 6.40 with Web AS ABAP and Web AS Java The SAP Web Application Server 6.40 (SAP Web AS) is the application platform of SAP NetWeaver. Thus, it is the basis of all SAP NetWeaver components. The SAP Web Application Server can – depending on the chosen installation option – execute ABAP and/or Java programs. In doing so, ABAP-based, as well as Java-based technologies can be used when creating Web applications. There exist the following installation options for SAP Web AS: ·
SAP Web Application Server ABAP System
·
SAP Web Application Server Java System
·
SAP Web Application Server ABAP+Java System
The following figure shows a server, for which the last-mentioned option was chosen.
Figure 91: Components of the SAP Web Application Server
Incoming Web requests are taken by the Internet Communication Manager (ICM), which decides on the basis of the URL, to whom it is forwarding the request, for the HTTP(S) requests can either be addressed to the Internet Communication Framework (ICF), that means to be processed in the ABAP work process, or, as well, for the Web AS Java and thus for a Java server process.
Comparable to the work processes in the ABAP engine, on the Java side there are so called server processes. As of Web Application Server 6.40, the concept of message and enqueue management of the ABAP world was carried over to the
2005/Q4
© 2005 SAP AG. All rights reserved.
217
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Java engine. In the figure above, you can see the so called central services, that means the processes message service and enqueue service, which exist as central services once per system. Also as of SAP Web Application Server 6.40, there is the opportunity to define two schemes in the system database: one for the data of the ABAP engine and one for the data of the Java engine. Only thereby becomes it possible to store Java data together with ABAP programs persistently in the system database. At the installation of Web AS Java a so called Java cluster is generated. A Java cluster in general always consists of one or several Java instances, the central services (message service and enqueue service) and the database. The term ’instance’ can be similary defined as in the ABAP world. A Java instance is a unit in the SAP Web AS Java cluster that can be separately started, stopped, and monitored. One (or various) instance(s) is(are) installed on a physical server. Every instance is identified by the system ID (SID) and the instance number. It is differentiated between “normal” Java instances and the instance “central service.” The “normal” Java instance consists of the Java dispatcher and one or various server processes. The Java dispatcher receives the client request and forwards it to the server process with the least workload. In case the connection to the client already exists, the request is forwarded to the server process that processes this client. The server processes of Web AS Java execute the J2EE application. Every server process is multithreaded and can execute many requests in parallel. SAP delivers various tools to administrate and monitor a Java cluster. The most important are: ·
J2EE Engine Visual Administrator Graphic tool that is used to administrate and monitor the entire Java cluster.
·
Configtool You can carry out configuration settings (changing parameters, adding and deleting of cluster elements) offline with the Configtool.
·
SAP Management Console List of all installed cluster elements. From there, you can start and stop Java instances
With the J2EE Engine Visual Administrator you have access to the various software layers of Web AS Java, which are classified there in “manager, services, libraries, and interfaces.” With the J2EE Engine Visual Administrator you can carry out configuration settings and monitoring tasks. The SAP Management Console lists all installed cluster elements hierarchically. The cluster elements are the various Java instances. The colors in which they are displayed represent the current status. Green indicates that the Java instance has been started and is operational. Yellow indicates that the Java instance is either started or stopped just now and respectively has a problem. Gray indicates that
218
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: Web Application Server Java (Web AS Java)
the Java instance has been stopped and is therefore not operational. The database instance has an own symbol in blue color. You can start and stop Java instances via the context menu of the secondary (right) mouse button. Caution: If an SAP Web AS was installed with ABAP and Java engine, then the dispatcher of the ABAP instance controls the starting and stopping of the Java cluster. You carry out administrative tasks in transaction SMICM.
Comments to the J2EE Standard Web AS Java is an integral part of the SAP Web Application Server and implements the J2EE standard.
Hint: This J2EE standard was defined by the Java community according to the rules of the Java community process and is thus copyrighted by Sun Microsystems. SAP is a member of the Executive Commitee of the Java community since November 2002.
Web AS Java implements Enterprise JavaBeans, servlets, and so on according to the determined standards. With Web AS Java in the SAP Web Application Server, SAP not only fulfills the J2EE standard, but exceeds the standard by far with the offered functions. To alleviate the realization of extensive software projects, SAP equips Web AS Java with the following additional features: ·
Java Persistence Implementation of a database-independent persistence layer
·
Central services (Message Server, Enqueue Server)
·
SAP Java Connector (JCo) A Java application can access data of the ABAP section in the database and vice versa via this component.
·
Web Dynpro Web Dynpro is a frontend technology that exceeds the opportunities of JSP and servlets by far
The Central Services – mentioned in the preceding section – - are the basis of communication and synchronization for the Java cluster. They consist of message service and the enqueue service. The message service is an individual program that serves for the communication between the elements of a Java cluster. It administrates a list of dispatchers and the server processes of the Java cluster and thus represents the infrastructure for data exchange between the participating
2005/Q4
© 2005 SAP AG. All rights reserved.
219
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
nodes. In addition, it delivers load balancing information when the load between various Java instances and the SAP Web dispatcher is balanced Performance problems are avoided via the application of the message service. These problems would appear if every cluster element was linked to every other and exchanged data (as was the case in Web AS 6.20). The enqueue service administrates logical locks that are set in a server process by the executed application program.
Web Dynpro is SAP’s own programming model on which future SAP applications are based on. Web Dynpro consists of a runtime environement and a graphic development environment with special Web Dynpro tools that are integrated into the SAP NetWeaver Developer Studio. Web Dynpro tools not only support the application developer at implementation but also during the blueprint phase. During the development of a Web Dynpro application, a platform-independent meta model is generated. From this model, Java classes are generated that are used within a servlet. If a Java application wants to read data from the ABAP section of the database, this is not easily achieved due to the fact that this data is stored in a different database scheme which cannot be accessed by the server process of the Java engine. Nevertheless, the component SAP Java Connector (JCo) enables such database accesses.
The Java Development Model and its Implementation in SAP Web Application Server 6.40 As you know a comfortable development environment from the programming language ABAP, Java offers with the Java 2 Software Development Kit (J2SDK) all tools that you need for the development of smaller Java applications: a runtime environment, the Java compiler, and debugger. In addition to that, there exist various local development environments that are based on the J2SDK, which guarantee a more comfortable development of applications. However, the development approach of Java is extremely differnt from the approach in ABAP. In ABAP, applications are developed centrally on a development system to which all participating developers log on, create their source text, store it centrally, and test it collectively. The individual programs of Java applications are created locally on the computers of the developers. In principle, there is no common storage or testing. This can lead to problems at development projects with many participants.
220
Š 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: Web Application Server Java (Web AS Java)
Figure 92: Critical points when developing locally
Java applications can consist of various versions and the developer must make sure that he/she uses the correct version of the source file and associated libraries. If the source text are checked out from a central directory, then the local development can begin, and after termination it can be checked in again. In doing so, problems may arise if, in the meantime, objects have been changed by other developers to which the source – that is worked on – refers to. The goal of the SAP NetWeaver Java Development Infrastucture (JDI) is to avoid the mentioned problems by transferring known and proven concepts from the ABAP world into the Java world. The result of this intention is the SAP NetWeaver Developer Studio. It is based on the Open-Source product Eclipse, whose open plug-in architecture offers an appropriate platform that can be enhanced with special functions. You can see the architecture in the following figure:
2005/Q4
© 2005 SAP AG. All rights reserved.
221
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Figure 93: SAP NetWeaver Developer Studio
Eclipse offers all the necessary tools for the development of Java programs. For J2EE projects in the SAP environment, you need additional functions that are not provided by Eclipse. SAP has extended the Software Eclipse with these functions via plug-ins. With SAP NetWeaver Developer Studio, SAP introduces its own development environment for the development of Java-based multi-layer business applications. As a central entry for all Java development tools and as an integration point for all SAP infrastructure components, SAP NetWeaver Developer Studio supports an efficient development of Web Dynpro and J2EE applications and is integrated into a defined software logistic process. The application developer must not change between the various development environments for the presentation logic and business logic, but can - centrally from the developer studio - develop, build, “deploy” (that means to make it available to the runtime environment), and execute the applications. Thus, the SAP NetWeaver Developer Studio offers a complete support in the development of Java projects on a large scale for the standard Java technologies, as well as for the SAP technologies (Web Dynpro, for example).
Change Management for Java Applications After an application is installed and configured, it has to be continously adapted to changing requirements. Changed requirements emerge, for example, from changes in your company organisation, the need of additional functions, or also by quality improvements in SAP components that are delivered at regular intervals from SAP, for example, via SAP Service Marketplace (support packages, patches).
222
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: Web Application Server Java (Web AS Java)
Figure 94: Change Management for Java Applications
The functions of the Software Change Management standardize and automatize the distribution and maintainance of software in complex software landscapes. On the page of the central infrastructure, you can find the services Component Build Service, Design Time Repository, and Name Server. The Name Server as part of the System Landscape Directory allows it to determine globally unambiguous names for software objects to avoid that objects of the same name meet in a runtime environment and possibly deactivate applications due to naming conflicts. The Design Time Repository (DTR) enables a version-dependent source text administration and therefore the distributed development of software in teams as well as the transport and the replication of sources. The Component Build Service (CBS) is used for the central build of the source texts. The handling for the developer is integrated into the SAP NetWeaver Developer Studio. It offers the following core functions: 路
Build on request
路
Central storage of build results
路
Activation concept
The central build of changes is carried out on order of the developer. The CBS provides the results of the build, as well as the environment necessary for the build (libraries, generators, ...). To make applications centrally available on runtime systems, you have to carry out a deploy via the Change Management Service.
2005/Q4
漏 2005 SAP AG. All rights reserved.
223
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Deploy can be translated with “insertion into an actual runtime environment,” that means, for example, to adjust paths and configuration data to the actual runtime environment that is to be used. As soon as an application was tested successfully on a central runtime system, it can be transported to other runtime systems via the Change Management Service (CMS). For more information about the Web AS Java, Java programming, Java administration, refer to courses ADM200 (administration of Web AS Java) and JA300 (SAP J2EE Startup Kit).
224
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: Web Application Server Java (Web AS Java)
Lesson Summary You should now be able to:
2005/Q4
路
Explain what Java components there are
路
explain how the Java development and runtime environment is integrated into the SAP Web Application Server
漏 2005 SAP AG. All rights reserved.
225
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro Lesson Overview This lesson introduces two of the main SAP NetWeaver components in the area of the SAP Web Application Server: Web services and Web Dynpro.
Lesson Objectives After completing this lesson, you will be able to: ·
Explain what Web services are and how the interaction between the Web service provider and the requester takes place
·
Create a Web service based on an RFC-compliant function module
·
Include a Web service in a program
·
Explain the basic principles of Web Dynpro
Business Example You want to develop a new, customer-specific, small application in your company and use the SAP Enterprise Portal as the user interface. You have heard that user interfaces based on Web Dynpro technology are easily integrated into the SAP Enterprise Portal. Web services are to be called from within the application to make data available. You now want a brief overview of the topics Web services and Web Dynpro.
Web Services and Enterprise Services With SAP Web Application Server 6.40 and SAP NetWeaver ’04, the concept of Web services – implemented in Java as well as in ABAP – gives rise to a new interface, which is based completely on open and generally accepted standards. Business processes (Enterprise Services) consist of more or less extensive process steps. You can assign one or more functions to each of these steps and an executing software component to each function. A modern software infrastructure must be capable of integrating functions – implemented on different software components – into an effective complete process.
226
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
Figure 95: Service-Based Architecture of the SAP Web Application Server
The combination of different applications was previously based mainly on manually declared interfaces, message formats, and agreements between business partners. This process can be simplified with the use of Web services. Web services are based on open and globally accepted standards. With Web services, you can combine functions – implemented in different software components – into a single process. Web services are independent, executable units, which can be published, searched for, and called network-wide. The SAP Web Application Server 6.40 implements the basic standards for Web services: eXtensible Markup Language (XML), Simple Object Access Protocol (SOAP), Web Service Definition Language (WSDL), and Universal Description, Discovery, and Integration (UDDI). The SAP Web Application Server also serves as a development platform for Web services.
SAP Web Application Server and Web Service Framework Enterprises can enhance their solutions by using Java and/or ABAP Web services. If an application is used for the selection of data sets, integrating an ABAP Web service could be effective. If processes involving different business partners and systems are implemented, programming in Java or integrating Java Web services could be beneficial.
2005/Q4
© 2005 SAP AG. All rights reserved.
227
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Figure 96: Web Services
WSDL documents describe Web services that are stored in Web service directories. Web service providers describe and publish their services. Users of Web services load and use these documents.
228
Š 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
The following list describes the interaction between Web service users and Web service providers: ·
Providing WSDL The provider makes a WSDL description file available for its existing services, usually in a UDDI directory. Note: WSDL – Web Service Description Language A Web service is described using WSDL. WSDL is an integral part of UDDI and is used by UDDI.
·
Using WSDL The user searches for a Web service in the UDDI directory and downloads the corresponding WSDL file. By means of proxy generation, the user creates a function from the WSDL file, which can be called locally. The proxy can carry out the creation of the XML document and the delivery via SOAP. Note: UDDI – Universal Description, Discovery, and Integration UDDI is a Web-based directory that can be accessed via the internet. The directory displays a list of Web services in WSDL format. These Web services can be called using the SOAP protocol. UDDI is different from other directory services in so far that it does not store documents or specifications, but only references to these.
·
Web Service Runtime When the proxy function is called, a SOAP request is created on the user side and sent to the Web service. The Web service processes the request and generally returns a result. The result is then made available to the caller in a local reply. Note: SOAP – - Simple Object Access Protocol SOAP describes a protocol with which Web services can be called in distributed system landscapes. SOAP uses the transport protocol HTTP. A SOAP message has a header (additional information concerning security and transaction) and a body (content of the message).
2005/Q4
© 2005 SAP AG. All rights reserved.
229
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Web Service Support in the SAP Web Application Server 6.40 With the SAP Web Application Server 6.40, SAP provides a separate infrastructure for the development, publication, and use of Web services. The Web service framework consists of the following components: ·
A distributed and interoperable SOAP runtime (Web AS ABAP or Java)
·
Development environment of Web AS ABAP In the Object Navigator (SE80), Web services can be created or included.
·
Development environment of Web AS Java, the SAP NetWeaver Developer Studio
·
Tools to support UDDI registration
Figure 97: Web Services in SAP Web AS >= 6.40
230
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
The following section contains an example of how you can work with Web services. It demonstrates both the work of the service provider as well as that of the service requester. ·
·
Role of service provider –
Creation of the functionality on which the Web service is to be based
–
Definition of a virtual interface and a Web service definition for this functionality (using a wizard)
–
Release for the SOAP runtime (transaction WSCONFIG)
–
WSDL generation and, if necessary, publication of the service in a UDDI directory (transaction WSADMIN)
Role of service requester –
Definition of a client proxy to represent the Web service in the calling system
–
Definition of a logical port
–
Creation of the calling program and use of the client proxy
The following section provides a detailed description of the individual steps for service providers and service requesters. ·
Role of service provider: Programming functions and creating a Web service –
Creation of a Web service, for example, based on an RFC-compliant function module (realizing the functionality) in SE37 (Utilities → More Utilities → Create Web Service → From the Function Module) Service providers make functions available across system boundaries; these were developed with an RFC-compliant function module, in a function group, as a BAPI, or as a message interface in SAP XI. When you create a Web service, you are supported by a wizard, which creates a virtual interface and the actual Web service definition. The virtual interface represents the interface of the Web service to the outside. You can thus define multiple views for one service; in these views, you can hide and rename operations and parameters, set standard values, or change parameter types. The Web Service Definition (WSD) consists of a range of features - for example, the publication of the WSD in the UDDI. Using transaction WSCONFIG, you release Web service definitions for the SOAP runtime. The release transaction WSCONFIG reads the default settings - for example, for the security of data transmission from the WSD - and provides appropriate configuration options.
2005/Q4
© 2005 SAP AG. All rights reserved.
231
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
The wizard for creating Web services also automatically includes the release of the service. –
Displaying the URL and WSDL in transaction WSADMIN, menu path Web Service → Web Service Homepage For released Web services, you can carry out the following actions using transaction WSADMIN:
·
–
Call the Web service homepage.
–
Generate WSDL for released Web services
–
Publish a Web service as a business service in the UDDI
Role of service requester: Generation of a proxy object to represent the Web service –
You have found a Web service that you want to use in one of your applications. Generate a client proxy in the ABAP Workbench. Call the ABAP Workbench (SE80) and create a proxy object (Create → Enterprise Service / Web Service → Proxy Object).The object should be based on a URL/HTTP destination.
·
–
Enter the URL of the service as stated by the service provider.
–
The system then generates an ABAP class, which you have to activate.
Role of service requester: Creation of a logical port –
Create a logical port for the service in transaction LPCONFIG and connect the definition with your generated ABAP class. The need for logical ports is illustrated by the following situation: A customer creates a Web Service and wants to transport it between systems. If the port for the proxy was stored directly in the WSDL description, the settings would either have to be changed there manually, or the customer would have to generate the proxy again after the transport to the productive system. Neither option is satisfactory. With the concept of logical ports, SAP enables you to maintain the connection of a port and a service in one transaction as and when required. You can also define settings – for example, specifications for the authentication of users.
·
232
Role of service requester: Creating a program and calling the Web service –
Create a program in the ABAP Workbench.
–
Open the folder Enterprise Services and Client Proxies.
–
Select your client proxy and move it into the new program using drag and drop.
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
–
Create the required source code.
SAP Web Application Server 6.40 and Web Dynpro In the preceding sections, you learned how to create and call Web services in order to shape intelligent business processes flexibly. In contrast, Web Dynpro provides a higher level of flexibility when creating user interfaces. ·
Basis for future SAP applications SAP’s own programming model for user interfaces
·
Provides a development and runtime environment
·
Ensures a clear separation of business and display logic with limited need for source code and extensive design in the user interfaces
·
Enables a consistent metamodel for all types of user interfaces and thus:
·
–
Allows execution on a multitude of client platforms
–
Ensures the highest level of platform independence for the interfaces
The difference between Web Dynpro for ABAP and Web Dynpro for Java is in the different development environment and the different runtime, not in the concepts.
Web Dynpro is SAP’s own programming model for developing user interfaces for professional business applications. Future SAP applications will be based on it. Web Dynpro consists of a runtime environment and a graphic development environment with special Web Dynpro tools, which are integrated in the SAP NetWeaver Developer Studio or the ABAP Workbench (transaction SE80).
The development environments provide intuitive, graphical tools for developing client applications and user interfaces. Web Dynpro provides support in the form of a declarative programming approach for the development of Web applications. Using special tools, you describe the properties of a Web Dynpro application in form of Web Dynpro metadata and automatically receive the source text, which is then executed at runtime.
2005/Q4
© 2005 SAP AG. All rights reserved.
233
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Figure 98: Displaying Web Dynpro Applications Using Rendering Machines
The definition of user interface is carried out as abstractly as possible, independently of client technology. Thus, Web Dynpro supports the development of applications for any client and also for mobile devices. The developer always uses the same development tools and the same UI elements (for example, pushbutton, TextView, input field, and so on) and must not worry about whether the user interface is intended to run on a desktop or a mobile device, for example. At runtime, the definition is transferred to the different clients via rendering engines. Whenever new clients have to be implemented, you need only create a new rendering engine; the source text of the application is not affected. The metadata of a Web Dynpro application is by principle independent of the platform on which the application is executed. Therefore, in the event that the application is to be executed on a different platform after its creation, the metadata can be transferred to the platform-specific development environment and the new source code required for this platform is generated. Only the source code that your programmed yourself – for example, in the event handling – would have to be adapted to the new platform.
234
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
Web Dynpro programming follows the Model View Controller approach, which has three different levels: ·
View: Data display Views define the layout of an application. They contain the sequence and the properties of the UI elements, as well as the declaration of the connection between the UI elements and the controllers.
·
Controller: Interaction The controller lies between the view and the model. It formats the model data that is to be displayed in the view, processes the user entries and returns them to the model.
·
Model: Connection to data sources and services The model forms the interface to the backend system and thus enables the Web Dynpro application to access data. Web Dynpro supports the following access types: –
RFC connection to SAP systems
–
Use of Web and Enterprise services
–
Enterprise Java Beans (for connections to SAP and non-SAP systems)
Figure 99: Web Dynpro – Components
2005/Q4
© 2005 SAP AG. All rights reserved.
235
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
The controller contains event handlers that react to certain events – for example, when a view is initialized, closed or called, or when a specific action is executed on a UI element. It also contains methods that the controller makes available to other controllers. You access backend data using the model.
Figure 100: Web Dynpro – Applications
With Web Dynpro, you can create complex, reusable development units. These reusable units are called components. A Web Dynpro component is a collection of views and controllers. Both the layout, as defined by the views, and the behavior of the component, identified by the controllers, are encapsulated and reusable in other Web Dynpro applications.
236
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
Figure 101: Web Dynpro – Integration in the SAP Enterprise Portal
Web Dynpro user interfaces can be easily integrated into the SAP Enterprise Portal using generic iViews with wizard support.
Further Information in the SAP Developer Network For further information and tutorials on the subjects of Web Dynpro and Web services, refer to the relevant pages in the SAP Developer Network at www.service.sap.com/sdn. After registering with the SAP Developer Network, you can view the areas Web Dynpro and Web services in the “Web Application Server” section.
2005/Q4
© 2005 SAP AG. All rights reserved.
237
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
238
2005/Q4
Š 2005 SAP AG. All rights reserved.
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
Exercise 11: Including a Web Service Exercise Objectives After completing this exercise, you will be able to: ·
Create a program in the ABAP Workbench
·
Include an existing Web service in your new program
Business Example You want to call an existing Web service – under the URL http://iwdf5238.wdf.sap.corp:50080/sap/bc/srt/rfc/sap/ZNW_WS_Systeminfo?sap-client=800&wsdl=1.1 – in your own, customer-specific program. The service was created in the system FN4 and calls the RFC-compliant function module RFC-SYSTEM_INFO. You logged on to the system with an anonymous logon user. In the system, a client proxy ZNW_CO_ZNW_WS_SYSTEMINFO already exists, which represents the Web service and you can use.
Task: Create a program in the ABAP Workbench of client 800 in your training system and call the existing Web service mentioned above. 1.
2005/Q4
Log on to client 800 of your SAP Web AS training system with user SAPNW-## and create a program that calls the above service for displaying system information. In the program, display the system ID, the host name, and the database on the screen. Use the commands specified in the solution.
© 2005 SAP AG. All rights reserved.
239
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
Solution 11: Including a Web Service Task: Create a program in the ABAP Workbench of client 800 in your training system and call the existing Web service mentioned above. 1.
Log on to client 800 of your SAP Web AS training system with user SAPNW-## and create a program that calls the above service for displaying system information. In the program, display the system ID, the host name, and the database on the screen. Use the commands specified in the solution. a)
Log on to client 800 of your SAP Web AS training system with user SAPNW-## and call transaction SE80. The local objects of user SAPNW-## should be displayed. If this does not occur, select this display. In the context menu for $TMP SAPNW-##, choose Create Program. Enter Z##_WS_Systeminfo as the name and deselect the With Top Include indicator.
b)
On the next screen, make the following settings: Type: Executable Program Status: Test Program
c)
Save the program as a local object.
d)
Now change the context of the ABAP Workbench. Choose Local Objects and enter the user specified by the instructor.
e)
Open the folder Enterprise Services - Web Service Library - Client Proxies.
f)
Select the client proxy ZNW_CO_ZNW_WS_SYSTEMINFO and move it into the newly created program using drag and drop.
g)
Uncomment all comment lines.
h)
Enter ’ZNW’ after Logical_Port_Name =.
i)
Specify the import and export variables in the CALL METHOD call. The lines must be as follows: Input = input Output = output
j)
To display the system ID, host, database, and operating system, enter the following WRITE statements after the CALL METHOD call: Continued on next page
240
© 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
WRITE: ’System-ID: ’ , output-RFCSI_EXPORT-RFCSYSID. New-line. WRITE: ’Host: ’ , output-RFCSI_EXPORT-RFCDBHOST. New-line. WRITE: ’Operating System: ’ , output-RFCSI_EXPORT-RFCOPSYS. New-line. WRITE: ’Database: ’ , output-RFCSI_EXPORT-RFCDBSYS. k)
Check and activate the program.
l)
Start the program for testing by choosing the icon labeled Direct Processing (F8). As an extract of the remote system data ascertained, the report returns the system-ID, host name, operating system, and database.
m)
The following is an example report for comparison purposes. The logical port is called ZSYST. The prefix of the client proxy is ZREF_. REPORT Z_WEBSERVICE_SYSTEMINFO. DATA: XXXXXXXX TYPE REF TO ZREF_CO_Z_WS1_SYSTEMINFO . TRY. CREATE OBJECT XXXXXXXX EXPORTING LOGICAL_PORT_NAME = ’ZSYST’ . CATCH CX_AI_SYSTEM_FAULT . ENDTRY. Data: OUTPUT type ZSYST_RFC_SYSTEM_INFO_RESPONSE . Data: INPUT type ZSYST_RFC_SYSTEM_INFO . TRY. CALL METHOD XXXXXXXX->RFC_SYSTEM_INFO EXPORTING INPUT = input IMPORTING OUTPUT = output . WRITE: ’System-ID: ’ , output-RFCSI_EXPORT-RFCSYSID. New-line. WRITE: ’Host: ’ , output-RFCSI_EXPORT-RFCDBHOST. New-line. WRITE: ’Operating System: ’ , output-RFCSI_EXPORT-RFCOPSYS. New-line. WRITE: ’Database: ’ , output-RFCSI_EXPORT-RFCDBSYS. CATCH CX_AI_SYSTEM_FAULT . CATCH CX_AI_APPLICATION_FAULT . Continued on next page
2005/Q4
© 2005 SAP AG. All rights reserved.
241
Unit 5: The SAP Web Application Server as the Application Platform of SAP NetWeaver.
SAPNW
ENDTRY.
242
Š 2005 SAP AG. All rights reserved.
2005/Q4
SAPNW
Lesson: SAP Web Application Server 6.40 - Web Services and Web Dynpro
Lesson Summary You should now be able to:
2005/Q4
·
Explain what Web services are and how the interaction between the Web service provider and the requester takes place
·
Create a Web service based on an RFC-compliant function module
·
Include a Web service in a program
·
Explain the basic principles of Web Dynpro
© 2005 SAP AG. All rights reserved.
243
Unit Summary
SAPNW
Unit Summary You should now be able to: ·
Explain what Java components there are
·
explain how the Java development and runtime environment is integrated into the SAP Web Application Server
·
Explain what Web services are and how the interaction between the Web service provider and the requester takes place
·
Create a Web service based on an RFC-compliant function module
·
Include a Web service in a program
·
Explain the basic principles of Web Dynpro
244
Š 2005 SAP AG. All rights reserved.
2005/Q4