Skip to Content

Consuming Your First Synchronous RESTful Service – Step-by-Step – Proxy Class and Testing


This is the last part of a mini-series blog about how to build a basic SAP-to-REST synchronous interface scenario. The blog’s first part can be found here:  Consuming Your First Synchronous RESTful Service – Step-by-Step – Introduction. This part is to build a proxy class in the sending SAP ECC system and to test our integration scenario.

Let’s get to work

Generating a proxy class and creating a test program.

    • Generating the proxy:
      • Log on to the sender SAP ECC system. Go to either transaction SPROXY or transaction SE80. In SE80, select the “Enterprise Services Browser” object type from the left navigation pane.
    • If the software component version that we created earlier is not visible, click the “Refresh” button in order to re-read the ESR catalog.
    • Once the software component version is visible, expand the nodes of the service interface until you see the “outbound” service interface we created earlier.

    • Now, right-click the outbound service interface and select the “Generate Proxy” option.

    • You will be presented by a wizard screen on which you can either check the “local object” flag or select an existing change request. Make sure to add a prefix in your customer name space (starts with Y or Z). Then, click “Finish.”

    • After a short time, you will be presented with the details of the generated proxy. Click the “Activate” button in the top toolbar.

    • Copy the proxy class name, and go to transaction SE24. Paste the class name there and click the “Display” button in . You can just double-click the class name in proxy details screen above.

    • Find the method with the same name as the outbound service interface. Place the curser on the method name and click the “Parameters” button.

    • Take note of the types of the “output” and “input” parameter fields. These will be needed when creating the test program.

    • Test program:
      • Now, go to transaction SE38 to create the test program. Type a test program name then click the “Create” button.

    • In the “Attributes” screen, enter a short description, select the “Executable” type, and then click the “Save” button.

    • On the next screen, pick a package or assign the program as a local object. Then, click the “Save” button.

    • Write the following program. Note the structure types that we copied from the proxy class. The basic logic of this program is displaying an input zip code field. Then, it will call the proxy method which will return the results in string fields. Those two fields: status and results will be displayed in the output screen. Field “results” contains an XML message in plain-text format. In a more elaborate scenario, you will need to parse the returned XML text to read specific fields.

    • After saving and activating the program, click the “Test” button. Type a zip code then click the “Execute” button.

    • You can see that the status and results fields were read successfully.

This concludes this short SAP-to-REST mini-series. Please do let me know if this was helpful or if I missed something.

You must be Logged on to comment or reply to a post.