Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
  1. Introduction:

    This is the 3rd part of Directory API development. The 1st part gave a high-level overview of directory API development and the pre-requisites of using the Directory API.

    In part 2, we explored the details involving the development preparation required in NWDS before actual coding can begin.

    In this blog, part 3, we will dive into the actual coding using the Directory API.

    To use as an example for this blog, I will use the Directory API to create SOAP receiver communication channels. The steps of creating other types of communication channels are similar. Primarily, the adapter type and the parameter names will need to be changed. To get the parameter names to use with the Directory API, it is recommended that a listing of an existing communication channel be done first using the "/wsnavigator".

  2. Pre-Requisite of using the Directory API:

    As mentioned in part 1, to use the Directory API, the userid must be assigned specific roles. These roles must be assigned in the java server. The roles are not available using the ABAP transaction code SU01. It is critically important that step III in part 1 is carried out before proceeding with using the Directory API.
  3. Development Process:

    Please note, for this blog, NWDS 7.1 is used with PI 7.1.

    Since a Communication Channel will have to be created in a Business Component or Business System, for this blog, I created two business components in the Integration Directory: BusComponent1 and BusComponent2

    Overview:

    The code development process consists of the following steps:
    1. Create new package and classes to contain our custom code. In this blog, I created the following:
      Package: com.test.commchan
      Classes: CreateSoapChannel, ChangeList and Parameters
      (The ChangeList class is used to create and activate a changelist. The Parameters class is used to store commonly used values, e.g. userid and password. I created these 2 classes, instead of including them in the CreateSoapChannel class, is for re-usability purposes, in case you decide to develop other directory API functions. You can also split these 2 classes into separate packages.)

    2. The Parameters class is quite simple. It containts the following code:

      The userid must be authorized with the right roles to use the Directory API.

    3. The ChangeList class contains 3 methods:


      createChangeList: This method creates a new change list and returns its changelist id.
      activate: This method activates the changelist, using the changelist id.
      setURL: This method sets the URL on where the webservice is to be executed. By default, the webservice will executed on the server as set in the binding and endpoint of the WSDL configuration in part 2. We can change this configuration by using this method. Consequently, this code can be used to execute the webservice on any server.

      It containts the following code:

    4. The CreateSoapChannel contains the following methods:

      createSoapChannelActivate: This method is the main method to create and actiate the SOAP communication channel configurations.
      createChangeList: This method creates a changelist containing the SOAP communication channel configurations.
      createSoapChan: This method creates all the SOAP communication channel configurations. build1SoapChan: This method creates one SOAP communication channel configuration.
      setURL: This method sets the URL on where the webservice is to be executed. It serves the same purpose as in the ChangeList class.
      setActivate: This method sets the flag on whether the configuration is to be activated. I included this option on whether to activate the changelist. If this is set to "false", then we can see the changelist list in the "Change List" tab of the Integration Directory. At that point, we can manually activate it or reject it. If set to "true", then the configuration will be activated by the program.

      The class containts the following code:

    5. Please note in the "main" method, the data used to create the communication channel are set into arrays. This should be self-explanatory.
    6. When we execute the CreateSoapChannel, with "setActivate(false)":

      We will see in the Integration Directory the changelist: (make sure you log on using the same userid as the one used in the Directory API program...you may also need to refresh the screen)

      and

      If we used "setActivate(true)", then there will be no changelist shown and the configuration would have been activated automatically.

10 Comments