Skip to Content

Configuration of non OData Destinations in SAP Cloud Platform

Hi

Apologies for what might be an extremely simple question, but I have been banging my head on this one and unable to find any information that has been helpful so far.

Looking at developing a Cloud Platform Applications that consumes data from a http ressource that is not OData, e.g. an xml feed.

Found some information on the class "sap/ui/model/xml/XMLModel" on the online documentation. But when trying to load data from a static URL directly in the applications in a controller file, then I receive below error:

"error: Fiori Architectural Guidelines: ESLint(sap-no-hardcoded-url): Hardcoded (non relative) URL found."

I was thinking fair enough, I guess I will simply create a destination in my SAP Cloud Platform Cockpit and reference the URL trough there. But based on the information I am able to find I starting to think that this is only relevant for OData endpoints and other SAP integrations.

So my question is, which seems so simple, what is the correct approach to consume data from a static url?

I hope somebody has the time to give a rookie a little pointer that will go a far way....

Regards

Adam Lamaa

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 12 at 04:57 PM

    Hi Adam,

    You can use a destination in your Web IDE to call a SOAP HTTP service or any other type of service. Web IDE has some wizards that rely heavily on OData sources. However, if you aren't using any of those, then you are safe using this on Web IDE for your development.

    The destination has to be of type HTPP / Internet and your reference its URL on your app just like any odata service.

    If you don't use the destination you may face a cross origin issue in modern browsers that are compatible with SAPUI5.

    You can try using XMLModel class, but I believe that this is more intended to XML responses from OData services. But surely you could use other JS tools (Jquery/Ajax) to figure out how to call the SOAP endpoint, retrieve the XML response and bind it into the UI5 components.

    Chekc this blog.

    Regards,
    Ivan

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Adam,

      I believe you are missing some important header variables that need to be sent so your SOAP request goes thru.

      Check that you have the following on your manifest.json:

      {
        "welcomeFile": "/webapp/index.html",
      ...
      ...
        "headerWhiteList": [
        	"SOAPAction",
        	"Connection"
        	]
      }

      I have done some investigation on the destination service. It seems that it doesn't really work the same exact same way as a direct call to the Web Service. For SOAP requests of type GET I don't really see any issues. As for the POST requests, some services may "complain" about being called at the root location. Some services will require the SOAPAction header variable to be "" while others may work only when this is set to something else. I have seen cases where the envelope was badly constructed when using a String variable (perhaps this is something that the destination treats as a variable - reason being that it puts part os the XML as variable name and colon afterwards with parts the XML - for which the provider rejects the request as being unable to parse the payload).

      Have you loaddata method call the destination and put a break on the success, error, complete events using SHIFT+CTRL+I. Once your browser stops at one of these events you will see the web page your WS returned. If the event is an error, then you will be able to inspect the request/response variable to see why your SOAP request may have failed.

      Best way to understand this is to have your own Web Service that you could deploy and debug to inspect the variables it requires, payload, etc.

      I have a project I created on WebIDE using a destination that calls a public SOAP via GET Method passing values as variables (no XML payload yet). If you wish to take a look, I can share it via git.

      Regards,
      Ivan