on 03-26-2012 11:12 PM
Greetings
I am in the process of writing an iOS native application that accesses the FlightData OData service running on NW Gateway through SUP 2.1 (ESD #1)
I am able to enumerate the top level collections and display them on the device. I am able to run queries (like GetAvailableFlights).
But I am unable to create a new booking object and add it to BookingCollection. I have tried using various client scenarios.
- SUP client from IOS.
- Direct HTTP Post to the service URL (from command line using curl. From a .dot client).
I am always getting errors.
Do I have to enable something on the gateway to accept updates? (I get 401 permissions error from my .net client. Though it doesn't appear so in the $metadata, can this collection be read only?)
Any help with how to proceed? Any sample code will be much appreciated.
thanks
pj
Hi there,
Some checklists 🙂
/sdata/ indicates the service is made with old Generic Channel API. /odata/ indicates a new & recommended OData Channel API based.
/sdata/ requires http header "X-Requested-With=XMLHttpRequest" for both HTTP POST(Create) and PUT(Update).
/odata/ requires http header "Content-Type=application/atom+xml;type=entry" AND "X-CSRF-Token=<token value>" for both HTTP POST and PUT. The X-CSRF-Token value needs to be fetched by "X-CSRF-Token=Fetch" in the previous http call. The value will not change in the same app session. It is a new security enhancement on NW GW SP3 for a well known Cross-site request forgery.
Hope this helps to move forward...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kenichi
Thanks for your reply.
This is the URL of the service I am connecting to.
http://nplhost:8042/sap/opu/sdata/IWFND/RMTSAMPLEFLIGHT/
It does say 'sdata'. Here is what I see in the 'show version info' in SAP Management console.
/usr/sap/NPL/DVEBMGS42/exe/sapstartsrv 720, patch 80, changelist 1226580, optu (Feb 13 2011, 20:06:57), linuxx86_64 2011 02 13 12:59:41
I take it I am using older version of NW Gateway demo server?
I will try the http headers you suggested and update.
thanks
pj
Hi PJ,
As far as I remember there is single collection which supports all operations (GET/PUT/POST/DELETE) in RMTSAMPLEFLIGHT for "sdata" URL.
GET--> All collections
PUT-->TravelAgencyCollection
POST--> BookingCollection and SubscriptionCollection
DELETE--> BookingCollection and SubscriptionCollection
When you do PUT/POST/DELETE operations you need to send the below headers
X-Requested-With = XMLHttpRequest
Content-Type = Application/atom+xml
Regards
Rohith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
The above two things I have confirmed my URL contains oData and I tried to it from Chrome Rest client , I am getting CSRF token and with that token I was able to update the entity but I am not able to update fetch it via SUP oData .Actually there was recent upgrade in our landscape where in our Unwired Server has been upgraded to 2.2 version but our sybase SDk is of version 2.1.2, please share your views.I have opened a new thread in , can you have a look at it and provide your views.
Thanks
Santosh Varada
If you're working on eclipse plugin kit provided by the sybase unwired workspace, you would need to update a whole sdk set but if you're working with other 3rd party libs (such as the ones available at www.odata.org), you could replace a portion of libs.
Hi Varada,
You can use android plugin with latest eclipse(details available at developper.android.com). You can pick the ODP libs which comes as part of SDK installer and use them in the android workbench directly. No need to use workspace.
I belive, you are new to android-SUP. You can refer to the guide http://scn.sap.com/docs/DOC-23532
Regards
Rohith
Hi Rohit
Yes,it is a nice document very much helpful , I have referred the document initially to configure the applications in SCC.I was able to work before the up gradation, but all of a sudden my code stopped working , then I realized that upgrade could be issue.Still yet to confirm ,now I am trying to get the 2.1.3 oData- Android jar files ,I will replace them and test my application once I upgrade the SDk.I will keep you posted and will come back if any help needed.I hope I will come with positive note here.
Thanks
Santosh varada
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.