suspend & resume plug

15
How to use Web Dynpro Suspend Resume Plugs to integrate with non-Web Dynpro web applications  Ap pl ies t o: Web Dynpro NW7.0 SP6 and above. Note : The code samples will only work with Web Dynpro version NW7.0 SP6 and above with the latest patch of the respective SP applied. The latest patch of all the NW7.0 SPs contains some fixes for this functionality. Summary This article and sample applications demonstrates the usage of Web Dynpro Suspend Resume functionality that comes with SAP NetWeaver 7.0. You will learn how to suspend Web Dynpro Application, go to web application (JSP), and resume the suspended Web Dynpro Application. There are two sample applications, one is Web Dynpro and other is JSP. The Web Dynpro application suspends itself and launches the web application. The web application then resumes the suspended Web Dynpro application. Sample Applications You can download the ready-to-use applications here: Serviceapp Webclient Webclientapp  Au th or : Rohi t J ais wal Company: SAP Labs India  Au th or Bio Rohit Jaiswal works at SAP Labs in the Web Dynpro Development area. His main work is supporting the NW04 and NW7.0 releases for Web Dynpro topics like Session Management and Value Services.

Upload: sumitml8871

Post on 01-Jun-2018

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 1/15

How to use Web Dynpro Suspend Resume Plugs tointegrate with non-Web Dynpro web applications

 Appl ies to:

Web Dynpro NW7.0 SP6 and above.

Note : The code samples will only work with Web Dynpro version NW7.0 SP6 and above with thelatest patch of the respective SP applied. The latest patch of all the NW7.0 SPs contains somefixes for this functionality.

Summary

This article and sample applications demonstrates the usage of Web Dynpro Suspend Resumefunctionality that comes with SAP NetWeaver 7.0.

You will learn how to suspend Web Dynpro Application, go to web application (JSP), and resumethe suspended Web Dynpro Application.

There are two sample applications, one is Web Dynpro and other is JSP. The Web Dynproapplication suspends itself and launches the web application. The web application then resumesthe suspended Web Dynpro application.

Sample Applications

You can download the ready-to-use applications here:

Serviceapp

Webclient

Webclientapp

 Author : Rohi t Jaiswal

Company: SAP Labs India

 Author Bio

Rohit Jaiswal works at SAP Labs in the Web Dynpro Development area. His main work issupporting the NW04 and NW7.0 releases for Web Dynpro topics like Session Management andValue Services.

Page 2: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 2/15

Table of Contents

 Applies to: ...................................................................................................................................1

Summary ....................................................................................................................................1

 Author Bio ...................................................................................................................................1Introduction .................................................................................................................................2

Inspecting Application Properties, Suspend and Resume Plugs...................................................4

Inspecting Web Dynpro Project................................................................................................4

Inspecting Application Properties .............................................................................................5

Inspect Suspend and Resume Plugs in Interface View.............................................................6

Inspecting the View Layout..........................................................................................................8

Inspecting Event Handlers and JSP code ....................................................................................9

Inspect Event Handler Code ....................................................................................................9

Inspect JSP Code..................................................................................................................10Deploying and Running Applications.......................................................................................... 11

Related Content ........................................................................................................................14

Copyright .................................................................................................................................. 15

Copyright .................................................................................................................................. 15

Introduction

The Suspend Resume functionality was implemented mainly for the use case in which theapplications needed to go to another application (not necessarily Web Dynpro) and return back tothe application resuming it, the state of the application is not lost in the sense there will be noneed for initialization, invoking back end queries for data population and so on. Prior to NW04sthere was no way to do it, that is once the application was exited through exit plug the applicationstate is lost and if you need to come back to the application you need to start it again.

In NW04s, there is new type of Outbound Plug called ‘Suspend’ and new type of Inbound Plugcalled ‘Resume’ for the purpose of Suspending and Resuming Web Dynpro applications. TheSuspend and Resume functionality provides way to integrate Web Dynpro with web applicationsof other technologies like JSP, Struts etc.

Page 3: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 3/15

Web Dynpro and JSP Sample Applications.

Figure 1: Application Scenario

1. The Service App is launched through browser.

2. The Service App fires its suspend plug providing link to Client JSP App.

3. The Client JSP invokes the Resume URL (the resume URL is passed as HttpRequestparameter ‘sap-wd-resumeurl’).

Service App

Start Service App

Client JSP App

2 Suspend Plug with Client JSP App URL

3

Resume Plug

Client JSP App invokes Resume URL

Page 4: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 4/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK  | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY  | bpx.sap.com

© 2006 SAP AG 4

Figure 2: Screenshots of applications demonstrating Suspend Resume functionality

Step Screen Shot

Start Service App and enter somedata to persist some state. Click on‘Suspend and Go To WebApp’button

The Client JSP Application islaunched. Observe the Service

 App URL which is passed asHttpRequest parameter ‘sap-wd-resumeurl’

Click on Go To Service Appbutton.

The Service App is invoked andthe state is not lost

Inspecting Application Properties, Suspend and Resume Plugs

Inspecting Web Dynpro Project

Import the Web Dynpro project ‘Service App’ into your NWDS IDE workspace.

Page 5: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 5/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 5

Service App is simple Web Dynpro Project and contains only one Component with default View as

shown in the structure below.

Inspecting Application Properties

Select the application ‘ServiceApp’ and go to the ‘Application Properties’ Tab. Observe the property‘sap.suspendable.application’ application property is set to true. By default all the application are non-suspendable and this property need to be set true to make the application be suspendable

Page 6: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 6/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 6

Inspect Suspend and Resume Plugs in Interface View

Select ServiceAppInterfaceView as shown below

Page 7: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 7/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 7

Inspect the Resume and Suspend plugs which are of types Resume and Suspend type. See that theSuspend Plug has parameter ‘Url’, it is created by default by the NWDS IDE when you create theSuspend Plug. Both the plugs need to be created if you want to use the Suspend Resumefunctionality.

Page 8: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 8/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 8

Inspecting the View Layout

Select the view ServiceCompView and inspect, the Text input field is binded to context attribute ‘Text’of type String.

Page 9: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 9/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 9

Inspect the button is linked to Action ‘SuspendAndGoToWebApp’

Inspecting Event Handlers and JSP code

The next step is to inspect the application logic to suspend and go to Web Application.

Inspect Event Handler Code

The following code blocks comprise the implementation of the action event handler ‘SuspendAndGoToWebApp’ in View Controller ServiceCompView.java of Component ServiceComp.

/ / @@begi n j avadoc: onAct i onSuspendAndGoToWebApp( Server Event )

/ * * Decl ar ed val i dat i ng event handl er . * /

/ / @@end

 public void onAct i onSuspendAndGoToWebApp( com. sap. t c. webdynpr o. progmodel . api . I WDCust omEvent wdEvent )

{

  / / @@begi n onAct i onSuspendAndGoToWebApp(ServerEvent )

  / / t he URL f or Cl i ent Appl i cat i on

  St r i ng cl i ent AppUr l = " / WebCl i ent / WebCl i ent . j sp" ;

/ / Fi r e t he Suspend Pl ug of t he I nt er f aceVi ewCont r ol l erwdThi s. wdGetSer vi ceCompI nt er f aceVi ewCont r ol l er ( ) . wdFi r ePl ugSuspend( cl i ent AppUr l ) ;

  / / @@end

  }

Page 10: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 10/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 10

The above code fires the Suspend Plug passing the URL of Client JSP application.

Inspect JSP Code

Import the WebClient and WebClientApp projects into the NWDS IDE. Open the J2EE Perspective, you willsee the project structure as shown.

Select the WebClient.jsp and inspect the code

<%@ page l anguage="j ava"   %>

<ht ml >

<head>

<t i t l e>

Cl i ent J SP Appl i cat i on

</ t i t l e>

</ head>

<body>

<h1>

Cl i ent J SP Appl i cat i on

Page 11: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 11/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 11

</ h1>

<% St r i ng servi ceAppUr l = r equest . getPar ameter( "sap- wd- r esumeur l " ) ;

%>

<b>Ser vi ce App URL : </ b><%=ser vi ceAppUr l %>

<br >

<i nput t ype=but t on val ue="Go To Servi ce App"oncl i ck="l ocat i on. hr ef =' <%=ser vi ceAppUr l %>' ">

</ f or m>

</ body>

</ html >

The code prints the HttpRequest parameter ‘sap-wd-resumeurl’. On click of action the ResumeURL isinvoked.

Deploying and Running Appl ications

Before starting deploying, your IDE should be configured to SAP J2EE Engine which you want to deploy.

In the Web Dynpro perspective, right click the Service App and select ‘Deploy New Archive And Run ‘ asshown below.

Page 12: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 12/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 12

In the J2EE Perspective, Select the WebClient Web Module, click right mouse button and select ‘Build Web

 Archive’ as shown below

Page 13: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 13/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 13

The WebClient is packaged into WebClientApp. Select WebClientApp, click right mouse button and select‘Build Application Archive’

Page 14: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 14/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 14

Expand the WebClientApp, select WebClientApp.ear click right mouse button and select ‘Deploy to J2EE

Engine’

Now you can run the Web Dynpro application and test the Suspend Resume functionality as described in theIntroduction section.

Related Content

  Note: The Suspend Resume functionality should not be used inside Enterprise Portal environment,this is only applicable for applications which run stand alone. Please refer  Portal Navigation

  The Suspend Resume Plugs are included in New Features in NW04s

Suspend & Resume Plugs on SAP Help Portal

Developing J2EE Applications

Page 15: Suspend & Resume Plug

8/9/2019 Suspend & Resume Plug

http://slidepdf.com/reader/full/suspend-resume-plug 15/15

Fehler! Formatvorlage nicht definiert.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY   | bpx.sap.com

© 2006 SAP AG 15

Copyright

© Copyright 2006 SAP AG. All rights reserved.

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.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.

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, W ebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, OpenPower and PowerPC aretrademarks or registered trademarks of IBM Corporation.

 Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe SystemsIncorporated in the United States and/or other countries.

Oracle is a registered trademark of Oracle Corporation.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.

HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, MassachusettsInstitute of Technology.

Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented byNetscape.

MaxDB is a trademark of MySQL AB, Sweden.

SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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. Allother product and service names mentioned are the trademarks of their respective companies. Data contained in this document servesinformational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP

Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in theexpress warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting anadditional warranty.

These materials are provided “as is” without a warranty of any kind, either express or implied, including but not limited to, the impliedwarranties of merchantability, fitness for a particular purpose, or non-infringement.

SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that mayresult from the use of these materials.

SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within thesematerials. SAP has no control over the information that you may access through the use of hot links contained in these materials anddoes not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages.

 Any software coding and/or code lines/strings (“Code”) included in this documentation are only examples and are not intended to beused in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errorsor damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.