cancel
Showing results for 
Search instead for 
Did you mean: 

Configuration of non OData Destinations in SAP Cloud Platform

0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

soumya_r
Participant
0 Kudos

Hi Adam,

have you found solution for this problem?

I have the requirement where triggering the webservice with XML payload with POST ajax call, i am getting the 404 : (blocked:mixed-content) error.

it will be helpful if you can share the solution or ideas.

var sURL = "http://abcd.qwerty.com/qwerty/qwertyintergration/Execute";
		
			$.ajax({
				type: "POST",
				url: sURL,
				username:"qwerty",
				password:"******",
				contentType: "text/xml; charset=\"utf-8\"",
				data: sPayload,
				dataType: "text", //"xml",
				success: this.resSuccess,
				error: this.resError,
				complete: this.completed
			});
Payload : 
var sPayload =
		+"<?xml version=\"1.0\" encoding=\"utf-8\"?><XMLScript Version=\"2.0\" Name=\"09232006_103601_Job1\" ID=\"123\">"
		+"<list>12121</list>"
+"</XMLScript>";

thanks,

Soumya

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

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

0 Kudos

Hi Ivan,

I really appreciate your response, and the blog you linked to seems like a great resource I need to try and replicate.

I am however still trying to fully understand your response regarding the destinations config.

1. So the destinations should support other services then OData. But if I use the descriptor editor to load a destination URL in my manifest.json file it is not working. Could this be because the wizards rellies heavily on OData sources or maybe my additional properties are wrong on my destination?

2. To avoid the cross origin issue I would like to use a destination long term. So should i simply define it manually in the manifest file?

How would that config look like, would something like below be correct? I am guessing on the type property.

"dataSources": {
"xmlSource": {
"uri": "*insert URL*",
"type": "HTTP"
}

Hope my question makes sense.

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

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