Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

How to submit multiple information in one request - having issues in passing data

$
0
0

Hello Everyone,

 

I tried creating a service that use Deep entity to post some data to SAP. That works well from test service option, but when i am trying to code from java script it is failing and getting" Http Request failed "

 

Following is the snippet i use for my testing to pass the data, is there anything wrong with my passing of parameters, please suggest.

 

 

var itemO = [{ID:24, Name:"xyz"}, {ID:45,Name:"tze"}];

var itemT = [{ID:24, Name:"xyz"}, {ID:45,Name:"tze"}];

var head = [{ID:24, Name1:"xyz", Name2:"abc"}];

 

 

var headerCont = [{Header:head, HeadItemT:itemT, HeadItemO:itemO}]

 

alert(requestUri);

var request = 

{ headers: {"X-Requested-With": "XMLHttpRequest", 

                "Accept": "application/atom+xml,application/atomsvc+xml,application/xml", 

                "Content-Type": "application/atom+xml", 

                "DataServiceVersion": "2.0" }, 

requestUri: requestUri, 

method: "POST", 

user: "user123", 

password: "welcome", 

data: headerCont }; 

 

 

// Send the request and define callback methods.

 

 

OData.read(

 

 

requestUri,

 

 

function (data) {

 

var html = "";

 

for (var i = 0; i < data.results.length; i++) {

 

 

alert("Hello" + data.results[i].ID;

 

 

}

 

 

document.getElementById("container").innerHTML = html;

 

},

 

 

function (err) {

 

alert("Error occurred " + err.message);

 

 

}

 

 

);

 

 

}


Viewing all articles
Browse latest Browse all 2823

Trending Articles



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