cancel
Showing results for 
Search instead for 
Did you mean: 

Uncaught in Promise error?

former_member231869
Participant
0 Kudos

Facing an in promise error......... plz guide me regarding to this.

In first Image initializing the model and bind that model into the table.

Second Image is the error which i am getting.

Accepted Solutions (1)

Accepted Solutions (1)

former_member203031
Contributor
0 Kudos

Hi Williams,

The error 500 indicates the internal server error.

I think you need to perform a read service like:

oModel.read('/Path', null, null, true,

function(oData, oResponse)

{

  alert("Read successful");

  },

function(error){

alert("Read failed");

}

);

Thanks,

Deepak.

former_member231869
Participant
0 Kudos

Hi Deepak ,

                        i followed you my oModel giving response Failed......plz can you tell me my model is right or wrong?

                         username password is also in the service...

former_member203031
Contributor
0 Kudos

Hi ,

Below code is the example for a read service by using Northwind services:

var model = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/Northwind/Northwind.svc",false);

  model.read("/Categories",null,null,

  false,

  function(data,response)

  {

alert("success")

  },

  function(error)

  {

  alert("error");

  }

  );

Please try this code in your oninit()

and debug it weather you are getting success alert or not.

Thanks,

Deepak.

former_member231869
Participant
0 Kudos

Hi Deepak,

                    i try this its working fine success message is populating but it is in the case of Northwich service only not in my service

former_member203031
Contributor
0 Kudos

Now you try your service URL in the place of Northwind Service URL and check it by placing a break-points.

Thanks,

Deepak.

former_member231869
Participant
0 Kudos

Hi Deepak,

                  still not working....

is this the right way to access a serivce with username and passoword.

var oModel = new

sap.ui.model.odata.ODataModel("proxy/http://ugcdcc.cdccc.com:8250/sap/opu/odata/SAP/ZDEMO_PR_SRV",false,"mark","mk@1234");     

oModel.read('/PRHeaderCollection', null, null,false,

  function(oData, oResponse)

  {

   alert("Read successful");

   },

  function(error){

  alert("Read failed");

  }

  );

former_member203031
Contributor
0 Kudos

just a small mistake in the url

replace your URL

"proxy/http://ugcdcc.cdccc.com:8250/sap/opu/odata/SAP/ZDEMO_PR_SRV"

with:

proxy/http/ugcdcc.cdccc.com:8250/sap/opu/odata/SAP/ZDEMO_PR_SRV

OR

http://ugcdcc.cdccc.com:8250/sap/opu/odata/SAP/ZDEMO_PR_SRV

Please observe the difference


hope you will get this time.



Thanks,

Deepak.

former_member231869
Participant
0 Kudos

Got it Deepak thanks!!

former_member231869
Participant
0 Kudos

Deepak previously i tried it was working  but now dont knw why its not..

var oModel = new sap.ui.model.odata.ODataModel("proxy/http/ugcdcc.cdccc.com:8250/sap/opu/odata/SAP/ZDEMO_PR_SRV",false,"mark","mk@1234");     

now its giving this error.....

former_member203031
Contributor
0 Kudos

please check in the screen shot at the line problem access

the url is still proxy/http://somehting

Hope this is the reason for the error.

As it is saying that the connection is refused by SAP with this URL.

Once you please clear the cache and check it.

Thanks,

Deepak.

former_member231869
Participant
0 Kudos

i clear the cache but still getting error.

former_member203031
Contributor
0 Kudos

instead of using proxy/http

Try with http://your URL

Thanks,

Deepak.

former_member231869
Participant
0 Kudos
former_member231869
Participant
0 Kudos

Previously it was working with proxy but i dont knw what happen it is giving now errors

former_member203031
Contributor
0 Kudos

Try by making the URL dynamic:

to get the dynamic URL please follow:

var origin  = window.location.origin

var my_url = origin+"/sap/opu/odata/sap/Zdemo_pr+srv"

Thanks,

Deepak.

Answers (0)