Work with Character Encodings in

Similar documents
Download and Install Crystal Reports for Eclipse via the Eclipse Software Update Manager

How To Configure MDM to Work with Oracle ASM-Based Products

Configuring Distribution List in Compliant User Provisioning

prioritize XI messages on integration server

How to Set Up an Authorization for a Business Partner in Customer Relationship Management (CRM) Internet Sales: Sample Case

Extract Archived Data from SAP ERP

3 rd party Service Desk interface

Posting Messages into XI

Backup & Restore with SAP BPC (MS SQL 2005)

Analyzing Sales Data for Choosing Forecast Strategies

Developing Applications for Integration between PI and SAP ERP in Different Network Domains or Landscapes

Implementing Outlook Integration for SAP Business One

Methodology to Implement SAP Process Integration

Utilities for downloading and uploading OO ABAP classes in XML format

E-Recruiting Job Board Integration using XI

SAP GRC Access Control: Background jobs for risk analysis and remediation (formerly Virsa Compliance Calibrator)

CREATING A PURCHASE ORDER STORE RECORD WEB SERVICE

Ronald Bueck SBO Product Definition

Performance Best Practices Guide for SAP NetWeaver Portal 7.3

How to Configure and Trouble Shoot Notification for Process Control 2.5

How to configure BusinessObjects Enterprise with Citrix Presentation Server 4.0

Problems with your Data Model in SAP NetWeaver MDM Do s and Don ts

Roster Configuration (Payroll) in SAP ECC 6.0 Tips & Tricks

How To Balance In Sap Bw

Integrate Third Party Collaboration Tools in the SAP NetWeaver Portal. SAP NetWeaver Product Management

How To... Call BEx Web Applications from SAP BusinessObjects Dashboards (Xcelsius) and vice versa

How to Create Web Dynpro-Based iviews. Based on SAP NetWeaver 04 Stack 09. Jochen Guertler

Budget Control by Cost Center

Sales Rush Sales Order Processing S01- Lean Baseline Package. SAP Lean Baseline Package Version: V1.500 Country: UK Language: EN Date: February 2006

SAP NetWeaver MDM 5.5 SP3 SAP Portal iviews Installation & Configuration. Ron Hendrickx SAP NetWeaver RIG Americas Foundation Team

ARCHIVING OF IDOCS IN SAP

How To... Integrate Custom Formulas into the Formula Builder

Enabling Full-Text Search for Business Objects in mysap ERP

SAP Master Data Governance- Hiding fields in the change request User Interface

How to Configure Access Control for Exchange using PowerShell Cmdlets A Step-by-Step guide

Business One in Action - How can we post bank fees and charges while posting Incoming or Outgoing Payment transactions?

Workflow extended notifications

SAP Sales and Operations Planning Software Product (xsop)

USDL XG WP3 SAP use case. Kay Kadner

Using SAP Logon Tickets for Single Sign on to Microsoft based web applications

Siteco Relies on SDN for its SAP CRM 5.0 Upgrade

Work with XI 3.0 Java Proxies

User Experience in Custom Apps

Global Transport Label - General Motors -

Integration of SAP central user administration with Microsoft Active Directory

Sending Additional Files from SAP Netweaver PI to third Party System

Monitoring and Management of Landscapes with SAP NetWeaver Administrator. Dieter Krieger, SAP AG

Maintaining Different Addresses and Ids for a Business Partner via CRM Web UI

Alert Notification in SAP Supply Network Collaboration. SNC Extension Guide

mysap ERP Talent Management Dr. Christian Acosta-Flamma

TM111. ERP Integration for Order Management (Shipper Specific) COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

Integrating Easy Document Management System in SAP DMS

SAP CCMS Monitors Microsoft Windows Eventlog

Collaboration Technology Support Center - Microsoft - Collaboration Brief

OData in a Nutshell. August 2011 INTERNAL

SAPFIN. Overview of SAP ERP Financials COURSE OUTLINE. Course Version: 15 Course Duration: 2 Day(s)

Enterprise Software - Applications, Technologies and Programming

Debugging Portal Applications

R/3 and J2EE Setup for Digital Signature on Form 16 in HR Systems

Understanding HR Schema and PCR with an Example

HR400 SAP ERP HCM Payroll Configuration

Third Party Digital Asset Management Integration

Accounts Receivable. SAP Best Practices

Process Archiving using NetWeaver Business Process Management

AC200. Basics of Customizing for Financial Accounting: General Ledger, Accounts Receivable, Accounts Payable COURSE OUTLINE

Table of Contents. How to Find Database Index usage per ABAP Report and Creating an Index

Intelligent Business Operations Chapter 1: Overview & Strategy

Data Archiving in CRM: a Brief Overview

How to Schedule Report Execution and Mailing

BC407 Reporting: QuickViewer, InfoSet Query and SAP Query

NetWeaver Business Client (NWBC) for Incentives and Commissions Management (ICM)

SAP Central Process Scheduling (CPS) 8.0 by Redwood

Consume an External Web Service in a Nutshell with good old ABAP

SOP through Long Term Planning Transfer to LIS/PIS/Capacity. SAP Best Practices

SAP Business ByDesign Reference Systems. Scenario Outline. SAP ERP Integration Scenarios

Set http- Header Parameters using the Axis Framework

Log Analysis Tool for SAP NetWeaver AS Java

DBA Cockpit for Oracle

UI Framework Simple Search in CRM WebClient based on NetWeaver Enterprise Search (ABAP) SAP Enhancement Package 1 for SAP CRM 7.0

Ariba Network Integration to SAP ECC

How To... configure and execute Business Process Flows in SAP BusinessObjects Planning and Consolidation 7.5 version for SAP NetWeaver

Compliant, Business-Driven Identity Management using. SAP NetWeaver Identity Management and SBOP Access Control. February 2010

UI Framework Logo exchange without skin copy. SAP Enhancement Package 1 for SAP CRM 7.0

RUN BETTER Become a Best-Run Business with Remote Support Platform for SAP Business One

SAP NetWeaver BRM 7.3

BW Workspaces Use Cases

UI Framework Task Based User Interface. SAP Enhancement Package 1 for SAP CRM 7.0

FSC130 SAP Bank Communication Management

Learning Series: SAP NetWeaver Process Orchestration, secure connectivity add-on 1c SFTP Adapter

Business Requirements... 3 Analytics... 3 Typical Use Cases... 8 Related Content... 9 Copyright... 10

How to Create a Support Message in SAP Service Marketplace

DATA ARCHIVING IN SAP R/3 ENTERPRISE. Georg Fischer PM Data Archiving SAP AG

Integration of Universal Worklist into Microsoft Office SharePoint

Data Source Enhancement Using User Exit

SAP Service Tools for Performance Analysis

Portfolio and Project Management 5.0: Excel Integration for Financial and Capacity Planning

Learning Series: SAP NetWeaver Process Orchestration, business to business add-on EDI Separator Adapter

BC450 ABAP Performance: Analysis and Optimization

Integration of SAP Netweaver User Management with LDAP

Transcription:

How-to Guide SAP NetWeaver 7.0 How To Work with Character Encodings in Process Integration Version 1.10 October 2007 Applicable Releases: SAP NetWeaver 2004 Exchange Infrastructure 3.0 SAP Netweaver 7.0 Process Integration Enabling Application-to-Application Processes

Copyright 2007 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, 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.

1 Scenario...1 2 Introduction...1 3 Adapter-Specific Settings...3 3.1 File/FTP Adapter...3 3.2 SOAP Adapter...3 3.3 Mail Adapter...4 4 Using Adapter Modules...5 4.1 MessageTransformBean...5 4.2 TextCodepageConversionBean...5 4.3 XmlAnonymizerBean...5 5 Other Techniques for Influencing the Codepage...7 5.1 XSLT Mapping...7 5.2 Java Mapping...7 6 Related Issues...9 6.1 Content-Transfer Encoding...9 6.2 Escape Sequences...9

1 Scenario You want to connect systems which have different codepages (character sets). 2 Introduction Each XI system is based on Unicode and these messages are usually XML-based. When connecting XI with other systems it might first be necessary to convert the XI message into other codepages like Latin, Hebrew, Chinese, Japanese, Arabic and so on. However messages can also be converted from XML to plain text format, or they can be either zipped or encoded. It is therefore important to know how the transformation from the Unicode to another codepage is to be done. Each codepage has an identifier, for example ISO-8859-1 is West European Latin, and GB18030 is a standard for Chinese characters. For each language there are several codepages available which are not always compatible, therefore you must check which codepage is used for each system. Unicode is a standard which contains almost every character that exists in the world s languages. Unicode can be represented, among others, by the double-byte variablelength character encoding UTF-16 or the single-byte variable-length character encoding UTF-8 in which a character can consist of just 1 byte and up to 4 bytes. XI messages use UTF-8 as standard character encoding and all adapters can convert the codepage of the sender to UTF-8 as well as UTF-8 to the codepage of the receiver. UTF-8 and all ISO-8859 codepages are based on ASCII. Therefore they are compatible when only printable characters from ASCII are used. Other characters like European ä, ê, ñ, š and letters from other alphabets are represented differently or are only available in specific codepages. These characters cause errors in interpreting XML messages if the wrong codepage is used. Some adapters get the information about the codepage from the sender or receiver system and do the transformation automatically whilst other adapters need this information in the configuration. The transformation between codepages is carried out by operating system routines. If you want to work with different codepages then you have to make sure that the codepages are implemented in the operating system where XI or the adapter framework is installed. There are two places where the codepage of a message has to be declared: The codepage for a text message is taken from the HTTP header Content-Type with the attribute charset. For example: Content-Type = text/plain; charset= UTF-8 The codepage for an XML message is taken from the attribute encoding of the XML declaration. For example: <?xml version="1.0" encoding="utf-8"?> If the declaration of the codepage is missing then a default value is used which depends on the MIME type. The default for text documents is ASCII, for application/xml it is UTF- - 1 -

8. There must not be a mismatch between the above-mentioned declarations in an XML message. Here is an example taken from the XI message monitor: A message with two payloads is displayed. Left is the payload name and in parenthesis the content-type. The main payload with the name MainDocument is an XML document, the attachment with the name Attachment is a text document with codepage latin-1. - 2 -

3 Adapter-Specific Settings This chapter covers typical use cases. It should help you to understand how XI generally uses codepage declarations and it gives some hints if your scenario is not listed here. 3.1 File/FTP Adapter In the sender file adapter it is necessary to apply the codepage for any text document. If you want to send several documents with the same message then you have to apply the codepage for each text document individually. Here is an example configuration for a file sender with a configuration that enables an additional file. Both files are of type plain text and the encoding is latin-1. All text documents are converted into UTF-8. If you want to leave the text documents in their original codepage, declare the documents as binary. If you have binary files such as zip archives, declare them as binary, too. In the receiver file adapter you can apply the codepage to which the documents are converted. This is only useful if you convert the content to a text or CSV file. If you want to change the codepage for XML you have to be aware that the codepage in the file receiver channel setting does not influence the XML declaration. Use the adapter module XmlAnonymizerBean instead (refer to chapter 4.3) or use your own XSLT or Java mapping program. More information: SAP Note 821267: FAQ: XI 3.0 / PI 7.0 File Adapter 3.2 SOAP Adapter The sender SOAP adapter takes the codepage information of the incoming message from the XML declaration and the content type, which must be consistent. The encoding of the response message is per default UTF-8. If you want the response sent in another codepage then you have to add the attribute xmlenc to the query string of the SOAP adapter URL, for example: - 3 -

http://host:port/xisoapadapter/messageservlet?channel=p:s:c&xmlen c=iso-8859-1 In the receiver SOAP adapter the default codepage is UTF-8. If you want to change this, add the parameter XMBWS.XMLEncoding in the module configuration for the SOAP adapter module. More information: SAP Note 856597 - FAQ: XI 3.0 SOAP Adapter 3.3 Mail Adapter The sender mail adapter takes the codepage information for the e-mail message from the HTTP header field content-type. In some e-mail messages the codepage is not provided, for example the content-type might be an application/octet-stream. If codepage information is not available then you can use the module MessageTransformBean to provide the correct content-type. More information: Chapter 4.1 In the receiver mail adapter you have the option to use the mail package. In this case you have to provide an XML structure. A description is provided in SAP Note 748024. Below is an example of a mail package (not all possible elements are used here): <ns:mail xmlns:ns="http://sap.com/xi/xi/mail/30"> <Subject>Hello</Subject> <From>sender@sender.com</From> <To>receiver@receiver.com</To> <Content_Type>text/plain;charset="UTF-8"</Content_Type> <Content>This is a mail</content> </ns:mail> Do not put the codepage to the attribute encoding. This attribute is used for transfer-encoding and only the values base64 and quoted-printable are allowed. More information: Chapter 6.1-4 -

When you do not use the mail package you should use the module MessageTransformBean to set the content-type. The default content-type for a mail without attachments is: application/xml. More information: SAP Note 856599 - FAQ: XI 3.0 Mail Adapter 4 Using Adapter Modules When you enhance the processing of the adapters by using adapter modules you have to be aware that there might be some restrictions concerning the codepage conversion, however you can also use specific modules to influence the behavior of other modules. 4.1 MessageTransformBean Among other functions, this module enables you to set the correct content-type and codepage for a message payload which does not have this information already. This can happen for example in a mail message. Aside from this, this module also performs a codepage conversion when the codepage of the origin is clear. The parameter for this purpose is: Transfer.ContentType = <MIME type/sub type>;charset= <charset> This module does not change the encoding declaration in the html header or xml header of the document. For XML documents use the XmlAnonymizerBean (chapter 4.3) More Information: SAP Note 793922 - XI 3.0 AF Message Transformation Module 4.2 TextCodepageConversionBean In SAP NetWeaver Exchange Infrastructure 3.0 SP18 and SAP NetWeaver Process Integration 7.0 SP09 a module is provided to change the codepage of a message payload. The module only works for text documents; that means the MIME type is text (for example text/plain). The parameter is: Conversion.charset = <charset> This module does not change the encoding declaration in the html header or xml header of the document. For XML documents use the XmlAnonymizerBean (chapter 4.3). More information: SAP Note 960663 - XI 3.0 AF Text Codepage Conversion Module 4.3 XmlAnonymizerBean Starting from SAP NetWeaver Exchange Infrastructure 3.0 SP16 you can use this module to change the encoding of an XML document. The parameter for this purpose is: anonymizer.encoding = <charset> - 5 -

You have to define all namespaces and prefixes of the XML document in the parameter anonymizer.acceptnamespaces to prevent them from being removed. More information: SAP Note 880173 - XI 3.0 Adapter Framework XML Anonymizer Module - 6 -

5 Other Techniques for Influencing the Codepage 5.1 XSLT Mapping You can use the following XSLT Mapping to change the codepage of an XML document. In the example the encoding ISO-8859-1 is used. Change it to the required encoding of the target XML. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" encoding="iso-8859-1"/> <xsl:template match="/"> <xsl:copy-of select="*" /> </xsl:template> </xsl:stylesheet> 5.2 Java Mapping You can use the following Java mapping to change the codepage of a text document. The sample program changes UTF-8 to ISO-8859-1. Change the constants at the beginning of the program according to your needs. package com.sap.encoding.example; import java.io.*; import java.util.*; import com.sap.aii.mapping.api.*; public class UTFISO implements StreamTransformation { private final String latin = "ISO-8859-1"; private final String utf ="UTF-8"; public void execute(inputstream in, OutputStream out) { try { DataInputStream stdin = new DataInputStream(in); int length = getlengthfromstream(stdin); stdin.reset(); byte[] buffer = getbytesfromstream(stdin); String str = new String(buffer, utf); str = str.replaceall(utf, latin); out.write(str.getbytes(latin)); out.close(); catch (IOException e) { - 7 -

public int getlengthfromstream(inputstream is ) throws IOException{ int i = 0; int length = 0; try{ while ((i = is.read())> 0){ length ++; catch (ArrayIndexOutOfBoundsException e) { e.printstacktrace(); return length; public byte[] getbytesfromstream(inputstream is) throws IOException { // Create the byte array to hold the data byte[] bytes = new byte[getlengthfromstream(is)]; is.reset(); // Read in the bytes int offset = 0; int tmp = 0; while (offset < bytes.length && (is.read(bytes, offset, offset + (tmp = is.available()))) > 0) { offset += tmp; // Ensure all the bytes have been read in if (offset < bytes.length) { throw new IOException("Could not completely read Inputstream"); // Close the input stream and return bytes is.close(); return bytes; public void setparameter(map param) { - 8 -

6 Related Issues Besides choosing a codepage for representing a text document correctly, there are other mechanisms for the encoding of a file. These techniques are independent from the codepage and must not be confused. 6.1 Content-Transfer Encoding Content-transfer encoding is a technique for representing files by ASCII characters. This should help to transfer these files between different servers. Two standards are usually used: Quoted-Printable: This is mainly used for non-ascii text files where all non-ascii characters are replaced by an escape sequence. Base64: This is mainly used for binary files where the whole file is represented by a sequence of ASCII characters. The XI sender adapters decode automatically when the appropriate attribute in the HTTP header is set. 6.2 Escape Sequences The escape sequences are necessary to distinguish XML content and control signs such as &, < and >. The escape sequences start with an ampersand (&). For example: & represents & and > represents >. All XI components that convert between text and XML perform the escaping and deescaping of above-mentioned characters. In some cases, an external sender of an XML message does not provide this functionality and therefore a parsing error occurs whenever an ampersand appears in the XML document. The only solution is to use a Java mapping before the actual mapping to perform the escaping. - 9 -

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