on 10-28-2012 2:42 PM
Hi All ,
We have SAP NW gateway setup at our end .We have cracked the part of consuming odata services exposed by GW directly in iOS app using sap nw dev tool for xcode .
we want to know how to consume these services via SUP.what is the configuration to be done at sup level ( project ) , changes to be done on front end side .Developer guide for odata sdk 2.1.2 gives you an overview of the configuration to be done .Methods are listed but there is no clarity what is to be done where .
It would be great to find in depth documentation with code sample ( tutorial ) .
Thanks ,
Amit Nalawade.
Hi Amit,
Regarding the generated proxy or starter kit that you got from the tool, the code already handles SUP connectivity for you. You need to add the respective iOS library that comes with SUP to your project and un-comment some code lines. Refer to the following sections in the documentation for more detailed steps:
For SUP configuration, checkout this blog post under CONFIGURE SUP section. Basically you need to add a new application configuration, configure the URL to the Gateway service and attach a security configuration.
Thanks,
Guy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guy ,
Thanks for the information .
When going via SUP we do not have to do any configuration at workspace ( unwired platform ) level ?
Also as the document mentions configuration to be done on SCC , we have to register an application connection and enter app endpt gateway url in proxy settings .
What is the application id to be specified while registering , since we have not deployed anything to sup server .
Hi Amit,
I'm not aware of any workspace configurations you need to do. Basically you configure SCC and then use these settings in the generated app (App ID, Security Configuration, SUP Host/Port/Farm...).
When you register your application on SCC, you can set the App ID to any string you like.
Hi Guy ,
I have setup the generated project by nw tool to consume my service via sup as per the documentation shared by you .
I am trying to login with Gateway credentials / sup credentials but i am getting login failed error .
Exact error from console :-
With Gateway Credentials :-
MessagingClientException:/Location:-[LiteSUPUserManager registerUser:withSecurityConfig:withPassword:] + 349
2012-10-30 14:27:46.020 odatanew[38599:4c0b] MMS Authentication Failed
With Sup Credentials :-
2012-10-30 14:40:50.648 odatanew[38769:1d03] Error getting service document. Login failed.
Any idea on this front ?
Thanks ,
Amit .
Message was edited by: Amit Nalawade
Hi Amit,
The tool's generated code supports only auto-registration for SUP user. That means you shouldn't use a user which is already defined in SUP. When the code will execute, this user will be automatically created on SUP. On any code change which involves SUP, reset the simulator (Reset Content and Settings) cause the SUP code has persistence.
Try with a simple Security Configuration of type HttpAuthenticaionLoginModule and set there the URL to your Gateway service (same URL you used for the app definition in Proxy Settings). At runtime, use only the Gateway username and password.
Hi Amit,
Nice to hear that it eventually worked for you!
Regarding your questions:
Thanks,
Guy
Hi Guy ,
I am Working on CUD operations using oData-SAP NW Gateway .
I am adopting below style of coding from sample code to create records using my service .
Creating New Instance and setting params :-
Booking *newBooking = [[Booking alloc] init];
newBooking.carrid = @"<carrier_ID>";
newBooking.PASSNAME = @"<passenger_name>";
…
Flight *associatedFlight = [[Flight alloc] init];
associatedFlight.connid = @"<flight_number>";
associatedFlight.carrid = @"<carrier_ID>";
…
newBooking.bookedFlight = [NSMutableArray arrayWithObject:associatedFlight];
Fetching CSRF cookie :-
NSError *error = nil;
NSString *xml = [service getXMLForCreateRequest:newBooking error:&error];
CSRFData *csrf = [connectivityHelper getCSRFDataForServiceQuery:service.serviceDocumentQuery];
if (csrf) {
id<SDMRequesting> request = [connectivityHelper executeCreateSyncRequestWithQuery:
service.bookingCollectionQuery andBody:xml andCSRFData:csrf];
newBooking = [Booking parseBookingEntryWithData:request.responseData error:&error];
}
I am able to fetch csrf cookie and there are no errors thrown during execution of above code for my service , but i cannot see any records getting created .
What am i missing here , does the order in which we set params matter ?
Thanks ,
Amit Nalawade.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
The sample code you've included is an example of Deep Insert. This means that you create Booking and Flight items in one call. This functionality should be supported by your service, else it won't work. So first check that.
When you're saying that you can't see any records created, do you mean that you checked them on the backend system? I'm asking in order to understand whether it's a client issue and not server.
Try to debug the code and check what do you get in request.responseData. Note that some services do not return the newly created item when you execute create operation but the record is created on the backend system.
In addition, try to test the service using a REST client and mimic your call (you would need to set the CSRF token and the XML itself).
Thanks,
Guy
Thanks Guy for quick reply .
I was able to get through create part .
While updating an existing entry i am getting below messages in the logs .
ERROR :: 405:Method Not Allowed/Location:-[SUPRequest startSynchronous]
ERROR: Exception during parsing response data. Error: The document is not a valid data document File .
The specified HTTP method is not allowed for the resource identified by the Data Service Request
Do we have to call a read explicitly before updating any entry .
Thanks ,
Amit Nalawade.
hello guy..
I am able to consume OData services without SUP.Now i am trying to consume OData via SUP, I followed all the above suggestion and done the required configuration in SCC.I can see my device registered in the SCC. But I am facing the following error after login in.
2012-12-10 15:03:06.756 profitabilityanalysis[77425:1e03] ERROR :: 71002:*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array/Location:-[SUPRequest startSynchronous] + 1222
2012-12-10 15:03:06.762 profitabilityanalysis[77425:1e03] Error getting service document. Login failed.
Hi,
I am facing the same issue. I have an app which works correctly using the SAP Net weaver Gateway and now i am trying to get the app to work through SUP.
I followed the blog http://scn.sap.com/community/icc/blog/2012/01/16/developing-mobile-apps-with-sybase-unwired-platform... but was no success.
I am curious about how the SUP server authenticates to Gateway System.
Here are the couple of lines of the log i get in xcode. "Man" is my security configuration and it seems like the username and password was not propagated.
2013-02-28 15:36:45.761 testingsup[6683:1d603] ERROR :: 1053:Error: 401 Message: MessageChannel error [Login Failed: user '(null)@Man']/Location:-[SUPRequest startSynchronous] + 1085
2013-02-28 15:36:45.761 testingsup[6683:1d603] Error getting service document. Login failed.
I used the HTTPAuthenticationLoginModule but it doesn't have an option to pass the username and password to SAP gateway. ( I did try the NoSecLoginModule and it didnt work as well)
Then i navigated to the connections in SCC and when i try to ping to my service doc url i get an Endpoint test result: Unauthorized. I put the a valid pair of username and password and tried again and it was the same which is quite strange.
Any help would be greatly appreciated.
Thanks,
Yohan
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.