Skip to Content
Author's profile photo Former Member

Directory API Development – Part 1 of 3

    Due to the amount of information on this topic (there are over 30 screenshots not including the code listing), I have divided the blog into 3 parts. The 1st part contains the high-level view of the Directory API and pre-requisites. The Directory API Development – Part 2 of 3 contains the details of setup, e.g. importing WSDL, generating proxies, before starting code development in Directory API Development – Part 3 of 3.

    h3. Overview:

    Differences between the Integration Directory and Directory API


    1. The programming interface enables you to configure multiple objects at the same time.
    2. Using the programming interface you can only edit your own change lists. You cannot take on and edit the change lists of other users.
    3. There are no default change list, e.g. with the name “Standard Change List”, which means that you must specify a change list of your own, or else, a new change list name will be generated each time based on a combination of username and time stamp.
    4. There is no ‘delta’ handling of attribute changes. This means that when you make a change to an object, you will still need to specify all the attributes for that object, just as though it is a create.

    h4. Using the Directory API
    SAP NetWeaver PI 7.0’s Directory API is available for SAP NetWeaver PI 7.1 and since SAP NetWeaver PI 7.0 SPS13 and SAP NetWeaver XI 3.0 SPS21.

    The SAP NetWeaver PI 7.0 Directory APIs are implemented as webservices in SAP NetWeaver’s java server.

    Java proxies can be generated in NetWeaver Developer Studio (NWDS) from:

    1. Web service URL from the web service runtime of the JEE server, by using the “Web Services Navigator”
    2. External definitions in the “SAP Basis 7.00” SWCV

    h4. Usage Examples:

    1. Customize Content Presentation of the Integration Directory. You can actually build your own version of the Integratoin Directory.
    2. Create custom views of the contents of the Integration Directory, for example, for the purpose of statistics or administrative reports.
    3. Create solutions or company-specific user-interfaces (e.g. maintaining partners in B2B scenarios in a spreadsheet).
    4. In a pub/sub scenarios, the configuration objects (e.g. communication channels, receiver agreements, etc.) can be created from an external source (e.g. file or database). 100s of objects can be created without going thru the manual process of using the Integration Directory.
      1. h3. Pre-Requisite of using the Directory API:
        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. h4. Assigning roles in PI 7.0 or XI 3.0:
    1. Start Visual Administrator (VA)
    2. Navigate to: Server *  »  * Services *  »  * Security Provider *  »  * Runtime *  »  * Policy Configuration

    select: sap.com/com.sap.xi.directoryaii_ibdir_sbeans.jar*

    In Security Roles: add roles api_develop and api_display to Users or Groups

    h4. Assigning roles in PI 7.1:
    Since Visual Administrator in no longer available with PI 7.1, we will have to use the NetWeaver Administrator.

    Start the NWA using http://<server>:In Assigned Roles tab, enter search using criteria: SAP_XI_API*

    Select and add roles: SAP_XI_API_DISPLAY_J2EE and SAP_XI_API_DEVELOP_J2EE

    h4. Verify the Role Assignment:
    To make sure the assigned roles are correct, we can test using the webservice navigator:

    Start the webservice navigator: http://<server>:Directory API Development – Part 2 of 3
    Directory API Development – Part 3 of 3 </p></li></ol>

    Assigned Tags

        17 Comments
        You must be Logged on to comment or reply to a post.
        Author's profile photo Former Member
        Former Member
        We have PI 7.1 SPS 7 but can't see the API services in wsnavigator?

        Is it only available with EHP 1?

        Regards.

        Author's profile photo Former Member
        Former Member
        Blog Post Author
        Hi,
        Directory API has been available since SAP NetWeaver PI 7.0 SPS13 and SAP NetWeaver XI 3.0 SPS21.  Although, a new set of services will also be available with PI 7.11 (PI 7.1 EhP1).  So, with PI 7.11, there will 2 sets of webservices, one for PI 7.0 and the other for PI 7.1.  The PI 7.0 version can be used with most, but not all, of the objects in the PI 7.1 Integration Directory.

        To test or view the webservices in PI, go to the WSNavigator.  You can use a search filter, e.g. "communication", and see the webservice(s) for communication channels.

        Regards,
        Bill

        Author's profile photo Former Member
        Former Member
        Hi William.
        Excelent blog.!
        Is posibility to create Parties dynamic using this API?.I have a lot of Parties/ Services to create.

        I really appreciate any help.

        Author's profile photo Laxman Molugu
        Laxman Molugu
        Hi Bill,

        My scenario is one to many, one Interface with several receiver Parties/Business Components. so I created a Receiver Determination with one party as the receiver using regular Integration Builder Tool and I was trying to add more receiver by Directory API for the remaining receivers to the one which I manually. But I did not see a way or option to add more to the receivers list, when I tried that it was simply overwriting the existing one when I used the Change Operation but when I try to use create Operation it complains that the Object already exists..

        Do you have any idea the way to use the API to add more receivers to the list.

        Thanks,
        Laxman

        Author's profile photo Former Member
        Former Member
        Blog Post Author
        Hi,
        Directory API does allow for adding mulitple receivers.  The receiver list should be an array of receivers which you can specify.  You have to instantiate each receiver as a new instance and not re-use the existing one.

        Regards,
        Bill

        Author's profile photo Laxman Molugu
        Laxman Molugu
        Hi Bill,

        Thanks for the Quick response, can I just "add" a new receiver to existing list(big list) to the receiver determination? I think its just overwriting the existing list.

        Thanks,
        Laxman

        Author's profile photo Former Member
        Former Member
        Blog Post Author
        Hi,
        Yes, you can.  But you have to create a new instance of the receiver.  Do you change the existing one by changing the values and add.

        Regards,
        Bill

        Author's profile photo Laxman Molugu
        Laxman Molugu
        Bill,

        I am not clear about "you have to create a new instance of the receiver". We have a Receiver Determination with 5000 receivers, now I need to add 500 more receivers to the list. I am using "Change" operation of wsdl ReceiverDeterminationChangeRequest. First I am not sure any option to use to add the new receiver to the list, I am using Rule\Receiver node to add the new receiver but its simply overwriting the list with new receiver. Can you clarify how can I achieve this? 

        Laxman

        Author's profile photo Former Member
        Former Member
        Blog Post Author
        Hi,
        Sorry about the misunderstanding.  I wonder if there is a limitation at 5000 receivers.  Can you manually add more receivers to see if it is overwriting the current ones?  If so, can you create a customer message for the developer on the limitation?  Else, you should be able to add more.

        Also, I wonder if there is another way to do this.  Is the message to be sent to all the 5000+ receivers or do you have an XPath expression to determine which receiver(s) is to receive the message?  If it is the latter case, then you can write a multi-mapping program to determine the receiver; in this case, you do not need to enter all 5000+ receivers.

        Regards,
        Bill

        Author's profile photo Laxman Molugu
        Laxman Molugu
        Bill,

        The issue I am facing here is not the limitation on the number. Lets say I have 10 receivers to the existing RD and I am trying to add 2 more receivers to the list its simply overwriting 10 receivers with 2 new(so all my existing 10 receivers are gone from the list). My question is When add new receivers should I include the existing 10 receivers plus 2 new receivers? or can I just include the 2 new receivers in the list in the XML?

        Thanks,
        Laxman

        Author's profile photo Laxman Molugu
        Laxman Molugu
        Hi Bill,

        I am sorry I think I am not able to ask question clearly. Let me clarify here again, we need to configure few thousands of EDI parties for AS2 interfaces. We have scheduled to deploy few hundred (~200) parties at a time with this we have to do this iteration in few releases. So my question is when we create RD first time with 200 receivers it works fine but for the next release we need to add 200 more without touching the existing receivers list I mean I want just append to the list. But when I use this Change webservice I am not able to add to the list but its simply overwriting as a create functionality so I am wondering is there any option to just add the receivers list?

        Thanks,
        Laxman  

        Author's profile photo Laxman Molugu
        Laxman Molugu
        Hi Bill,

        Thank you for your help so far, We are able to create ID objects using this API but unable to assign an object to a folder.

        I have Folder Structure like
        \IBM\ - for IBM
        \HARTFORD\ - for Hartford.

        So we are trying to create all the ID object under the vendor folder like IBM. When we run the program the objects are getting created but those doesn't show up in the specified folder and we have no errors/warning in the logs. We can still see them created in Object View.

        Interesting this is that there is no folder issue in our system PI 711_00 but in 711_06 has this problem. I am not sure what casing this issue in our new system.

        Please let me know if you have idea on this issue.

        Thanks,
        Laxman

        Author's profile photo Former Member
        Former Member
        Blog Post Author
        Hi,
        I believe working with folders is available with PI 7.3.

        Thanks,
        Bill

        Author's profile photo Former Member
        Former Member

        Hi Bill,

        Can these API development be possible by getting first the metadata of a certain object existing lets say in Communication Channel, then push that metadata that consists previous information to the new environment related to Change List user.

        I'm having a concept of this tool that from transporting objects to the new environment, the details of the communication channel is not carried from the previous system (File Transport..not seen the results of CTS+ transport). So basically, my concept would be a gui (left environment will be the source system, right environment will be the target system). Load the metadata of that source system (communication channel - object name base) and then load it it to the new system, change some parameters if needed then save).

        If its possible, how to get the metadata of that object?

        Cheers,

        R-jay

        Author's profile photo Former Member
        Former Member
        Blog Post Author

        Hi R-jay,

        The APIs are web services.  So, you can get the metadata from the WSDL.  The APIs can be used to retrieve the content from the source system, and poppulate to the content of the target system and update.

        A gui tool to do this will have to be custom developed.  But, I am not sure this will be so useful.  During transport, the system-related info are purposely not transported.  The systems used in DEV are different than those used in TST or PRD.  Therefore, we don't want to have DEV systems to be accidentally used in a PRD environment.

        What I've seen many customers do is to provide an external medium, e.g. EXCEL, that is used by the administrator to store and maintain system-specific information based on the environment, e.g. TST, PRD.  Then this file is used to update the content after transport.  Such a program is much simpler to develop.  And, it can be added as a final step after transport.  This will avoid the required task to logon to the system and manually enter the data, and possibly entered wrongly due to spelling or typo or otherwise.

        Regards,

        Bill

        Author's profile photo Former Member
        Former Member

        Bill,

        You have some of the most useful blogs on SCN and personally I have had a chance to attend some of your sessions in TechEd as well.

        In my company we are planning to adapt new PI Naming Standards. I wanted to know if we could use this API to rename the name of a communication channels, config scenario, Business Components etc in dev, QA and Prod systems.

        Thanks,

        Vicky

        Author's profile photo Former Member
        Former Member

        Hi William,

        I am trying to use the API for Configuration Scenario objects to print the objects in the Configuration scenario. I need the sample code to fetch the Configuration Scenario objects like Sender system , receiver sytem , sender and reciever communication channels , Receiver determination etc... Which method is to be used to fetch all these objects of a Configuration Scenario. It would be of great help if youc an provide me the sample code to fetch the same.

        Thanks,

        Soundarya