SAP PI/PO, How to validate and add Cipher Suites for SAP NetWeaver Server

A few mothns ago I had to enable some chiper suites for the SAP netweaver server to support the old communication for some web services. In this entry I would like to share with you how I did it.

How to validate supported chipher suites on the server

The must simple way to do it is using the xpi_inspector tool, set target url and execute the analyse to get the report.

When the analyse is stopped the Enabled chiper suits list is showed with the handshake error during the negotiation, the default chiper suites are described in SAP note 2284059 – Update of SSL library within NW Java server:

Seguir leyendo

SAP PO, print log messages during Message Mapping tests

Hi! this is a quick tip, whenever that we used a java UDF into a message mapping it could be possible to print log trace message during the tests using the AbstracTrace object.

This is an example of one function to print a file name using the level info:

public String buildFilename(String filenamePattern, String tableName, String date, String replacementDate, String hour, String replacementHour, Container container) throws StreamTransformationException{

	AbstractTrace trace = container.getTrace();

	String formattedDate = date.replaceAll(REGEX_DATE, replacementDate);
	String formattedHour = hour.replaceAll(REGEX_HOUR, replacementHour);

	String filename = filenamePattern
                .replace("{tableName}", tableName)
                .replace("{date}", formattedDate)
                .replace("{hour}", formattedHour);

	trace.addInfo("Set filename to: "+ filename);

return filename;

When the test is executed the message must be showed into the log, like this:

That’s all, bye!

SAP PI/PO, Configure Dual Authentication for SFTP receiver adapter

In this entry I would like to share how I’ve configured a SFTP receiver adapter with Dual authentication (using Password and a ssh key file), in this case I’ve received the key file from another team (created with puttygen in a file with extension .ppk) and I’m going to convert and import it into the Key Manager of SAP PO.

Let’s get started.

1. Export private key in OpenSSH format, open PuttyGen and choose menu Conversions > Import key and select the ppk file, then go back to Conversions > Export OpenSSH key and save the private key. The output file must be something like this:

-----BEGIN RSA PRIVATE KEY-----
ct0Nd/ZYquo+o3mPaoGuw3kXQ5lEM+Ui3vzSoNfUXmcaLL41mrNqCmp7uTVyhm6i
Yj/7z6jtKWH5r6qh82893muS2O+CNTqrRbTvYpVdCUZ4an8QBOduFYGACcm5SeSC
vd9yNuQV3NXcB99xsZ72uoQsDsa3FbT1EUgU+of/91EBm9vW3VcihTjKeficvyNP
JmjsCHDBAoGBAN7SPfmIN2N/TK/dch7g8xt8gKKgOvaln0GzCRx17dY0wMoUz1Q/
IJcLRMGU9rDjkH4zFR3GWX8ZhIPjHrVzIGxtfq5Vb1YqFul31hs1ex/5KNgYC5yN
4MFKYoldR7Zt+sc1VJx543EUMeA9lDxJN5ggW+Dyh7M+vfGN+/yHo21V2YnaMUkV
Kxa2/FKa7XdKQ/4h5BayO7dmSiUqFfWNN6C8kJv3F0GD5Jft9Q32b4KQ+Y/hYjOm
MgY0/HyizobfW9g2YvCubpfSWyjduVq2HDO4YsFpAoGBAJoA1bTR4PZz1Zz3gRi2
xapVfApZUVmvd6PBZ6qlYUStTMI3FyFixH3hxqCbXchOrU5hJTcsmpUlAoGBAK0l
llqZNAF+82Ayo2pznlNZuIr58ColWC9D0iQkNngsq3V/HLEkygD1mLeSbk6vKAK0
KR7wnFY0XK3SYEpeGyJRK7UJreOdcDlf/9UWV9CLWUBuf+376DNrLLPRoZEq7c8m
MIIEpAIBAAKCAQEAlrTLIqGxCNTKpQuQFcfkpyfugD1JdmuJvYY1k/P4wTXBb2Oz
DmOfP0eyULhyjFEXYudP0Bq+RjQfQ4y11ic17dtOiA4oBEpGSC2PFx1H0hbBkXNW
.... ommited lines ....
OT+H/LCksXzwY/f4TLCFs5HBAoGALwWULYqJqxZU9f0KkDBSAQTOrz9tT6TQrBVZ
ok2FDFs7D/Yt8iBcd9yjNjOVykMPG4NEB2PZ7xcNXwtKjOvtyOC/fQ==
-----END RSA PRIVATE KEY-----

2. Create a dummy certificate (in a pem file), open the terminal an execute next command, you have to complete the propmt data for the certificate.

openssl req -new -x509 -days 9999 -key private.key -out cert.pem

    Output:

    $ openssl req -new -x509 -days 9999 -key private.key -out cert.pem
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    -----
    Country Name (2 letter code) [AU]:MX
    State or Province Name (full name) [Some-State]:Ciudad de Mexico
    Locality Name (eg, city) []:CDMX
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:Dummy
    Organizational Unit Name (eg, section) []:IT Dummy
    Common Name (e.g. server FQDN or YOUR name) []:
    Email Address []:
    
    Seguir leyendo

    SAP PO, describe table using a function module to create Data Types

    Hi in this entry I would like to share a quick tip to create the XSD Data Type from ABAP table structure with a lot of fields using a funtion module to save time.

    Recently I had to create some structures in SAP PO from different ABAP tables, in order to simplify the process I’ve donwloaded the required table data using a function module as follow:

    1. Go to SE37 transaction and execute the function DDIF_TABL_GET, then set the import parameters (table name and language):

    Seguir leyendo

    SAP PO, Receiver REST Adapter with OAuth authentication using a UDF

    Hi, in this entry I would like to share the source code that I’ve used to develop a service interface which must to authenticate with a OAuth service.

    I know there is an option to manage the authtentication by default into the receiver REST adapter, but it only works if the OAuth service have a specific response structure, like this:

    {
        "access_token": "eyJ0b2tlbkNvbnRlbnQ***ZMm5Tdz0ifQ==",
        "token_type": "Bearer",
        "expires_in": 86399
    }
    

    Unfortunately I don’t have that structure because my auth provider have something custom with their own fields, also I must to renew the authentication token every 20 minutes. So then, my only option to handle this is using a UDF into Message Mapping and not use the deafult functionality in the adapter.

    So lets get started.

    Seguir leyendo

    SAP PI/PO, SOAP XI to REST scenario, sending zipped xml file and retrieve different JSON responses

    This time I want to share how I developed a service interface to consume a REST API using the PUT method. The web service could accept different inputs:

    • Text plain xml request
    • xml request with gzip compression
    • xml request with no body payload and attached a zipped xml payload
    • xml request with no body payload and attached a xml payload

    And also I need to send the parameter async and it could change the structure of the JSON responses, something like this:

    // HTTP 200 response, sent zipped request with async=true
    {"jobReference": "12345"}
    
    // HTTP 200 response, sent zipped request with async=false
    [{
       "entityName": "brand",
       "acceptedCount": 14
    }]
    
    // HTTP 200 response, sent xml request with async=false
    []
    
    // HTTP 200 response, sent xml request with async=true
    {"jobReference":"47671"} 
    

    And we need to consider the possible errors:

    // HTTP 401 response, Unauthorized
    {
       "messageText": "com.enactor.core.web.authentication.exceptions.AuthorisationException: Basic authentication header missing in the request.",
       "errorCode": "Unauthorized"
    }
    
    {
       "messageText": "com.enactor.core.web.authentication.exceptions.AuthorisationException: Failed to authorize request with user dummy",
       "errorCode": "Unauthorized"
    }
    
    //  HTTP 200 reponse, invalid content
    [{
       "entityName": "brand",
       "rejectedCount": 2,
       "rejectedReasons":    [
                {
             "key": "groupTypeId=brand;groupId=;groupHierarchyId=;",
             "rejectionCode": "ENTITY_BLANK_KEY",
             "rejectionDescription": "Entity has blank key"
          },
                {
             "key": "groupTypeId=brand;groupId=;groupHierarchyId=;",
             "rejectionCode": "ENTITY_BLANK_KEY",
             "rejectionDescription": "Entity has blank key"
          }
       ]
    }]
    
    // HTTP 30X ,40X, 500 responses,
    // no JSON response available
    

    And something else, the xml file, no matter if is it sended into a zip or direct into the payload, must use two different prefixes with different namespace and some attributes, something like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <Batch>
       <ns1:brand xmlns:ns1="http://www.dummy.com/ns1">
          <ns1:field1>1234</ns1:field1>
          <ns1:field2>ABC</ns1:field2>
          <ns2:field3 country="MX" language="ES" variant=" " xmlns:ns2="http://www.dummy.com/ns2">DUMMY NAME</ns2:field3>
        <!-- omited fields -->
       </ns1:brand>
    </Batch>
    

    So, in this entry I would like to share how I solved this scenario. I’m going to focus on the key activities to develop this service interface.

    So, lets get started.

    Seguir leyendo

    SAP PI/PO, IDoc Receiver Adapter solving Error while getting connection factory name from JNDI due to Object not found in lookup of MetaCFLookupPrefix

    After upgrade the SAP PO we noticed an excessive workload for IDoc Receiver Adapters consuming a lot of memory and writing multiple error entries into the channel log with this message «Target Destination unavailable«, but the RFC destination exists and their parameters are correct, the connection was successfully.

    So, looking into the Logviewver there are a lot of errors with the message:

    «Error while getting connection factory name from JNDI due to Object not found in lookup of MetaCFLookupPrefix«

    Seguir leyendo

    SAP PI/PO, 520 Unexpected reply codeControl connection prematurely closed by server in File Sender Adapter

    This is quick entry, I have a lot of error entries in the Logviewver for some services that are using a File Sender Adapter with FTP protocol:

    «520 Unexpected reply codeControl connection prematurely closed by server«

    Looking into SAP launchpad I have found the note 2462145 – FTP error when file is missing in Source Directory, it mention that error is generated when the FTP server retrives a different code in reply, and it could be fixed with an update of the support package.

    Seguir leyendo

    SAP PI/PO, Deploy SCA file to upgrade a software component using Netweaver Developer Studio (NWDS)

    This is an example to show how to deploy a SCA file dowloaded from SAP Lauchpad, it is very important that you must to read the compatibility and the requirements before to upgrade any component, so please, be careful with this.

    Validate and download the Component

    First, in order to know what versions do you have installed in the system go to http://[host]:[port]/nwa/sysinfo and search the name of the component, into the version field is the base number and the support package, the next image shows the component XI_CNT_SAP_BASIS with the versión 7.5 SP 27:

    Then go to SAP Launchpad and search the component into the top search bar and click on download icon, and select your corresponding base version (for me is 7.50):

    Seguir leyendo

    SAP PO, Solve authentication error on REST services after upgrade system

    This is a quick entry, after the upgrade de SAP PO from 7.5 SP 02 to 7.5 SP 27, a quite few REST services started to fail.

    Doing some research I have noticed that it is because the authtentication parameter it is not included when the request are sended. To detect this behavior I had to use the XPI Inspector tool to get the logs from request and response.

    It look like this:

    Into the header is missing the authentication parameter, so I found a SAP Note 2952313 – REST Adapter with Basic Authentication fails after update/upgrade to Netweaver 7.50 SP17 or higher, the title is described it self.

    Seguir leyendo