Quantcast
Channel: SCN : All Content - SAP for Mobile
Viewing all articles
Browse latest Browse all 6147

Detail structure in Flight object "lost" with Offline odata?

$
0
0

Heya,

 

I have been working a bit on creating an offline Kapsel App on and off in my spare time.

However I have run into some strange things regarding my data when working through the Offline Store.


Take for example the standard Flight Odata example service.

I have mapped it from the SAPES1 environment to my trial HCPms system and made a quick app through the Web IDE.

I have extended that app to use the offline store:

 

In short:

var properties = {

                    "name": "AirlinesOfflineStore",

                    "host": appContext.registrationContext.serverHost,

                    "port": appContext.registrationContext.serverPort,

                    "https": appContext.registrationContext.https,

                    "serviceRoot" :  appContext.applicationEndpointURL,

                    /*

                    "customHeaders" : {

                             "X-SMP-APPCID" : pplicationContext.applicationConnectionId

                    },

                    "streamParams" : "custom_header=Authorization: Basic " + btoa('username:password') + ";",

                    */

                    "streamParams" : "custom_header=Authorization:Basic " + appContext.Authorization + ";custom_header=X-SMP-APPCID:" +  appContext.applicationConnectionId + ";",

                    "definingRequests" : {

                        "FlightsDR" : "/FlightCollection",

                        "CarriersDR" : "/CarrierCollection",

                    }

                };

 

Now I expect that my standard Master Detail App, still shows my Flights as I had them before I used it through the store.

However where I bind data from the FlightDetails part of a Flight, the text is lost.

 

Through debugging I discovered that when I log my object to the console. My object according to iOS has the following structure:

----------------------------------

[Log] Object (console-via-logger.js, line 173)

CURRENCY: "USD"

FlightCarrier: Object

PAYMENTSUM: "53747.31"

PLANETYPE: "A310-300"

PRICE: "422.94"

SEATSMAX: 280

SEATSMAX_B: 22

SEATSMAX_F: 10

SEATSOCC: 112

SEATSOCC_B: 8

SEATSOCC_F: 3

__metadata: Object

airportFrom: "SFO"

airportTo: "JFK"

arrivalTime: "PT17H21M0S"

carrid: "AA"

cityFrom: "san francisco"

cityTo: "NEW YORK"

connid: "0064"

countryFrom: "US"

countryTo: "US"

departureTime: "PT9H0M0S"

distance: "2572"

distanceUnit: "SMI"

fldate: Fri Apr 24 2015 02:00:00 GMT+0200 (CEST)

flightBookings: Object

flightDetails: Object

flightTime: 321

flightType: ""

flightbooking: Object

period: 0

__proto__: Object

--------------------------

 

All the details have transferred to the main object if you compare it with the XML from the SAPES1 server:

 

----------------------------

<contenttype="application/xml">

 

<m:properties>

 

 

<d:flightDetailsm:type="RMTSAMPLEFLIGHT.FlightDetails">

 

 

     <d:countryFrom>US</d:countryFrom>

 

     <d:cityFrom>new york</d:cityFrom>

     <d:airportFrom>JFK</d:airportFrom>

     <d:countryTo>US</d:countryTo>

     <d:cityTo>SAN FRANCISCO</d:cityTo>

     <d:airportTo>SFO</d:airportTo>

     <d:flightTime>361</d:flightTime>

     <d:departureTime>PT11H00M00S</d:departureTime>

     <d:arrivalTime>PT14H01M00S</d:arrivalTime>

     <d:distance>2572.0000</d:distance>

     <d:distanceUnit>SMI</d:distanceUnit>

     <d:flightType/>

     <d:period>0</d:period>

</d:flightDetails>

<d:carrid>AA</d:carrid>

<d:connid>0017</d:connid>

<d:fldate>2014-09-10T00:00:00</d:fldate>

<d:PRICE>422.94</d:PRICE>

<d:CURRENCY>USD</d:CURRENCY>

<d:PLANETYPE>747-400</d:PLANETYPE>

<d:SEATSMAX>385</d:SEATSMAX>

<d:SEATSOCC>372</d:SEATSOCC>

<d:PAYMENTSUM>192014.98</d:PAYMENTSUM>

<d:SEATSMAX_B>31</d:SEATSMAX_B>

<d:SEATSOCC_B>30</d:SEATSOCC_B>

<d:SEATSMAX_F>21</d:SEATSMAX_F>

<d:SEATSOCC_F>20</d:SEATSOCC_F>

</m:properties>

</content>

 

----------------------------------

 

Am I perhaps missing a parameter or so anywhere to retain the structure?

 

If I bind something to {airportFrom} instead of {flightDetails/airportFrom} it now works with the store, ofcourse without the store it does not.

 

Noteworthy information to add:

Using SMP 3.0 SDK SP07 (had this issue with SP06 as well) and SAP HCPms (current version )


Thanks in advance,

 

Vincent


Viewing all articles
Browse latest Browse all 6147

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>