Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Transformation for Sharepoint WSDL GetListItems

0 Kudos

Hi

I'm able to read from ABAP a SharePoint List by using the SharePoint Webservice. For this I created a Enterprise Webservice. So far so good.

When I use the WebService Method Get_List_Items.with this XML

  <n0:GetListItems xmlns:n0="http://schemas.microsoft.com/sharepoint/soap/">
  <n0:listName>{67D38E2A-647D-4976-B989-BD8B2E131DDC}</n0:listName>

</n0:GetListItems>



I'm getting also a result:

<?xml version="1.0"?>

<n0:GetListItemsResponse xmlns:n0="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><n0:GetListItemsResult xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"><n0:listitems><rs:data ItemCount="8"><z:row ows_LinkTitle="1337" ows_Plant="10" ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_Title="1337" ows_ID="1" ows_UniqueId="1;#{05F8EDB7-D0CA-4024-8125-AC3628394B69}" ows_owshiddenversion="5" ows_FSObjType="1;#0" ows_Created_x0020_Date="1;#2016-02-16 14:20:31" ows_Created="2016-02-16 14:20:31" ows_FileLeafRef="1;#1_.000" ows_PermMask="0x7fffffffffffffff" ows_Modified="2016-05-27 23:18:38" ows_FileRef="1;#Lists/Testlist/1_.000"/></rs:data></n0:listitems></n0:GetListItemsResult></n0:GetListItemsResponse>



In my ABAP I try to read the XML using simple transformation, but don't have a clue how this simple transformation should look like.

Does anybody has an example used with a SharePoint Webservice Method?


Or could anybody tell me how the ST should look like?


Any response is welcome

Thx

Roger

1 ACCEPTED SOLUTION

rdiger_plantiko2
Active Contributor
0 Kudos

Hi Roger,

personally, I hate those generator machines. I try to solve the problem "on demand", scoped with minimum overhead along the lines of what is given and what is requested.

So in this case, a hand-written simple transformation will do the trick. I started with three fields, extracted from the row XML element, as a beginning. Use the fine and concise ABAP ST documentation and extend your ABAP datatype to transform more data.

Like always, the transformation works both ways, although in this case you probably won't need the backward direction (generating an XML in the format of Sharepoint's lists from your ABAP list). Usually, in those unidirectional cases, I prefer XSLT because it has more flexibility. But for simple cases like this one, simple transformations are fine.


<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

   <tt:root name="ROWS"/>

   <tt:template>

     <n0:GetListItemsResponse xmlns:n0="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

       <n0:GetListItemsResult xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882">

         <n0:listitems>

           <rs:data>

             <tt:loop name="row" ref=".ROWS">

               <z:row>

                 <tt:attribute name="ows_LinkTitle" value-ref="$row.link_title"/>

                 <tt:attribute name="ows_Plant" value-ref="$row.plant"/>

                 <tt:attribute name="ows_Created" value-ref="$row.created"/>

               </z:row>

             </tt:loop>

           </rs:data>

         </n0:listitems>

       </n0:GetListItemsResult>

     </n0:GetListItemsResponse>

   </tt:template>

</tt:transform>

For the usage of the transformation in a running ABAP report, see my pastebin at [ABAP] Transforming a sharepoint list to ABAP - Pastebin.com


* You may use data types prefixed with XSD... for conversion to special formats

types: begin of ty_row,

          link_title type string,

          plant      type string,

          created    type xsddatetime_iso,

        end of ty_row,

        ty_rows type standard table of ty_row with empty key.

start-of-selection.

   perform start.

* ---

form start.

   data: lv_doc  type xstring,

         lt_rows type ty_rows.

   perform get_sharepoint changing lv_doc.

   call transformation zshare

     source xml lv_doc

     result rows = lt_rows.

   cl_demo_output=>display( lt_rows ).

endform.

Cheers,

Rüdiger

5 REPLIES 5

Sandra_Rossi
Active Contributor
0 Kudos

If you create an ABAP client proxy to consume the web service (input being the WSDL), it should automatically create the simple transformations which will fill out automatically the parameters of the client proxy methods (their types being also automatically created in the ABAP dictionary).

In your ABAP program, you call the client proxy method, and all data are passed via the method parameters.

0 Kudos

Hello

Thank you for your answer.

I thought about also and searched already for those. But I can't find those transformations.

I created the client proxy using the WSDL - Everything is created to execute the method e.g. "GetListItems".

The proxy client output is an XSDANY Type. This one I converted till now with the function SMUM_XML_PARSE and got the XML back as a table - but this is not the smooth way.

I'd prefer to use ST in the future.

Do you have an example of a ST using SharePoint Web Services?

Thx

Roger

0 Kudos

I tried to understand the SiteData / SharePoint web service format in Microsoft web site, and couldn't get a clear idea how it works. What I see is that the SiteData WSDL just returns strings (XSDANY), that you need then to decode using SharePoint schema. I have looked at several spécifications ([MS-SITEDATS], [MS-PRSTFR]), but impossible to understand where ows_LinkTitle and other attributes come from. It's a little bit too much abstract for me, and I'm not used for developing with Microsoft standards.

Anyway, I think you should first search for XSL on the Web (rather than ST).

Or do ST from scratch based on what you see/guess about what SharePoint web service returns (see Rüdiger answer 🙂 ).

rdiger_plantiko2
Active Contributor
0 Kudos

Hi Roger,

personally, I hate those generator machines. I try to solve the problem "on demand", scoped with minimum overhead along the lines of what is given and what is requested.

So in this case, a hand-written simple transformation will do the trick. I started with three fields, extracted from the row XML element, as a beginning. Use the fine and concise ABAP ST documentation and extend your ABAP datatype to transform more data.

Like always, the transformation works both ways, although in this case you probably won't need the backward direction (generating an XML in the format of Sharepoint's lists from your ABAP list). Usually, in those unidirectional cases, I prefer XSLT because it has more flexibility. But for simple cases like this one, simple transformations are fine.


<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

   <tt:root name="ROWS"/>

   <tt:template>

     <n0:GetListItemsResponse xmlns:n0="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

       <n0:GetListItemsResult xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882">

         <n0:listitems>

           <rs:data>

             <tt:loop name="row" ref=".ROWS">

               <z:row>

                 <tt:attribute name="ows_LinkTitle" value-ref="$row.link_title"/>

                 <tt:attribute name="ows_Plant" value-ref="$row.plant"/>

                 <tt:attribute name="ows_Created" value-ref="$row.created"/>

               </z:row>

             </tt:loop>

           </rs:data>

         </n0:listitems>

       </n0:GetListItemsResult>

     </n0:GetListItemsResponse>

   </tt:template>

</tt:transform>

For the usage of the transformation in a running ABAP report, see my pastebin at [ABAP] Transforming a sharepoint list to ABAP - Pastebin.com


* You may use data types prefixed with XSD... for conversion to special formats

types: begin of ty_row,

          link_title type string,

          plant      type string,

          created    type xsddatetime_iso,

        end of ty_row,

        ty_rows type standard table of ty_row with empty key.

start-of-selection.

   perform start.

* ---

form start.

   data: lv_doc  type xstring,

         lt_rows type ty_rows.

   perform get_sharepoint changing lv_doc.

   call transformation zshare

     source xml lv_doc

     result rows = lt_rows.

   cl_demo_output=>display( lt_rows ).

endform.

Cheers,

Rüdiger

0 Kudos

Thank you Rüdiger - now it works like a harm!