Fetch SOAP web service call with deep structure in ABAP [Part II]

Fetch SOAP web service call with deep structure in ABAP [Part II]

Below is my second article out of 3 for fetching web service calls with a deep structure. In this article, I will show you how to create a simple transformation that can be used in ABAP for fetching XML data. If you haven’t read the first article on how to check the web service and create structures to fetch the data, please go check it out at our blogs: Part I

So, after part 1, now that we have our structures completed we can go and create the simple XML transformation for the data we are going to fetch.  A simple transformation can be called by ABAP to check if incoming data is of the correct structure and to automatically insert this incoming data into an internal table.
Go to transaction XSLT_TOOL
Give your transformation a name for example ZXML_TRANSFORM_SVOI (needed later in the ABAP).

Choose a transformation type Simple Transformation.
Here you can choose to follow the wizard and get the structure created for you.

 width=

However, this wizard is not always correct since it follows your structure tables and does not include all the correct notations of your SOAP call. But we can use to it get a starting point. So, click on the wizard icon.
Delete the default empty root and right-click insert new root.
Give it the name of your highest-level table and select Line-Type

 width=

You’ll get your structure displayed

 width=

Drag the highest node to the right panel

 width=
Click activate and then click the back button

Go to the source code tab and you’ll see the start of our transformation

 width=

Below I’ll explain the changes I made to the document for it to work correctly with the SOAP call.

So, let’s highlight the changes (see the second image below).

  • I changed the root name to LIGNES this does not affect anything just to keep an easy outline.
  • The context and template name are not needed so I deleted them from the code.

All other changes are just to align the source code with the XML structure from the SOAP call, so when making these changes it is best to take your result of the SOAP call and put it on a screen next to you.
SOAPUI:

 width=

XSLT_TOOL (Finished Source Code):

 width=
The only difference between the transformation and the structure of the SOAP call is that in the transformation for every element that can occur multiple times you’ll have to put a loop.
These are the parts we created tables for so in our case at Ligne, Indice and Statut. Otherwise, everything must be the same even to the prefixes of the SOAP call.
Notice that the first part must be the same as in the XML file even the use of capitals and after the value-ref part is the name of the component of the structure you created at the start.

This will conclude the second article of the blog on how to fetch SOAP web service call data with ABAP. Next will be the last article on how to fetch the data from a web service call with ABAP.

Blog by Sven Swennen