S60 & Web Services

symbiatch - 17.06.2008 12.19 - mobiili ohjelmointi 

Tulipahan sitten tarve tehdä softaa käyttäen web servicejä. Varauduin pahimpaan (kuten aina Symbianin kanssa on hyväksi), mutta käyttö ei ollutkaan niin tuskaista kuin oletin. Käytin ensimmäistä kertaa Symbian 9:n soap-funktioita ja ihan kivastihan se toimi. XML menee ulos ja tulee sisään.

Sitten kun pitikin hakea 260 kilotavua XML:ää palvelimelta tuli tenkkapoo. Halusin käyttää DOMia (tiedän, se ei ole aina järkevää, mutta olisi kiva edes testivaiheessa voida tehdä asiat helposti), mutta emulaattorissa 64 megankin muisti loppui kesken heti. Koodasin oman hieman riisutun DOM-rakenteen ja muisti loppui silti. Ja vaikka testiksi heitin kaikki tekstiarvot roskiin, muisti loppui vieläkin. Eli ei DOMia. Nyt sitten pitää kärsiä SAXimisen kanssa ja parsia sillä dokut tilakoneen kanssa. Yyh. Ja pahin dokumentti on 10 megaa vieläpä...

Tekisi niin mieli tehdä välipalikka joka riisuisi kaiken turhan noista hauista pois, mutta en haluaisi pakottaa ihmisiä asentamaan operatiivisiin järjestelmiin taas yhtä palikkaa vain siksi että saisivat käytettyä softaa. Joten kärsin keskenäni.

Joku voisi tietysti kysyä miksen käytä Nokian tarjoamaan palikkaa joka tekee koodia WSDL:stä. No tietysti siksi että kyseinen palikka on täysin rikki. Se osaa kyllä perus-helloworldit vääntää, mutta nyt on kyseessä oikeat hommat ja palikka poksahtaa heti. WSDL:ssä ei vikaa ole. gSoap olisi toinen vaihtoehto mutta käsitin että lisenssi rajoittaisi hieman. Joten käsin tekeminen lienee fiksuinta.


Tarkistin vielä toisen kerran että olinhan säätänyt MMP:ssä keon maksimikoon isoksi. Eipä se asetus siellä ollut vaikka sen tungin. Nyt kun on 16 megan keko alkaa homma hieman pelatakin. Pitäisi vielä testata onko oma DOM-toteutus miten paljon vähemmän muistia kuluttavampi kuin Symbianin toteutus niin tietäisi kannattaako käyttää vai ei.

Silti tuo 260 kilotavun dokumentti ei näköjään mahdu muistiin, seuraavaksi 32 megaa :P

Got a need to create an application that uses web services. I was prepared for the words (as one should be with Symbian) but the process wasn's as painful as I thought. This was the first time I ever used Symbian 9's soap functions and they worked nice. XML went out, XML came in.

Then I had to get a 260kB XML document from the server and everything blew up. I wanted to use DOM (I know, it's not always sensible but I wanted to do things the easy way in the beginning) but the emulator ran out of memory even with 64MB. I created my own limited DOM system but even that ran out of memory. Then I tested removing all text nodes, still out of memory. So no DOM, I have to SAX everything and suffer with state machines etc. Eww. And the worst document is 10MB...

I'm very tempted to create a middle layer that would strip all unnecessary things out of the XML but I don't want to force users to install a new service to their operative systems just to be able to use the application. So I'll suffer.

One might ask why I don't use Nokia's tool that creates code from the WSDL. Naturally because it's broken. It can convert basic hello world services ok but now I needed something real-woldy and it crashes immediately. WSDL is ok, that's not the problem. gSoap would be another possibility but I think the license would be restrictive. So the only sensible way is to do everything by hand.


I checked for second time that I had set the maximum heap size in the MMP file. The setting wasn't there, I'm sure I put it there previously. The heap size is now 16MB and things work better. Next thing is to see how much less memory my DOM implementation uses in comparison to the Symbian one. Then I'll know if I should use my own or Symbian's.

Still the 260kB document won't fit in memory. Next, 32MB :P

Lue kommentit (1) | Kommentoi

 
Jutut.fi  |  Omat jutut  |  Muiden jutut  |  Kategoriat  |   kirjaudu