Switching between SAP and direct-to-NW Gateway with MAF Logon
I frequently program directly against a NW Gateway when I’m starting or prototyping, then add SMP to the landscape, once the application is fleshed-out, and I want to add offline functionality. This has tended to be when I add MAF Logon to the app in the past.
With the simple bootstrapping with Cocoapods, and the reusable STSOData framework, I get MAF Logon for free from the start. Great, I like it, and I especially like using the new Discovery Service on-boarding to auto-import my connection settings from the cloud. Using the STSOData framework’s LogonHandler, I set the application’s applicationID from in the AppDelegate -applicationDidBecomeActive: method.
[[LogonHandler shared].logonManager setApplicationId:@”stan.flight.https”];
The applicationID should match the applicationID in the SMP Admin console.
But today, my SMP system is being re-installed by QA, and I can’t afford the down-time. How do I switch back to connecting directly-to-NW Gateway?
I don’t want to change anything in the application. I know that I won’t be able to use the offline features without SMP, but I can toggle that off in the STSOData DataController. What should I do?
The easiest way to switch back to directly-to-NW Gateway, after working with SMP, is by changing the applicationID value set above.
The Solution
MAF Logon constructs the connection URL from the protocol/host/port parameters, then appends the applicationID to the url path. So, these settings:
MAF Logon settings:
host: smpqa12-01.sybase.com
port: 443
protocol: https
Programmed in app:
applicationID: stan.flight.https
are concatenated into this URL: https://smpqaXX-XX.sybase.com:443/stan.flight.https/. This is the base URL that the SODataStores use for querying $metadata, Collections, FunctionImports, etc. when connecting via my SMP server.
My NW Gateway system has this URL: http://usxxxx21.xxx.sap.corp:8000/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/. I can use the same inputs between MAF Logon, and the applicationID, by swapping in the OData application path components for the SMP applicationID, to produce the URL: http://usxxxx21.xxx.sap.corp:8000/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT/.
I accomplish this by changing the value when I set the applicationID on the LogonHandler, as above:
//[[LogonHandler shared].logonManager setApplicationId:@”stan.flight.https”];
[[LogonHandler shared].logonManager setApplicationId:@”sap/opu/odata/IWFND/RMTSAMPLEFLIGHT”];
Do not append a forward-slash “/” to the ‘applicationID’ value when substituting the OData application path components; the application is already adding the slash for the regular SMP applicationID value.