cancel
Showing results for 
Search instead for 
Did you mean: 

REST webservice with file attachment as response possible in Data Services?

MarcusZwirner
Product and Topic Expert
Product and Topic Expert
0 Kudos
512

Hi experts,

we want to implement a REST webservice call with Data Services.

Unfortunately, the webservice owner does not provide a wadl.

And in addition the response of the webservice is not returned “inline” (i.e. not as part of the payload), but as an xml file attachment (the HTTP response-type header field “Content-Disposition” is set to “attachment” and contains the filename; when you enter the target URL directly in a browser, you receive a prompt / a Save As dialog box to save the file locally to access it).

Is it possible to use Data Services for such a kind of a REST webservice?

If so, what should the response part look like in the wadl?

Thanks for your answers and best regards

Marcus

Accepted Solutions (1)

Accepted Solutions (1)

MarcusZwirner
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

in the meantime, I found a solution, i.e. Data Services can handle such a kind of REST webservice.

Everything depends on the wadl and the xsd. And if the webservice owner does not provide a wadl, it’s a little bit tricky to create a working one manually.

I did the following:

In the first step I used SoapUI to create the first draft of the wadl.

  • In SoapUI create a new REST project and enter the target URL.
  • Then expand the created REST project, right-click on the service (it’s the node under the project name, labeled by two arrows) and select “Show Service Viewer” from the context menu.
  • In the pop-up window go to the tab “WADL Content”, copy the whole content und paste it in a new file in a text editor.

Everything else can be done in the text editor.

  • Insert <?xml version="1.0" encoding="UTF-8"?> as the first line into the file.
  • According to SAP note 2451304 (https://launchpad.support.sap.com/#/notes/2451304) check if the ID of the method and the title of doc tag must be changed.
  • According to SAP note 2230626 (https://launchpad.support.sap.com/#/notes/2230626😞
  • correct the response part of the file
  • remove the xmlns:sop specification (if exists) and
  • add or correct the name of the response element according to the xsd
  • and add the reference to the xsd file with the schema for the response element in <grammars></grammars> tags
  • In our case we must correct the xsd as well (see next bullet point), therefore we downloaded the xsd and stored it locally, the reference in the grammars tag must then point to that local file.
  • According to SAP note 2877350 (https://launchpad.support.sap.com/#/notes/2877350) check if the xsd contains the targetname space and xmlns tag for the response schema. If so, remove it.

After all those changes, we were able to create the datastore, import the webservice metadata and call the webservice in a Data Services job successfully.

I hope this description helps in case someone faces the same problem.

Best regards

Marcus

Answers (0)