how to debug xi applications - sap

33
How-to Guide How To… How To… Debug XI Applications Version 1.00 – September 2004 Applicable Releases: Exchange Infrastructure 2.0 Exchange Infrastructure 3.0

Upload: others

Post on 09-Feb-2022

30 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How To Debug XI Applications - SAP

How-to Guide

How To…How To… Debug XI Applications Version 1.00 – September 2004 Applicable Releases: Exchange Infrastructure 2.0 Exchange Infrastructure 3.0

Page 2: How To Debug XI Applications - SAP

© Copyright 2004 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, 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. 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 the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. These materials are provided “as is” 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 not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result 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 these materials. 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. SAP NetWeaver “How-to” Guides are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using SAP NetWeaver. Should you wish to receive additional information, clarification or support, please refer to SAP Consulting. Any software coding and/or code lines / strings (“Code”) included in this documentation are only examples and are not intended to be used 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 errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.

Page 3: How To Debug XI Applications - SAP

1 Scenario............................................................................................................1 2 Introduction: Graphical overview..........................................................................1 3 The Step By Step Solution.....................................................................................2

3.1 Prerequisites .........................................................................................2 3.2 Debugging of synchronous interfaces...................................3 3.3 Debugging of asynchronous interfaces ................................8 3.4 Testing Proxies ...................................................................................15 3.5 Tracing proxy calls...........................................................................21 3.6 Recording proxy calls ....................................................................24

3.6.1 Client side recording ............................................................................24 3.6.2 Server side recording ...........................................................................26

Page 4: How To Debug XI Applications - SAP

1 Scenario

In XI it is sometimes necessary to debug an application which is connected to the XI via proxy framework to analyze problems within the receiving application.

2 Introduction: Graphical overview

XI Scenario:

WebService Scenario:

Sender Business System

Application

Proxy Runtime

WebService Runtime

Receiver Business System

Application

Proxy Runtime

WebService Runtime HTTP

SOAP

Sender Business System

Application

Proxy Runtime

Local Integration

Engine

XI System

Central Integration

Engine

Receiver Business System

Application

Proxy Runtime

Local Integration

Engine

- 1 -

Page 5: How To Debug XI Applications - SAP

3 The Step By Step Solution

3.1 Prerequisites To debug the receiving application the following prerequisites are necessary:

- the name of the receiving proxy (ABAP OO class) has to be known. You can find the name of the proxy class in transaction SPROXY:

- 2 -

Page 6: How To Debug XI Applications - SAP

3.2 Debugging of synchronous interfaces To debug a synchronous inbound interface you have to set an external breakpoint in the receiving inbound method <class name>-><interfacename>~execute_synchronous(..) Note that you have to switch on the debugging or set the breakpoint for the user which is used to send the message to the receiving system. You can find this information: For the XI runtime:

- in the XI directory in the channel for the receiving business system For the WebService runtime:

- in the URL or - in the logical port on client side

To activate the debugging do the following: Log on with the user that is used to send the message to the application server where the message is sent to Open the proxy class in SE24:

- 3 -

Page 7: How To Debug XI Applications - SAP

Choose Utilities Settings in the menu and activate the HTTP debugging for the user you want to use for debugging in ABAP Editor HTTP Debugging:

Set the breakpoint via menu Utilities Breakpoints Set/Delete Choose ‘HTTP breakpoint’ in the popup:

When you send the message the debugger will stop at the breakpoint you have set.

- 4 -

Page 8: How To Debug XI Applications - SAP

Another possibility to activate the HTTP debugging is to activate the debugging for a specific user in transaction SICF. Select the path /sap/xi/engine:

Choose via the menu: Edit Debugging Activate debugging. In the popup you can set the user for debugging (needs to be the sending user):

- 5 -

Page 9: How To Debug XI Applications - SAP

When you send the message the debugger will stop in the method IF_HTTP_EXTENSION~HANDLE_REQUEST of class CL_XMS_HTTP_HANDLER.

You can now set a breakpoint for your proxy class via menu: Breakpoints Breakpoints at Method. Choose the proxy class and method you are sending the message to.

F8 will bring you to your proxy class.

- 6 -

Page 10: How To Debug XI Applications - SAP

You can analyze the proxy data type using parameter INPUT.

Please note: You need to have an open session (gui window) in the system/client at the moment the call receives the system!

- 7 -

Page 11: How To Debug XI Applications - SAP

3.3 Debugging of asynchronous interfaces To debug an asynchronous inbound interface you have to deregister the qRFC Inbound queue in the receiving system. Normally the queues are processed from the Inbound scheduler. The deregistration will keep the inbound messages in the queue so that you can debug them. Please note: The deregistration will stop all messages in this queue. This means no message from other users/interfaces is processed anymore. Keep this in mind. Register the queue again when you have finished the debugging. To activate the debugging do the following: Find the queue name for your inbound message. For this check your receiving messages in transaction SXMB_MONI and check the column Queue-ID:

- 8 -

Page 12: How To Debug XI Applications - SAP

If you can restart a message in error you can deregister the queue with exactly this name. This would be the better way as it does not stop the processing in all inbound queues. Start transaction SMQR and select the button ‘Deregistration’ Enter the name of the queue you found in the last step:

If you have to send a new message you have to deregister a generic queue name as the name is given by the XI in runtime and you do not know it in advance. Then you have to deregister the queue name XBTR* for EO messages or XBQR* for EOIO messages:

- 9 -

Page 13: How To Debug XI Applications - SAP

If the queue is deregistered you see the Type U (unregistered) in the QIN Scheduler monitor:

Now restart or resend the message. This message will stop in the unregistered queue. Start transaction SMQ2 and select your specific queue or start transaction SXMB_MONI and select your message you can jump into the queue by clicking on the queue name in column Queue-ID.

By double clicking the queue name you jump into the detailed view for this queue:

- 10 -

Page 14: How To Debug XI Applications - SAP

Another double clicking on the queue name will show you all entries in this specific queue. The entry on top is the one you can debug. Select the entry and press the very right button or F8:

- 11 -

Page 15: How To Debug XI Applications - SAP

The debugger will come up and stop in the XI runtime. Once press F5 (otherwise the breakpoints may not work):

You can now set a breakpoint for your proxy class via menu: Breakpoints Breakpoints at Method. Choose the proxy class and method you are sending the message to.

F8 will bring you to your proxy class.

- 12 -

Page 16: How To Debug XI Applications - SAP

You can analyze the proxy data type using parameter INPUT.

After you have finished debugging please don’t forget to register the queue again! Start transaction SMQR and select the deregistered queue:

- 13 -

Page 17: How To Debug XI Applications - SAP

Press the button ‘Registration’ to register the queue. In the popup press Continue. Afterwards the queue should be visible with type R again:

- 14 -

Page 18: How To Debug XI Applications - SAP

3.4 Testing Proxies Active proxies can be tested in transaction SPROXY. Display the interface and press F8:

In the popup set the flag for xml to paste in your payload:

- 15 -

Page 19: How To Debug XI Applications - SAP

In the next window you can change the generated payload. You may use the payload of another message in SXMB_MONI. Download the payload in SXMB_MONI and upload it here. In the screen there are two possibilities for uploading files: 1. Upload the file unchanged: the payload is loaded in binary mode, so you can process exactly the same payload as in the already processed message in SXMB_MONI:

- 16 -

Page 20: How To Debug XI Applications - SAP

No further changes can be done to the payload from the editor anymore:

- 17 -

Page 21: How To Debug XI Applications - SAP

2. Upload the file: the payload is loaded in ASCII mode, so special characters may not be loaded correctly:

- 18 -

Page 22: How To Debug XI Applications - SAP

In the editor you can change the payload before processing:

- 19 -

Page 23: How To Debug XI Applications - SAP

Press F8 to execute the call. In the results window you can check if the call could be processed without error:

- 20 -

Page 24: How To Debug XI Applications - SAP

3.5 Tracing proxy calls In transaction SICF you can trace your HTTP call to the receiving business system. Change to the application server where you sent the messages to via transaction SM51 by double clicking the correct application server:

Select the path to the xi engine and select Edit Trace Activate Trace via the menu:

- 21 -

Page 25: How To Debug XI Applications - SAP

In the popup select Client-specific and enter the name of the user that is used to send the message. Select the trace level 2 or 3 and press the ‘Activate’ Button:

After you sent your message deactivate the trace via the menu Edit Trace Deactivate Trace. You will get a popup to select the user to deactivate the trace for. Select the correct user and press ‘Deactivate’:

- 22 -

Page 26: How To Debug XI Applications - SAP

You can check the trace via the menu Edit Trace Display Trace. Enter the user you activated the trace for:

Now you can check the user trace:

- 23 -

Page 27: How To Debug XI Applications - SAP

3.6 Recording proxy calls In transaction SICF you can record your HTTP call from and to the receiving business system.

3.6.1 Client side recording

If you want to record the call leaving the business system (outbound Proxy) you have to use client side recording. Call Transaction SICF and select Client Recording Activate Recording via the menu:

In the popup press the ‘Activate’ Button:

After you sent your message deactivate the trace via the menu Client Recording Deactivate Recording. You will get a popup to select the user to deactivate the recording for. Select the correct user and press ‘Deactivate’:

- 24 -

Page 28: How To Debug XI Applications - SAP

You can check the trace via the menu Client Recording Display Recording. Enter the user you activated the recording for:

Now you will get to the server side recording screen and you have to press the button Client Requests:

Now you can select the request and response of your call:

- 25 -

Page 29: How To Debug XI Applications - SAP

3.6.2 Server side recording

Change to the application server where you sent the messages to via transaction SM51 by double clicking the correct application server:

- 26 -

Page 30: How To Debug XI Applications - SAP

Call Transaction SICF, select the path to the xi engine and select Edit Recorder Activate Recording via the menu:

In the popup select Client-specific and enter the name of the user that is used to send the message. Press the ‘Activate’ Button:

- 27 -

Page 31: How To Debug XI Applications - SAP

After you sent your message deactivate the trace via the menu Edit Recorder Deactivate Recording. You will get a popup to select the user to deactivate the recording for. Select the correct user and press ‘Deactivate’:

You can check the trace via the menu Edit Recorder Display Recorded HTTP Requests. Enter the user you activated the recording for:

- 28 -

Page 32: How To Debug XI Applications - SAP

- 29 -

Now you can check the recorded HTTP requests and responses:

Page 33: How To Debug XI Applications - SAP

www.sdn.sap.com/irj/sdn/howtoguides