Consuming Webservices with tag in WSDL using XSLT

Consuming Webservices with tag in WSDL using XSLT


Have you seen the blog Consuming Webservices with tag in WSDL using ABAP where posted the ABAP solution of empty structures in .Net WEB services? This blog shows another approach - XSLT mapping program.

The problem is in that fact that WSDL file generated with .Net WEB service (MS Project server, MS SharePoint server, etc.) contains link

in element

 ... 

of message type definition. Here target is in "namespace" attribute. Using this WSDL in SAP XI/PI, you will get a message without fields in message mapping. At runtime there will be only one element with whole message into it as its value.

You can modify WSDL copying this structure in "sequence" element of cause but to my mind it is not right way.

Using ABAP is not suitable in some cases, especially when you haven't got OSS key.

I have solved this problem using XSLT.

So, I got a response from MS Project's WEB service like this:

 


...



674457db-7ff1-4e24-81b3-b41d5594f27f
Project1


3dc33ef5-c796-4b01-8707-3b1f225f741c
Project2




In this message I want to get a list of Projects UIDs ().

First step was "cut" redundant namespaces using XMLAnonymizerBean module

image

Next, I wrote script like this:




















In this script templates





search elements in input XML, call next template and put its result in element of output file. If next template is not exists, it returns value of current element.

So, my response from MS Project transforms to:

 


674457db-7ff1-4e24-81b3-b41d5594f27f


3dc33ef5-c796-4b01-8707-3b1f225f741c

It works!

And the last step - is to archive an XSLT file, import it as Imported Archive and choose it in Interface Mapping as mapping program (type=XSL).

P.S.

If you need to get 2 or more fields, your XSLT should be a changed. For example, XSLT for Projects IDs and Names:





























Output:




674457db-7ff1-4e24-81b3-b41d5594f27f
Project1


3dc33ef5-c796-4b01-8707-3b1f225f741c
Project2

SAP Developer Network SAP Weblogs: SAP Process Integration (PI)