Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8594

Unable to Programatically Call Gateway OData Services from AppBuilder

$
0
0

Hello Experts,

 

I'm facing a problem while trying to read OData service programmatically. for eg: OData.read() or odataModel.read() functions.

IDE being used is SAP AppBuilder 1.0.

 

There is no problem, if the service is being called in the SuperList control.

 

When it is being read from code, the following error is returned in the response.

 

{"message":"HTTP request failed","request":{"requestUri":"http://abcd.xyz.com:8055/sap/opu/odata/sap/Z_ABC_SRV/PurchaseOrderSet('4500000042')","headers":{"Accept-Language":"en-us","Accept":"application/json","MaxDataServiceVersion":"2.0","DataServiceVersion":"2.0","proxy":"true"},"async":true,"user":"username","password":"passwd","withCredentials":false,"recognizeDates":false,"callbackParameterName":"$callback","formatQueryString":"$format=json","enableJsonpCallback":false,"inferJsonLightFeedAsObject":false,"method":"GET"},

"response":{"requestUri":"http://abcd.xyz.com:8055/sap/opu/odata/sap/Z_ABC_SRV/PurchaseOrderSet('4500000042')","statusCode":0,"statusText":"","headers":[],"body":""}}

 

 

Source code is as follows:

 

var ServiceURL = "http://abcd.xyz.com:8055/sap/opu/odata/sap/Z_ABC_SRV/";

var odataModel = new sap.ui.model.odata.ODataModel(ServiceURL,true,"username","passwd");

sap.ui.getCore().setModel(odataModel);

 

odataModel.read("PurchaseOrderSet('"+this.selectedPo+"')",

                        null,

                        null,

                        true,

                        function(oData, oResponse){

                            alert(JSON.stringify(oResponse));

                        },

                        function(oError){

                                alert(JSON.stringify(oError));

                        }

            );

 

 

Regards,

 

Anish


Viewing all articles
Browse latest Browse all 8594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>