favornokia

nokia最新手机  时间:2021-02-28  阅读:()
D.
KaeliandK.
Sachs(Eds.
):SPECBenchmarkWorkshop2009,LNCS5419,pp.
439–450,2009.
Springer-VerlagBerlinHeidelberg2009DesigningWeb-BasedMobileServiceswithRESTClaudioRivaandMarkkuLaitkorpiNokiaResearchCenter,P.
O.
Box408,FIN-00045NOKIAGROUP,Finland{claudio.
riva,markku.
laitkorpi}@nokia.
comAbstract.
TheWebisemergingasthefavoriteplatformfordeliveringapplica-tionsandservices.
TheRESTarchitecturalstylecomprisesthekeyprinciplesbehinditsdesignandsuccess.
WhileRESTisoriginallydefinedinthecontextofpublishinghypermediadocuments,itisbecomingapopularmethodforim-plementingWebservicesaswell.
Thegoalofthispaperistoexploretheprin-ciplesoftheRESTstyleforbuildingmobileservicesandtoaddressthemobilespecificconstraints.
Wepresentthedesignmethodthatwehavefollowedforbuildingabasicphotostorageservice.
OurpreliminaryevaluationconfirmsthatRESTisaflexibleandextensibleapproachforbuildingmobileservices.
Keywords:Softwarearchitectures,mobileservices,serviceorientedarchitec-tures,weborientedarchitectures,REST.
1IntroductionNewcompellingmobileservicesareexpandingthecapabilitiesofmobiledevicesbesidesthetraditionalservicesofvoiceandshortmessaging.
Nowadaysmodernmo-biledeviceshavebuilt-insupportforseveralmobileserviceslikewebbrowsing,mo-bileemail,mobilesearch,photosharing,newsreaders,internetradioandnavigation.
ThepromiseofthemobileInternetisturningintorealityformanyconsumers.
Insomecases,themobileservicesaretightlybundledwiththedevicesinordertomaximizetheiruserexperience,e.
g.
BlackberryResearchinMotion's(RIM)pushemailservice,NokiaN-GageArenaandNokiaS60'ssupportformobilesearchandphotosharingwithFlickr.
WiththeavailabilityoffastandconvenientmobileInter-net,weexpectthatmobileserviceswillrepresentasignificantvalue-addingelementoffuturedevices.
TheWorldWideWebisemergingasthefavoriteplatformfordeliveringapplica-tionsandservices.
TheWeb2.
0phenomenonisexploitingthewebbrowserasacross-platformruntimeenvironmentforshippingandexecutingapplications.
Special-izedlibraries(e.
g.
Ajax)andframeworks(e.
g.
RubyonRails)havebeendevelopedforfacilitatingthecreationofinteractivewebapplications.
TheWebisalsobecomingthepreferredplatformfordeliveringservicestothirdparties.
InternetcompaniesopentheirfunctionalityandtheirdatatotheexternaldevelopersthroughpublicinterfacesimplementedwithWebservices.
Thesepublicinterfaces,typicallycalledOpenAPIsorWebAPIs,arekeyenablersoftheWeb2.
0phenomenon.
440C.
RivaandM.
LaitkorpiTherearetwodominantparadigmsforcreatingWebAPIs,namelySOAP/WS-*andREST.
SOAPisanXMLbasedprotocolforexchangingmessagesoveracom-puternetwork,typicallytunnelingoverHTTP,andisthefoundationforthemorecomplexWebServicesstack,alsoknownasWS-*[10,11].
SOAPprovidesdifferenttypesofmessagingpatterns,buttheremoteprocedurecalliscommonlyusedwhenbuildingOpenAPIs.
ASOAPbasedOpenAPItypicallyprovidesasetofremoteoperationsthatcanbeinvokedovertheWeb.
REST(RepresentationStateTransfer)followsadifferentphilosophythanSOAPbyfocusingondatainsteadofoperations.
RoyFielding,oneoftheprincipalauthorsoftheHypertextTransferProtocol(HTTP)[2],coinedthetermREST1inhisdoctoraldissertation[1].
RESTisanarchitecturalstylederivedfromtheWeb,anditsarchitec-turalelementsandconstraintsaimatcollectingthefundamentaldesignprinciplesthatenablethegreatscalability,growthandsuccessoftheWeb.
RESTisoriginallyde-finedinthecontextofpublishinghypermediadocumentsbutithasbecomeapopularmethodforpublishingWebservicesasaWeb-friendlyalternativetoSOAP.
RESTisprimarilyfocusedondefiningandaddressingwebresources(likedocumentsandimages)andformanagingtheirrepresentations.
AlthoughthereisonlyoneversionofRESTdefined,itdoesnotmeanthateverysystemissupposedtobeequallyRESTful.
Therefore,theconstraintsofRESTshouldbetakenasatoolkitthathelpsthearchitectidentifythebenefitsorcosts,dependingonwhethertheactualrequirementsfittheconstraints.
ThegoalofthepresentresearchistoinvestigatehowtoapplytheprinciplesoftheRESTfuldesigntothedevelopmentofmobileservices.
Inparticular,ourfocusistoanalyzethebenefitsandlimitationsofRESTinamobilecontextandtoelaborateaproperdesignprocess.
DesigningRESTservicesisaboutmodelingresourcesthatarepublishedontheWebandthefunctionalityisimplementedwithalimitedsetofop-erationsonthoseresources.
Thedesignprocessresemblesthedata-drivendesignprocesses(e.
g.
fordatabases).
Inthispaper,wepresentourpreliminaryworkofde-signingRESTservices.
First,wepresentthekeyrationaleandconstrainsofRESTdesigninamobileenvironment.
Then,wepresentourdesignprocessandweapplyittothecasestudyofdesigningaphotostorageservices.
Finally,weconcludewithapreliminaryevaluation.
2MobileServiceswithREST:RationaleandConstraintsMobileservicesallowuserstoaccessnetworkservicesthroughtheuserinterfaceofamobiledevice.
Theyconsistofaclientapplication,theclientcomponentthatpro-videstheuserinterfaceonthemobiledevice,andaservicebackend,theservercom-ponentinthenetworkthatprovidestheremotefunctionality.
Theimplementationoftheclientapplicationheavilydependsonthecapabilitiesofthemobiledeviceandtheavailablerun-timeenvironments.
Often,themobilesoft-waredevelopermustspecializetheclientapplicationstothevariousclientsinordertotakefulladvantageofthedevicespecificfeatures[5].
Theclientapplicationalso1TherearedifferentinterpretationsofREST.
Unlessotherwisespecifiedinthispaperwerefertoatrulyresource-orientedapproach,oftenreferredasRESTful.
DesigningWeb-BasedMobileServiceswithREST441needstoefficientlyinteractwiththebackendinordertofetchthedatathatispre-sentedintheuserinterface.
Thereareseveralmotivationstodesignthebackendac-cordingtotheRESTstyle:Itprovidesauniformmethodforaccessingtheresourcesindependentlyoftherun-timeenvironment(native,Java,Python,etc).
AnyclientthatsupportstheHTTPprotocoliscapableofaccessingtheRESTserviceswithouttheneedofanyadditionalmessagingframework.
Therepresentationofaresourcecanbenegotiatedatrun-timebetweentheclientandtheserver.
Thisenablesustosupportmobileoptimizedvariantsofthere-sourcesaccordingtotheneedsofthedevice.
TheRESTprinciplesfavorscalabilityandfastresponsetimes(e.
g.
throughcach-ing).
Thisisanimportantpointformobileservicesthatpotentiallyhaveahugeuserbaseofbillionsofusers.
Scalabilityisoftenahardtoreachqualityifnotproperlyaddressedearlyinthedesign.
However,themobileenvironmentposesadditionalchallengesandconstraintsoverthetypicalRESTdesign.
Wesummarizethembelow:Networklatency:mobiledatanetworks(2G,EDGE,3G)areoptimizedforcon-tentdownload.
Thebandwidthisoftensufficientformostofthescenarios(likevideostreaming),butthenetworklatencyisstillamajorissue.
Eveniffuturenetworksbeyond3G(e.
g.
HDSPA,WiMAX)willminimizethisproblem,areli-ablemobileserviceshouldmakefewassumptionsabouttheunderlyingdatanet-work.
Optimizingforhighlatencynetworkisakeyrequirementforsuccess.
Theroundtriptimeforsendingarequestandreceivingaresponsecanbeashighastwoseconds.
Toavoidperformancebottlenecks,thenumberofmessageex-changeswiththeservermustbekeptattheminimum.
ThisrequirementisoftenconflictingwithRESTservicesdevelopedforlowlatencynetworks.
Dataformats:verbosedataformats(e.
g.
XML)areslowtotransferandtoparse.
Mobiledevicesrequirelightweightformats.
Compactbinaryformatsareoftentheoptimalsolutionbuttheycompromisetheserviceinteroperability.
Often,thetradeoffisbetweenaproprietaryoptimizationandaninteroperablestandard.
Cachingpolicy:toreducethenetworktrafficthemobileservicesmustcachethedataonthedevicememory.
Cachingcanhappeneitherattheprotocollevel(e.
g.
theHTTPresponses)orattheapplicationlevel(e.
g.
theactualdata).
Offline/onlinebehavior:irregularnetworkconnectivityistypicalformobiledevices.
Mobileservicesmustdefineastrategyforsupportingofflineoperations.
Thinvs.
thickclients:howmuchlogicresidesontheclientandontheserver.
3DesigningRESTServicesThecoreentitiesoftheRESTdesignarethewebresources.
TodesigntheAPIswefollowadata-drivendesignprocessthatstartsbymodelingthedomainoftheAPIs.
Inthefollowingsectionswedescribeourbasicdesignprinciples,thedesignprocessandthestructureoftheRESTAPI.
442C.
RivaandM.
Laitkorpi3.
1DesignPrinciplesThebasicarchitecturalstyleisRESTwiththeHTTP.
ThefunctionalityisdefinedintermsofresourcesthataremanipulatedviaHTTPasanapplicationprotocol.
Aresourceisanentitythathas:nameandaddressidentifiedbyaURI[3]onestateatatimedefinedbyasetofattributesandtheirvaluesatleastonerepresentationthatencodethecurrentstateinaparticularcontenttypeTheallowedactionsontheresourcesarebasedontheHTTPprotocolwiththefol-lowingsemantics:GET:retrievesarepresentationofaresource.
Thisoperationissafewithnochangesthataclientcouldbeheldaccountablefor.
PUT:rewritesaresourcewithanewstatethatisenclosedintherequest.
Thisop-erationisidempotent(requestcanbere-processedwiththesamefinalstate).
POST:appendstheentityenclosedintherequesttotheresource.
Anewresourcemightbecreated.
Thisactionreturnseitherthelocationofthecreatedresourceortheresourcerepresentationafterappending.
Thisoperationisnotidempotent.
DELETE:removesthemappingbetweenaresourceanditsURI,thusmakingtheresourceinaccessible.
Thisoperationisidempotent.
EachrequestisauthenticatedindependentlyusingthestandardHTTPauthorizationheader.
Hence,thereisnoneedforsessioncontrolandcookies.
TheaccesscontrolforaresourceisconductedattheURIlevel.
Concerningthedataobjects,wesupporttheexchangeoftwotypesofstructureddata:containers(e.
g.
acollectionofphotos)andsingleitems(e.
g.
animage).
Besidesthestandardcontenttypesformedia(MIMEtypes[6]),wesupportcontenttypesforstructureddatafordifferentapplications:ATOM(application/atom+xml):widelypopularXMLbasedformatforblogsandmash-ups[7,8]JSON(application/json):lightweightformatforstructureddata[9]binaryJSON(application/x-bjson):ourownextensiontoJSONformattosupporttheexchangeofbinarydata.
WealsodefineadecorationmechanismforclientstocontroltheexactcontentofthemessagebodyoftheHTTPresponses.
IntheheaderoftheHTTPrequest,wecanaddacustomheadercalledx-decorationsthatcontainacommaseparatedlistofdecorationstobeappliedtotheresponse.
Wehavedefinedthefollowingdecorations:xlink-id:addbasicidentifierlinkstoobjectsxlink:addsallavailablelinkstoobjectsitem(id|summary|full):controlstheverbosityoftheitemswhenlistedinacontainerinline()=:outputsanoptimizedresponsethatincludestheassociateddatainonesinglerequest-responsecycle.
TheoutputDesigningWeb-BasedMobileServiceswithREST443formatdependsonthecontenttypeoftheresource.
ForJSONandXMLweusemultipart/related,forbinaryJSONandATOMweinlinethedatainplace.
Thecanbeanyoftheallowedcontenttypesofthelinkedre-source(e.
g.
image/jpg).
Thecanbeanyofthelinknamespub-lishedbytheresource(e.
g.
tn_tiny)3.
2DesignProcessDesigningRESTservicesinvolvemodelingwebresourcesandtheirURIs.
Therefore,wefollowadata-drivenapproachthatissummarizedinthreesteps:1.
Developingtheabstractdatamodel.
ThefirststepistoidentifytheconceptsandtheirassociationsthatarepartoftheAPI.
Forthistask,wefollowthetraditionaltechniquesofobject-orientedanalysisanddesign,focusingonalltherelevantnounsintheproblemdomain.
2.
Derivingthecoreresourcemodel.
Basedontheabstractdatamodel,weidentifytheprimaryresourcesoftheRESTdesign,i.
e.
thecentralconceptsoftheAPI.
Wedistinguishbetweentwotypesofresources:containers(collectionsofitems)anditems.
Besidestheprimaryresources,wecanalsoidentifythesecondaryresourcesthatcanbeaccessedfromtheprimaryresourcesthroughtheirassociations.
3.
DesigningtheURIspaceoftheAPI.
ThefinalstepistodefinetheURIspaceoftheAPI.
ForeachresourcewedefinetheURI,allowedmethods,contenttypes,andlinkstootherresources.
ThestructureoftheAPIisdescribedinthenextsection.
3.
3APIStructureThestructureoftheAPIisdocumentedusingfourelementsthataredescribedbelow:URIspace.
Eachresource(eitheracontaineroranitem)isaddressedbyoneURI.
Thenamecontainmentimpliesstrongsub-resourcerelationship.
Weusethefol-lowingsyntax:.
.
///where::encodestheowneroftheresource,suchasuser"john":encodestheprimaryresource,suchas"pho-tos"or"photo":encodestheassociationsfromtheprimaryresources,suchas"tagsofaphoto":querystringformultidimensionalprojections.
Methodsandcontenttypes:thisdescribestheavailableinteractionsonthere-sourcesandthesupportedcontenttypesLinks:traversableconnectionsfromoneresourcetoanother.
Itisacombinationofaname(semantics)andaURI(concreteaddress)Representations:actualdatacontentoftheresource444C.
RivaandM.
Laitkorpi4ExampleofRESTAPIforPhotosAsacasestudywehavedesignedthepotentialRESTAPIforaphotostorageservice.
Theserviceshouldprovidethefunctionalityforuploadingnewphotos,taggingthem,organizingthemintofoldersandassigningproperties.
Therearemanysimilarser-vicesontheWebthatprovideanAPIforstoringphotos:Flickr2andSmugmug3asexamples,buttheyareclearlyoperation-centricandonlyaccidentallyRESTful.
ThegoalofourcasestudyistodesignaphotostorageservicethatfollowstheRESTprin-ciplesandisusablefrommobiledevices.
Wedescribethedatamodel,thelistofwebresourceandseveralusecasestoaccesstheservice.
4.
1DataModelTheFigure1showsthesimpledatamodelforthephotostorageserviceandtheirattributes.
Wehaveincludedthefollowingconcepts:User:theauthenticateduserofthesystem.
EachuserhasauniqueloginnamePhoto:thedataobjectforaphoto.
Eachphotohasauniqueid.
Bag:auser-specificlabelforgroupingphotoobjectsinalbumsTag:apubliclydefinedlabelthatcanbeassociatedtoaphotoobjectContent:theactualbinaryrepresentationofthephoto(e.
g.
thejpgfile)Attr:anattributethatassignsavaluetoapropertyProp:apropertydefinitionwithsemantics,definedbyascopeandaname.
Tn:thebinaryrepresentationofathumbnailofaphoto.
Attr-prefix-nameBag-nameContentTag-nameTn-sizeUser-loginnamePhoto-idProp-prefix-name1*1***111*1****1Fig.
1.
AbstractdatamodelofthePhotoAPI4.
2CoreResourcesFromthedatamodelwecandirectlyderivethecoreresourcesoftheRESTAPI.
Belowwelistthecoreresources:PrimaryresourcesContainers:Photos,Tags,Bags,PropertiesItems:Photo,Tag,Bag,PropertySecondaryResourcesContainers:Thumbnailsofaphoto,Attributesofaphoto,Tagsofaphoto,BagsofaphotoItems:Content,Thumbnail,Attribute2http://www.
flickr.
com/services/api3http://www.
smugmug.
comDesigningWeb-BasedMobileServiceswithREST4454.
3APIStructureBasedonthecoreresourcemodel,wedefinethestructureoftheURIs.
Table1liststheURIsoftheresourcesandTable2documentsthesemanticoftheHTTPactions.
Table1.
StructureoftheAPIforPhotosURIOwnershipPrimaryprojectionAssociationDescriptionPhotos/users/{name}/photosPhotosforuser{name}(container)/users/{name}/photos/recentRecentphotosfor{name}(container)/users/{name}/photos/{photo-id}Photoitem/users/{name}/photos/{photo-id}/contentPhotocontentof{photo-id}/users/{name}/photos/{photo-id}/tns/tinyPhotothumbnail(50x50)/users/{name}/photos/{photo-id}/tns/smallPhotothumbnail(100x100)/users/{name}/photos/{photo-id}/tns/mediumPhotothumbnail(200x200)/users/{name}/photos/{photo-id}/tns/largePhotothumbnail(400x400)/users/{name}/photos/{photo-id}/tns/custom/{xsize};{ysize}Photothumbnailxsizexysize/users/{name}/photos/{photo-id}/attrsPhotoattributesfor{photo-id}(con-tainer)/users/{name}/photos/{photo-id}/attrs/{attr-prefix}/{attr-name}Photoattribute/users/{name}/photos/{photo-id}/tagsTagsfor{photo-id}(container)/users/{name}/photos/{photo-id}/tags/{tag-name}Phototag/users/{name}/photos/{photo-id}/bagsBagsfor{photo-id}(container)/users/{name}/photos/{photo-id}/bags/{bag-name}PhotobagTags/tagsAlltags(container)/tags/{tag-name}Tagitem/tags/{tag-name}/photosAllphotoswithtag{tag-name}(con-tainer)Bags/users/{name}/bagsAllbagsforuser{name}(container)/users/{name}/bags/{bag-name}Bagitem/users/{name}/bags/{bag-name}/photosAllphotosinbag{bag-name}(con-tainer)Properties/propsPublicproperties(container)/props/{prop-prefix}/{prop-name}Publicproperty446C.
RivaandM.
LaitkorpiTable2.
Supportedmethodsandcontent-typesfortheresources.
Unlessotherwisespecifiedallthemethodssupportthefollowingcontent-types:application/json,application/atom+xml,application/x-bjson.
ResourceMethodContent-typeDescriptionGETRetrievesthearrayofphotosPhotos(container)POSTimage/jpegAppendsanewphotoRecentphotos(container)GETRetrievesthearrayofrecentphotosGETRetrievesthephotoitemPUTReplacesthecontentoftheitemPhotoitemDELETERemovestheitemGETimage/jpegRetrievestheimagefilePhotocontentPUTimage/jpegReplacestheimagefilePhotothumbnailGETimage/jpegRetrievesthethumbnailfileGETRetrievesthearrayofattributesPhotoAttributes(container)POSTAddsanewattributetoaphotoGETRetrievesthevalueofanattributePhotoAttributePUTUpdatesthevalueofanattributeGETRetrievesthearrayoftagsTags(container)POSTAddanewtagtoatagcontainerGETRetrievesthetagdataPUTUpdatesthetagdataTagitemDELETERemovesthetagGETRetrievesthearrayofbagsBags(container)POSTAddsanewbagtoabagcontainerGETRetrievesthebagdataPUTReplacesthebagdataBagitemDELETERemovesthebag(butnotthecon-tent)GETRetrievesthearrayofpropertiesProperties(container)POSTCreatesanewpropertyGETRetrievesthedataaboutapropertyPUTUpdatesapropertyPropertyitemDELETERemovesaproperty4.
4UseCasesHowtoAccessthePhotoAPIUploadingaphotoTheusercanuploadaphotobysendingaPOSTrequesttoaPhotocontainer(e.
g.
/users/mary/photos)thebinarydatathatcontainsthejpgimageofthephoto.
Ifsuccessful,theservicesreplieswiththemessage"201Created"andtheLoca-tionheadercontainsthelinktothecreatedresource.
FetchingthelistofphotosTheusercanfetchthelistofphotosstoredinthesystemwithaGETrequestontherootPhotocontainer(e.
g.
/users/mary/photos).
TheresponseinJSONformatisanarraywiththeIDsofthephotos:DesigningWeb-BasedMobileServiceswithREST447{"photos":{"photo":[{"id":169},{"id":170},{"id":171},{"id":172},{"id":173},{"id":174},{"id":175},{"id":176}],"total":8,"start":0,"count":20}}Bypassingtheinlineheaderintherequesttheusercanrequestadditionalinforma-tiontobeaddedintheresponse.
Forinstance,wecaninlinethethumbnailsbyaddingtheheader:x-decorations:inline(image/jpeg)=tn_tiny.
TheresponseisamultipartmessagecontainingtheJSONdataandthethumbnails.
Fetchingthecontent/thumbnailofonephotoTheusercanfetchthecontentofonephotowithaGETrequestonthePhotoresource(e.
g.
/users/mary/photos/169/content).
Theresponseisthebinarydataofthejpegimage.
ThethumbnailcanberetrievedfromthesuitablethumbnailURI(e.
g.
/users/mary/photos/169/tns/small).
TaggingphotosBecauseasingletagissimplylikealabel,theusercanaddanewtagtoaphotobysendingaPUTrequesttoanon-existentTagresourceofthePhoto(e.
g.
/users/mary/photos/169/tags/Holiday).
Alternatively,theusercanuploadmultipletagsbyusingaPOSTrequestontheTagscontainerresourcewiththebodycontainingthetagnamesinJSONformat(e.
g.
{"tags":{"tag":[{"name":"Holiday"},{"name":"Maledives"}]}})TheusercanfetchthelistofallthephotoswithaparticulartagbysendingaGETrequesttotheTagresource(e.
g.
/tags/Holiday/photos).
Theresultisanarrayofphotos:{"photos":{"photo":[{"id":169},{"id":170}],"total":2,"start":0,"count":20}}Theusercanun-tagaphotosendingaDELETErequesttotheTagresourceofthePhoto(e.
g.
/users/mary/photos/169/tags/Holiday).
AttachingthegeolocationattributetoonephotoTheusercandefinenewpropertiesforthePhotoresourceandattachtheattributestoaparticularPhoto.
Inthiscaseweneedtodefineanewpropertyforstoringthegeolocationofaphoto(e.
g.
theproperty/loc/coord).
First,wesendaPOSTrequesttothePropertiescontainer(/props)withthenewpropertytocreate:{"prop":[{"name":"coord","prefix":"loc"}]}.
Then,wecanaddtheattrib-utetothephotobysendingaPUTrequesttothelocationofthephoto(e.
g.
/users/mary/photos/169/loc/coord)withthefollowingbody:{"attr":{"value":"45.
210.
7"}}.
5PreliminaryEvaluation5.
1PrototypeImplementationWehaveprototypedareferenceimplementationofthephotoservicethatwaspre-sentedintheprevioussection.
TheimplementationisbasedontheRubyonRails448C.
RivaandM.
Laitkorpiframework[4]thatprovidesseveralconvenientfeaturesfortheimplementationofRESTservices.
ToevaluatethebenefitsandthelimitationsoftheRESTdesignwehavetestedthebackedwiththethreedifferentclients:Maemo.
Itisthelinux-basedplatformfortheNokiainternettables770andN800.
WeimplementedtheclientusingthePythonscriptinglanguage.
JavaMIDP.
TheJavaMIDPenvironmentrunsonmostmobiledevices.
JavaMIDPsupportstheHTTPprotocolbutnotalltheHTTPactions(onlyGETandPOSTaresupported).
WehaveimplementedasimpleworkaroundforemulatingthePUTandDELETEoperationswithPOST.
WetestedtheclientonaNokiaN73device.
PythonforS60.
S60isNokia'splatformforsmartphonesandmultimediacom-puters.
WehaveimplementedtheclientusingtheportofthePythonlanguageonS60.
TheportprovidesfullsupportforthestandardHTTPlibmodule.
Mash-ups.
WehaveassembledourphotoservicewiththeservicesfromotherInternetsites(e.
g.
Googlemaps)withinthebrowserenvironment.
Themash-upshavebeenimplementedinJavascript.
5.
2MainObservationsOurgeneralevaluationofRESTformobileservicesispositivebuttherearestillsev-erallimitationsthatneedtobesolved.
Welistthemainpointsofourevaluationbelow:RESTwithHTTPprovidesauniformmechanismforbuildingwebservicesthatrequiresaminimalinfrastructureontheclientandtheserversides.
Mostimpor-tantly,thisapproachisindependentoftherun-timeenvironment,aslongasthereisdecentsupportforHTTPasacommondenominator.
Unfortunately,somerun-timelibrariestargetingmobiledevicesstilltreatHTTPasasimpletransportmechanisminsteadofaproperapplicationprotocol.
Forexample,MIMEmulti-partsupportistypicallyprovidedbythemaillibraries,anditsAPIisoftenin-compatiblewithHTTPmessageprocessingAPI,thusrenderingHTTPmultipartmessageparsingratherclumsyandinefficient.
Thenetworklatencyisaconcreteproblemforwebservices,especiallyfortheoveralluserexperienceontheclient-side.
Theuserinterfacerequiresaproperde-signtotakeintoconsiderationthelongroundtripperiodsfortransferringthedataacrossthewirelessnetwork.
Wehaveexperimentedwithtwosolutionsthatcanbeusedforbothreadandwriterequests.
Thefirstoneistoinlineadditionaldatainonerequest(e.
g.
inliningthethumbnails)thatallowsfetchingorupdating.
However,thissolutioninhibitstheindividualHTTPcachingoftheinlinedre-sources.
ThesecondoneistocreateconvenientURIsthatprovidemoreapplica-tion-specificdataeitherbybypassingoraugmentingthecoreAPI,effectivelycreatingcustomviewsontopoftheunderlyingcoreresources.
WhenproperlydesignedintermsofresourcesandtheirURIs,theseviewscanthenbeusedforbatchupdateswithasinglerequest,forexample.
However,thisapproachcompli-catesthedesignoftheback-end,becauseitmayintroducepotentiallycomplexapplication-specificaspectsontheserverside.
DesigningWeb-BasedMobileServiceswithREST449TheJSONdataformatsuitsverywellthemobileenvironment.
Itissimpletogenerate,toparse,andcompacttotransfer.
Accordingtoourpreliminarymeas-urements,however,thesizeofthetransferreddataisnotsignificantlysmallerthanthatofXMLdata,especiallywhenretainingthefieldnamesforself-descriptiveness.
WehavealsoextendedtheJSONformatwithbinarydatatosupporttheresponseinlining,becauseatthemomentwehavefoundthemultipartmessagestoocomplextobeprocessedontheclientside.
DesigningsimpleandintuitiveURIsisacriticalpartoftheRESTdesign.
Wehavesketchedasimpledata-orienteddesignprocessbutweneedamethodforspecifyingtheresourceswithaproperformalism.
EspeciallydeveloperswithoutpriorexperienceofRESTwouldgreatlybenefitfrommethodandtoolsupportthathelpthemmaptheirrequirementstoRESTfulresourcedesign.
Thereisalsotheopenissueofenablingthecomponent-likereuseofresourcesubtreesacrossdifferentpartsoftheAPI(e.
g.
reusingtheTagresourcebetweenthePhotoandVideoresource).
Inoursolution,wedonothaveanyexplicitsupportforofflineprocessing.
OurRESTfulapproach,however,inherentlyfitsmanyofflinescenarios,mainlybe-causeofstatelessness.
Forexample,idempotentrequestscanbequeuedontheclientsidequiteeasilyforlaterdelivery,butthisrequiresthatdynamicallycre-atedresourcesshouldhaveclient-providedURIs.
5.
3"MobileREST"Asexplainedabove,theroundtripcostisprobablythemostsignificantindividualchallengeinnetwork-basedmobileapplications.
Therefore,applyingRESTeffi-cientlyinmobileapplicationarchitecturesmayrequiresomeadditionalconstraintsthatguidethearchitectstomakemoremobile-friendlydecisions.
Theseconstraintswouldprimarilyneedtotacklethedilemmaof"justenoughrequests,justenoughdata".
Inverysimpleterms,"justenoughrequests"referstomechanismsthatgiveclientsenoughcontroltoadjustthescopeoftheRESTfulinteractions,thusreducingtheneedformultiplerequests.
Asanoppositedrivingforce,"justenoughdata"referstomechanismsthatclientsmayusetoadjustthevolumeofdatainasinglemessage.
Elaboratingtheseadditionalconstraintswillbepartofourfuturework.
6ConclusionsThegrowthandsuccessoftheWebmainlyderivefromathoroughapplicationofbasicdesignprinciplesthatarecrystallizedintheRESTstyle.
RESTisalsobecomingapopularparadigmforpublishingWebservices(asanalternativetotheWS-*stack).
InthecurrentpaperwehaveinvestigatedhowtoapplytheRESTprinciplestothedesignofmobileservices.
Wehaveidentifiedseveralissues(likenetworklatencyanddataformats)thatneedparticularattentionwhenapplyingtheRESTconceptstothemobileenvironment.
Fordemonstrationpurposes,wehaveprototypedaRESTphotowebserviceandtesteditwithdifferentmobileclients.
OurpreliminaryevaluationshowsthatRESTwithHTTPprovidesauniformmechanismforbuildingwebser-vicesthatrequiresaminimalinfrastructureontheclient-sideandisindependentof450C.
RivaandM.
Laitkorpitherun-timeenvironment.
Theserviceisextensiblewithdifferentdatarepresentationsand,hence,allowsustoproperlyaddressthemobilespecificneeds.
ThecriticalpartofthedesignprocessistoelaborateaclearURIstructurefortheAPI,allowingmo-bileclientstomakejustenoughrequestsandprocessjustenoughdata.
Wehavefol-lowedadata-drivendesignprocessbutwehavebeenlackingameticulousdesignformalism(e.
g.
,aUMLbasedapproachthathelpsdevelopersmaptheirrequirementstoRESTconstraints).
Ourfutureworkwillbefocusedonimprovingthedesignproc-essofRESTservices,especiallyforthemobileenvironment,andconductamorethoroughevaluationwithadditionalprototypes.
References1.
Fielding,R.
T.
:Architecturalstylesandthedesignofnetwork-basedsoftwarearchitectures,PhDThesis,UniversityofCalifornia,Irvine(2000)2.
Fielding,R.
T.
,Gettys,J.
,Mogul,J.
,Frystyk,H.
,Masinter,L.
,Leach,P.
,Berners-Lee,T.
:HypertextTransferProtocol–HTTP/1.
1.
InternetRFC2616(June1999)3.
Berners-Lee,T.
,Fielding,R.
T.
,Masinter,L.
:UniformResourceIdentifiers(URI):Genericsyntax.
InternetRFC2396(August1998)4.
Thomas,D.
,Hansson,D.
H.
:AgileWebDevelopmentwithRails,PragmaticBookshelf,2ndedn.
(December14,2006)5.
vanGurp,J.
,Karhinen,A.
,Bosch,J.
:MobileServiceOrientedArchitectures.
In:Eliassen,F.
,Montresor,A.
(eds.
)DAIS2006.
LNCS,vol.
4025,pp.
1–15.
Springer,Heidelberg(2006)6.
Freed,N.
,Borenstein,N.
:MultipurposeInternetMailExtensions.
InternetRFC2046(No-vember1996)7.
Nottingham,M.
,Sayre,R.
:TheAtomSyndicationFormat.
InternetRFC4287(December2005)8.
Greogiro,J.
,dehOra,B.
:TheAtomPublishingProtocol,InternetDraftversion17(No-vember2007)9.
Crockford,D.
:Theapplication/jsonMediaTypeforJavaScriptObjectNotation(JSON),InternetRFC4627(July2006)10.
WebServicesArchitecture,W3CWorkingGroupNote(February11,2004),http://www.
w3.
org/TR/ws-arch/11.
SOAP,Version1.
2,W3CRecommendation(Secondedn.
)(April27,2007),http://www.
w3.
org/TR/soap/

云雀云(larkyun)低至368元/月,广州移动1Gbps带宽VDS(带100G防御),常州联通1Gbps带宽VDS

云雀云(larkyun)当前主要运作国内线路的机器,最大提供1Gbps服务器,有云服务器(VDS)、也有独立服务器,对接国内、国外的效果都是相当靠谱的。此外,还有台湾hinet线路的动态云服务器和静态云服务器。当前,larkyun对广州移动二期正在搞优惠促销!官方网站:https://larkyun.top付款方式:支付宝、微信、USDT广移二期开售8折折扣码:56NZVE0YZN (试用于常州联...

UCloud云服务器香港临时补货,(Intel)CN2 GIA优化线路,上车绝佳时机

至今为止介绍了很多UCLOUD云服务器的促销活动,UCLOUD业者以前看不到我们的个人用户,即使有促销活动,续费也很少。现在新用户的折扣力很大,包括旧用户在内也有一部分折扣。结果,我们的用户是他们的生存动力。没有共享他们的信息的理由是比较受欢迎的香港云服务器CN2GIA线路产品缺货。这不是刚才看到邮件注意和刘先生的通知,而是补充UCLOUD香港云服务器、INTELCPU配置的服务器。如果我们需要他...

DMIT(8.72美元)日本国际线路KVM月付8折起,年付5折

DMIT.io是成立于2018年的一家国外主机商,提供VPS主机和独立服务器租用,数据中心包括中国香港、美国洛杉矶和日本等,其中日本VPS是新上的节点,基于KVM架构,国际线路,1Gbps带宽,同时提供月付循环8折优惠码,或者年付一次性5折优惠码,优惠后最低每月8.72美元或者首年65.4美元起,支持使用PayPal或者支付宝等付款方式。下面列出部分日本VPS主机配置信息,价格以月付为例。CPU:...

nokia最新手机为你推荐
支付宝查询余额我的支付宝如何查询余额微信如何建群微信建群怎么建伪静态什么是伪静态伪静态有何作用iphone越狱后怎么恢复苹果越狱后怎么恢复出厂设置奇虎论坛奇虎是中国的吗?怎么上传音乐怎么上传音乐到网上QzongQQ空间是Qzone还是Qzong网站营运网站运营都分为哪些方面微信怎么看聊天记录怎样查找一个人的微信聊天记录怎么在图片上写文字如何用美图秀秀在照片上写字
英文简历模板word 租空间 灵动鬼影 智能骨干网 空间租赁 qq金券 lamp兄弟连 免费个人主页 美国迈阿密 电信主机托管 谷歌搜索打不开 美国vpn代理 标准机柜 iptables 赵荣 免费php空间申请 免费论坛空间 万网空间价格 北京车牌号申请网站 英国伦敦艺术大学 更多