Skip to Content

UI5 Application , cannot consume data from SAP PO Rest API

Hi,

I am calling a rest web service created in SAP PO, from a UI5 app created in NWDS.

The code is as follows:

$.ajax({ url: "http://<server>:<port>/RESTAdapter/checkvendorexistence?vendornumber=<value>?anycode=value",
type: "GET",
crossDomain: true,
//data: JSON.stringify(data),
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
success: function (response) {
var resp = JSON.parse(response);
alert(resp.status);

},

error: function (xhr, status) {

alert("error"); } });

In chrome, I am getting status 200 OK, and in SAP PO monitoring, I am getting the request and response. But the alert i get is of error function. Where am I going wrong?

Any guidance would be useful.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Nov 11, 2019 at 10:43 PM

    you cannot make it, if your ui5 app and the odata service are not in the same server.

    you need web dispatcher to help.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 12, 2019 at 03:51 AM

    Hi Ram and Jun, thanks for the comments.

    I am using Eclipse NWDS for development, and its on premise. I am sending request from localhost to SAP server on premise.

    Its not odata service, I am using Rest API published in SAP PI/PO.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 12, 2019 at 03:46 PM

    no matter it is odata or not,

    any ajax call has to conform to that rule

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.