sap tech ed06 asug wf

42
Developing Cross- System Workflow Applications with Wf- XML

Upload: keith-swenson

Post on 21-Nov-2014

1.064 views

Category:

Technology


5 download

DESCRIPTION

Presentation from Edwin Mukusha about his use of Wf-XML to connect two SAP systems

TRANSCRIPT

Page 1: Sap Tech Ed06 Asug Wf

Developing Cross-System Workflow Applications with Wf-XML

Page 2: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 2

Speaker Information

Daniel J RempeSystems Analyst, University of Nebraska

Edwin MukushaBusiness Technologies Lead, University of Nebraska

Page 3: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 3

Learning Objectives

As a result of this workshop, you will be able to: Understand the concept and syntax of Wf-XML

Learn the essential steps to setup the Workflow environment for web activities

Develop workflows that accomplish tasks across related systems

Page 4: Sap Tech Ed06 Asug Wf

Server Configuration

Workflow Setup

Wf-XML At Run Time

Wf-XML Document Overview

Communicating With Non-SAP Systems

Page 5: Sap Tech Ed06 Asug Wf

Server Configuration

Workflow Setup

Wf-XML At Run Time

Wf-XML Document Overview

Communicating With Non-SAP Systems

Page 6: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 6

Creating a Service Alias in transaction SICF

Open path default_host/sap/bc

Right click on workflow_xml and choose “New Sub-Element”

Enter the name of your alias

Click the radio button “Reference to an existing service”

Page 7: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 7

Setting Service Parameters (1)

Enter a description in the provided space

Enter a userid and password for handling incoming requests

Modify security settings as necessary

Page 8: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 8

Setting Service Parameters (2)

Find the path to the workflow_xml node as before and click on it

Press the save button

Page 9: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 9

Activating alias link in SICF

Right click on your new alias and choose “Activate Link”

Page 10: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 10

Determining HTTP Port Number and Host Name

Open transaction SMICM

Use the menu path Goto->Parameters->Display

Find the parameter icm/server_port_x containing the port number for the HTTP protocol

Find the parameter icm/host_name_full to determine the server’s host name

Page 11: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 11

Setting handler for workflows in SWR_WEBSERVER

Enter your hostname and port as a URL in the web server address box

Enter the path to your SICF service, which should be SAP/BC/ WORKFLOW_XML/Alias Name/?

Test the URL by pressing the button next to the URL at the bottom

Page 12: Sap Tech Ed06 Asug Wf

Server Configuration

Workflow Setup

Wf-XML At Run Time

Wf-XML Document Overview

Communicating With Non-SAP Systems

Page 13: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 13

Container interface for remote workflow

You will need to be familiar with the container elements in the workflow you are calling

Page 14: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 14

Remote workflow template

The remote workflow in this example will wait ten seconds before changing the value of a return element

It is necessary that some processing time occur for the document interchange to be successful

Page 15: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 15

Container interface for reference workflow

The reference workflow is a template in the calling system that refers to the remote workflow

Elements which need to be exchanged with the remote workflow must share the same definition in the reference workflow

Page 16: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 16

Reference Workflow Template

It is not necessary that the reference workflow contain any steps

Any steps included in the reference template will not actually be run on the calling system

Page 17: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 17

Creating the Calling Workflow

Page 18: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 18

Creating a Web Activity

The web activity contains a URL that calls a workflow on another system

Transfer Format indicates the specification used to exchange information between systems

“Wait For Feedback”, when checked, will cause the calling workflow to wait until the remote workflow finishes before it completes

Page 19: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 19

Using the URL Wizard

The URL wizard generates a URL for calling the remote system based on the information you enter

Page 20: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 20

Adding an alias to the URL

The wizard will not add your alias name from SICF to the generated URL. For instance, in this link:

HTTP://uncsuns.nebraska.edu:8199/SAP/BC/WORKFLOW_XML/?~localkey=WS91000004

The alias needs to be added in this manner: HTTP://.....WORKFLOW_XML/WF_XML_ALIAS/?~localkey.....

Page 21: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 21

Adding the Reference Workflow

Add the reference workflow created earlier in the provided space Binding elements to the reference workflow is done on the Call tab

Page 22: Sap Tech Ed06 Asug Wf

Server Configuration

Workflow Setup

Wf-XML At Run Time

Wf-XML Document Overview

Communicating With Non-SAP Systems

Page 23: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 23

Viewing progress in the Workflow Log

The remote workflow’s overall progress will be shown if the Wait For Feedback box was checked on the calling system

Specific steps within the remote workflow are not shown

Page 24: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 24

Viewing XML files with transaction SWXML

Transaction SWXML provides a report of Wf-XML documents sent or received by the system

The report organizes groups of documents by Work Item ID

Page 25: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 25

Wf-XML documents are stored using the SAP Business Document Service OAOR does not allow selection by date/time as SWXML does

View documents in transaction OAOR (BDS)

Page 26: Sap Tech Ed06 Asug Wf

Server Configuration

Workflow Setup

Wf-XML At Run Time

Wf-XML Document Overview

Communicating With Non-SAP Systems

Page 27: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 27

Wf-XML is a standard published by the Workflow Management Coalition to enable interoperability between systems that use Workflow

This presentation uses version 1.1 of the Wf-XML standard. The full specification of this standard can be downloaded at:

http://www.wfmc.org/standards/docs/Wf-XML-11.pdf The Wf-XML version is specified while creating the Web Activity step in the Workflow Builder

Wf-XML Specification

Page 28: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 28

This process shows a two-way communication process between systems A Request is made by the initiating system, which is immediately acknowledged by a

Response from the receiving system The receiving system sends its own Request upon completing its task, which is

acknowledged by a Response from the initiator

System Interaction

Source: http://www.wfmc.org/standards/docs/Wf-XML-11.pdf

Page 29: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 29

A CreateProcessInstance interchange is initiated when instructing a remote system to perform a particular workflow task

A ProcessInstanceStateChanged interchange is done whenever the state of the remote workflow changes (for example, when it is complete)

System Interaction (2)

Source: http://www.wfmc.org/standards/docs/Wf-XML-11.pdf

Page 30: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 30

This is a CreateProcessInstance.Request document. It was automatically generated by the Workflow system in the previous example

CreateProcessInstance - Request

Page 31: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 31

This is a CreateProcessInstance.Response document. It is returned immediately from the called system in acknowledgement of the Request document

CreateProcessInstance - Response

The MIME type of the returned document MUST BE text/xml. Any other type will cause the originating workflow to end in error

Page 32: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 32

ProcessInstanceStateChanged

Page 33: Sap Tech Ed06 Asug Wf

Server Configuration

Workflow Setup

Wf-XML At Run Time

Wf-XML Document Overview

Communicating With Non-SAP Systems

Page 34: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 34

In this example, an Apache web server runs a Perl script at a given URL which responds with a Wf-XML document

Interfacing With Foreign Systems

#!c:/perl/bin/Perl.exe

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); print "Content-type: text/xml\n\n";

print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n"; print " <WfMessage xmlns=\"http://www.wmfc.org/standards/docs/Wf-XML\" Version=\"1.1\">\n"; print " <WfMessageHeader>\n"; print " <Response />\n"; print " <Key>Apache Transaction - Free Text 1</Key>\n"; print " </WfMessageHeader>\n"; print " <WfMessageBody>\n"; print " <CreateProcessInstance.Response>\n"; print " <ProcessInstanceKey>Apache Transaction - Free Text 2</ProcessInstanceKey>\n"; print " <ContextData>\n"; print " <Name>Date</Name><Value>$mon/$mday/$year</Value>\n"; print " <Name>Time</Name><Value>$hour:$min:$sec</Value>\n"; print " <Return>\n"; print " <Success />\n"; print " <Message>\n"; print " <Number>ZH999</Number>\n"; print " <Text>&amp; &amp; &amp; &amp;</Text>\n"; print " <V1>The method was executed successfully</V1>\n"; print " </Message>\n"; print " </Return>\n";

Page 35: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 35

Here, a Lotus Notes server runs an agent which attempts to create a calendar entry document before returning a Wf-XML document The document returned is dependent upon whether the agent was able to accomplish its task

Interfacing With Foreign Systems (2)

public class JavaAgent extends AgentBase { public void NotesMain() {

try { ... creating calendar entry in Notes printXMLDocument(notes_doc.getUniversalID());

} catch(NotesException e) { createErrorDocument(e.text, 1); }}

Page 36: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 36

Interfacing With Foreign Systems (3)

private void createErrorDocument(String msg, int type) { try { notes_doc = sapleave_db.createDocument(); notes_doc.replaceItemValue("Form", "Incoming"); notes_doc.replaceItemValue("Error", new Integer(type)); notes_doc.save();

printXMLDocument(notes_doc.getUniversalID()); } catch (NotesException ex) { ex.printStackTrace(); } }private void printXMLDocument(String id) { try { pw.println("Content-type: text/xml"); pw.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"); pw.println("<WfMessage xmlns=\"http://www.wmfc.org/standards/docs/Wf-XML\" Version=\"1.1\">"); pw.println("<WfMessageBody>"); …. Context Data of Response Document pw.println("</WfMessageBody>"); pw.println("</WfMessage>"); } catch (Exception ex) { ex.printStackTrace(); } }

Page 37: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 37

Summary

Wf-XML enables systems to communicate and manage wokflow tasks using a standard XML-based syntax

SAP’s Workflow Builder automatically handles the specifics of Wf-XML interaction using the Workflow Container and the Business Document Service

The SAP Workflow runtime environment provides interfaces for administration and troubleshooting of remote workflow tasks

Non-SAP systems can easily communicate with R/3 systems using the same document structure

Page 38: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 38

Transaction Reference

SICF – HTTP Service Hierarchy Maintenance (setup of workflow_xml node)

SWR_WEBSERVER – Setup of web server callback URL

SWXML – Selection Report for XML Documents

OAOR – Business Document Navigator

Page 39: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 39

Further Information

Public Web:http://www.wfmc.org – Workflow Management Coalition

www.sdn.sap.com - SAP Developers‘ Network

Related Workshops/Lectures at SAP TechEd ’05EPI104 – Interoperability SAP NetWeaver–IBM WebSphere, Lotus, and Tivoli

EPI200 - ASUG Workflow/Webflow SIG Community: Tips, Tricks and Information Sharing Session

Americas’ SAP Users’ Group (ASUG)www.asug.com

Page 40: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 40

THANK YOU FOR YOUR

ATTENTION !

QUESTIONS – SUGGESTIONS – DISCUSSION

Page 41: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 41

Please complete your session evaluation.

Be courteous — deposit your trash, and do not take the handouts for the following session.

Feedback

Thank You !

Page 42: Sap Tech Ed06 Asug Wf

SAP AG 2006, SAP TechEd ’06 / EPI301/ 42

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, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation 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, Massachusetts Institute 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 by Netscape. 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. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG.

This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP® product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice.

SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.

SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence.

The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.

Copyright 2006 SAP AG. All Rights Reserved