Skip to Content
0
Jan 19, 2017 at 02:55 AM

Upload SignaturePad Image to SAP using OData request

457 Views

Hello,

I have implemented SAPUI5 signature pad and sending image(signature content) to SAP. My issue is passing signature pad image data to SAP using OData.request Post method.

I am stuck at below step 2. I will really appreciate if you can provide some guidance.

Step 1 - I am able to get signature pad image data(content) and attached is copy of content looks like.

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAACWCAYAAADwkd5lAAAdnklEQVR4Xu2dB6wVxffHhyY+FFBRs

Step 2 - Sending Image data to SAP using OData.request post method . In SAP

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_STREAM class method I am only receiving IS_MEDIA_RESOURCE-mime_type I am not able to get

IS_MEDIA_RESOURCE-value. Below is my OData call logic.

var sgnurl = sap.ui.getCore().byId("SignatureImage").getSrc();

OData.request({
requestUri: "/sap/opu/odata/sap/ZZxxxxxxxxxx/xxxxxSet",
method: "POST",
headers: {
"X-Requested-With" : "XMLHttpRequest",
"Content-Type" : "application/atom+xml",
"Content-Type" : "image/png", //"image/jpeg",
"slug" : "image/png",
"DataServiceVersion" : "2.0",
"Accept" : "application/atom+xml,application/atomsvc+xml,application/xml",
"X-CSRF-Token": header_xcsrf_token,
},
Data: sgnurl
},
function(data, response) {
alert("OData call success");
},
function(err) {
alert("OData call Error");
});

Attachments

getsignature.txt (10.2 kB)