on 04-23-2014 7:45 AM
Hi,
I am trying to upload an image of .jpg format from a mobile app to my database. We have used phone gap api to access the image from phone gallery and we are using FileTransfer() method to upload the image.
This works fine when we are directly connecting to NW Gateway and we are able to see the image uploaded on gateway but when we try the same thing with SMP as middleware between Device and Gateway we get 401 - UNAUTHORIZED error.
Can anyone provide some inputs on this and if any documents to be referred.
The code I have used is shown below is for Uploading :
Thanks in Advance Friends....
Hi,
If you are using the REST API for onboarding and connecting through SMP you need to add the Application Connection ID as well to be authorized.
X-SUP-APPCID
If the FileTransfer of Phonegap still fails (i.e it might not have the cookies you require) you can send the data as a base 64 encoded string instead.
BR
Njål
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for responding.
I tried using the X-SUP-APPCID, but this time in device logs it initially shows as uploading and once the complete data is sent I get the response code as 401 and in response headers I get 401 Unauthorized and it goes into my error function of File Transfer.
The headers which i am passing :
uploadCreate has my APPCID.
var headers = {
"X-Requested-With" : "XMLHttpRequest",
"Content-Type" : "application/atom+xml",
"DataServiceVersion" : "2.0",
"Accept" : "application/atom+xml,application/xml,application/atomsvc+xml",
"X-CSRF-Token" : "Fetch",
"X-SUP-DOMAIN" : "LntOdDomain",
"X-SUP-APPCID" : uploadCreate
};
params.username = uid123;
params.password = pwd123;
params.headers = headers;
Hi Samanth,
correct me if i am wrong, since you are using phoneGap API that means your development is for hybrid app and SAP as backend.
Is this MBO based app or OData based app?
Rgrds,
Jitendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.