You are on page 1of 16

2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

GetStarted

Solutions Support Training Community Developer Partner

About

Community / Blogs

AnXMLFormatforAjax
ResponseMessages
December6,2012 | 40Views |
RdigerPlantiko
morebythisauthor

UIBusinessServerPages(BSP)
abap | ajax | schema | xml | xslt

Follow

TheXinAjax
SoWhyBotherWithXML?
TheAjaxResponseFormat
TheClassofAjaxResponses
TestingDocumentInstances
OntheABAPSide
Conclusion

Thisblogisapreludeforaplannedseriesofblogsonhowtodesign
webapplicationsservedbyRESTfulservicesonanABAPWebAS.This

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 1/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

firstpartisaboutasufficientlygenericXMLformatforcarrying
informationsbetweenclientandserver.

TheXinAjax
ItisalmostforgottenthattheXinAjaxstandsforXML.Intheearly
timesoftheAjaxeuphoria,XMLhasbeenthoughtasthegeneralcarrier
formatformessages.AjaxwasplannedasapairingofAsynchronous
JavaScriptwithXML.WhileasynchronousJavaScriptaddressedthe
XMLHTTPRequestobjectasthetoolfordatatransfer,XMLwasthought
tobethelanguagefortransmittingdatabetweenclientandserver.

Butinthosetimes,thebrowserswerentreallypreparedtoeasilyparse,
buildandtransformXML.XMLquicklylostitsterraininfavourofother
dataformats.Nowadays,theherdshavemovedon,favorizingJSON,
andIjoininthevoicespraisingtheadvantagesofthisdataformat.Even
adhocplaintextformatsareinfashion,builtandparsedontheflywith
basicstringmanipulationcommandsandregularexpressionsearch.

SoWhyBotherWithXML?

Firstofall,inthemeantimewehavematureXMLtoolsontheclientas
wellasontheserverside.WithaframeworklikeSarissa,wehaveallthe
XMLpowerontheclient:wecanbuildandtransformXMLdocuments
andconvertthemintoHTMLfragments.

Thisisthesecondadvantage:XMLbeingconceptionallyand
notationallyclosetoHTML,makesiteasytoimportXMLfragmentsinto
thecurrentHTMLDOM.Also,theAPIsformanipulatingortraversing
elementssharemanymethodsandpropertieslikee.g.
getElementsByTagName(),childNodes,firstChild,nodeType,andsoon.
ThisisparticularlyhelpfulwithXHTMLdocuments,butworksequally
wellwithproperHTML.

Ontheserverside,itiseasytointegrateanXSLTorSTtransformation
intoanABAPbasedwebservice:Afterhavinggatheredallthe
necessaryABAPdatafortheresponse,youmaythrowthemintoa
CALLTRANSFORMATIONanddirectlyreceiveanXMLdocumentinthe
desiredtargetformat.Seebelowforanexample.

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 2/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

TheAjaxResponseFormat

InanAjaxbasedwebapplication,thereshouldbenottoomuch
overheadforthedatatransferprotocol.EmployingaprotocollikeSOAP
wouldclearlybeoverdone.Ontheotherhand,itmakessensetodesign
somesimplecrossapplicationcontainerformatforalltheinvolvedweb
servicesofalargerwebapplicationproject.

IncontrasttoSOAP,theenevelopepartofsuchamessageshouldbe
reducedtoanabsoluteminimum.Basically,justarootnode,letscallit
<ajax></ajax>shouldberequiredwrappingitalltomeettheOne
RootElementcriterionofXMLwellformedness.

Ifoundthat,apartfromthecommonrootelement,say<ajax>,itmakes
sensetohaveoneparticulardefinedchildelement<message>,
containingamessageaccompanyingtheresponse.

Concerningtherestofthedocument,itisnotnecessarytoimposeany
restrictivecriteria.Virtuallyeverythingispossiblefromnothingtoa
complexnestedstructurewhichfitsbesttoaparticularrequest.

Thefollowingmayserveasanexample:

<ajax>
<messagetype="S"text="3countriesselected"/>
<countryvalue="ES">Spain</country>
<countryvalue="FR">France</country>
<countryvalue="IT">Italy</country>
</ajax>

Wehavea<message>elementwithamessagetypetheABAP
messagetypes(Success,Information,Warning,Error,Abort,andXfor
failedassertions)servingfortheallowedvaluesandanattributefor
themessagetextitself.Followingtothis<message>element,thereisa
seriesof<country>elements.

Dependingonthewebservicesdomain,weshouldbecompletelyfree
todesigntheresponseformatsothatitfitsbestfortransferringthe
relevantdatatotheclient.

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 3/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

Anotherexamplecouldbetheconfirmationresponseafteraneworder
hasbeencreated:

<ajax>
<messagetype="S"text="Ordersaved"/>
<ordernumber="4711"/>
</ajax>

Insuchanexample,theservicecouldmerelypassthenewnumberof
thecreatedsalesordertotheclient.Therestoftheorderdataareon
theclientanyway,sincetheuserhadrequestedtocreateanorderout
ofthesedata.Sothereisnoneedtotransmitallthesedatabackagain
fromtheservertotheclient.

Thereisonetypeofchildelementswhichmakessensefora
<message>:Theservicemayindicateoneormoreofthequery
parameters(fields)thatareconnectedtothemessage.Soalistof
<field>elementswithobligatorynameattribute(andanoptionalvalue
attribute)maybeincludedinthe<message>.Thewebclientcoulduse
thisinformationtohighlightaninputfieldwhichhaderroneousinput:

<ajax>
<messagetype="E"text="PACHOLKEisnotaknownuser">
<fieldname="user"/>
</message>
</ajax>

TheprecedingexamplealsoillustratesthatanAjaxResponsemaycarry
noapplicationdataatall.

Butlikewise,itmaybethemessagethatisomitted:

<ajax>
<requisitionCode>1002</requisitionCode>
</ajax>

TheClassofAjaxResponses

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 4/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

XMLschemaisalanguagefordescribingclassesofXMLdocuments.
WecanuseittogiveaformaldescriptionofallAjaxResponses,i.e.
XMLdocumentswiththedatastructureexposedabove:

<xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema">
<!Nameoftherootelementis'ajax'>
<xs:elementname="ajax"type="ajaxResponse"/>
<!Content:[<message>?,anyElement*]>
<xs:complexTypename="ajaxResponse">
<xs:sequence>
<xs:elementname="message"
minOccurs="0"
maxOccurs="1"
type="message"/>
<xs:anyprocessContents="lax"
notQName="##definedSibling"
minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!A<message>hasatypeandatextattribute
Itmaycontain<field>childelements>
<xs:complexTypename="message">
<xs:sequence>
<xs:elementname="field"type="field"minOccurs="0"/>
</xs:sequence>
<xs:attributename="type"type="msgType"/>
<xs:attributename="text"type="xs:string"/>
</xs:complexType>
<!Afieldelementhasa'name'andanoptional'value'>
<xs:complexTypename="field">
<xs:attributename="name"use="required"/>
<xs:attributename="value"use="optional"/>
</xs:complexType>
<!msgTypecopiestheallowedvaluesaufABAP'sSYMSGTY>
<xs:simpleTypename="msgType">
<xs:restrictionbase="xs:string">
<xs:enumerationvalue="S"/>
<xs:enumerationvalue="I"/>
<xs:enumerationvalue="W"/>
<xs:enumerationvalue="E"/>
<xs:enumerationvalue="A"/>
<xs:enumerationvalue="X"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

ThisXMLSchemadescribesalltherulesmentionedabove:

1.Therootelementhasthenameajax,
2.Itcontains0or1<message>aschildren,andafterthatarbitrary
manyelementsofwhatevernameandtype,butnofurther

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 5/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

<message>element.
3.Themessagehasanattributetype,containingoneoftheallowed
valuesforanABAPmessagetype,andatextattributeforthe
messageitself.
4.Themessagemaycontainasequenceof<field>elements,
denotingthefieldsthatareconnectedtothemessage.

TheonlynonstraightforwardpartinthisXMLscemadocumentisthe
exclusionoffurthermessageelementsinthe<xs:any>elementset.
Actually,forimplyingthisrestriction,Iusetheattribute(thanksto
MichaelKayforpointingmetothissolution):

notQName="##definedSibling"

Thisattributeofthe<xs:any>elementispreciselywhatsnecessary
here.Itexcludesallthedefinedsiblings(here:just<message>)fromthe
allowedelementnames.Whiletherestoftheschemawouldbeavalid
XSD1.0document,thisattributenotQNamecamewithXSD1.1.Idont
seeawayofdescribingthedocumentstructurepurelywithXSD1.0
means.

TestingDocumentInstances

ThereisanonlinetoolforSchemabasedXMLvalidation.Thisisvery
helpfulforaquicktestwhetheracertainXMLdocumentisavalid
instanceofagivenschema.

However,whenusingtheonlinetoolwiththeaboveschema,youwould
bedisappointed:TheonlineserviceisstillonXSD1.0,itcantinterpret
theschema.AsfarasIknow,thereisnoonlinevalidatorforXSD1.1(as
ofthiswriting).

However,ifyouhaveJavaonyourcomputer,youcaninstalltheApache
Xercestools.OntheXercesdownloadpage,youcandownloadthe
binariesforthecurrentrelease(2.11).Becarefultochooseaversion
containingtheXSD1.1support(theyaremarked).CopytheeightJAR
filescontainedinthatpackagetothefolder<Java>/jre/lib/endorsed,

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 6/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

where<java>isthepathtoyourJavaSDK(ortoyourJavaRuntime).If
suchafolderendorseddoesnotexistyetin/jre/lib:createit.

OnceyouhavetheseJARfilesintheJREendorseddirectory,the
XercesXSD1.1Schemavalidatorcanbeused.Thereisatestclass
jaxp.SourceValidatorcomingwiththedistribution.Youcanuseitfrom
thecommandline.Seehereanexamplewithanintentionallywrong
XMLdocument(itcontainedtwomessageelements,wherethe
AjaxResponseformat,asexplained,onlyallowsone):

WedontneedtheXSDatruntime.Butinanycaseitsgoodtohavea
purelyformaldescriptionoftheexchangeddata.Forexample,sucha
descriptionprovesusefulforunittestsonthewebservices.Simpletests
assertingthattheoutputisanAjaxResponsehelpsavoidingbugswhen
theservicesareextendedorotherwisemodified.

OntheABAPSide

IhavedesignedsometestserviceswhichIwillfurtherdiscussinthe
followingblogs.

Oneoftheseservicesretrieves,onaGETrequest,allthevariantsofa
reportwiththegivenreportname.Hereisanexamplecall:

http://bsp.mits.ch/buch/job/variants?repid=RSNAST00

Whencallingit,youwillretrieveananswerlikethis:

<?xmlversion="1.0"encoding="iso88591"?>
<ajax>
<reportname="RSNAST00">
<variantname="I18730"text="WFMCsendexternaladdress"/>

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 7/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

<variantname="IMMNAST00"text="NASTsendfaximmediately"/>
<variantname="SAP_SDB"text="Securitydatasheetdispatch"/>
<variantname="UXPD_NAST_ZMVN"text="PurchaseOrderCopy,MVN"/>
<variantname="UXPD_NAST_ZTIN"text="PurchaseOrderCopy,ZTIN"/>
<variantname="UXPY_NAST_NAB1"text="Yearlyinvoice,NAB"/>
<variantname="VERA_001"text="TestscheduledRSNAST00"/>
<variantname="ZBA1_20110708"text="Orderconfirmation,resend"
</report>
</ajax>

ThisobviouslyconformswiththeabovedefinitionofanAjaxResponse.
Itcontainsnotmorethanthedemandeddata:ThevariantIDs,andtheir
texts.Theapplicationwillusepreciselythisresponseforfillingalistbox,
andthisAjaxcyclewillbetriggeredonanychangeofthefieldcontaining
thereportname.

Toservetherequest,astatelesswebserviceintheABAPWebASis
called.Forthegivenreportnamelv_repid,itgatherstherelevantdata
(VARID/VARIT)intoaninternaltablelt_vars.Ifnecessary,the
messagefieldslv_messageandlv_msgtyareprovided:

lv_repid=server>request>get_form_field('repid').
iflv_repideqspace.
*Pleaseenterareportname
messagee798(db)intolv_msg.
lv_msgty='E'.
else.
try.
callmethodcheck_for_variants
exporting
iv_repid=lv_repid
importing
et_vars=lt_vars.
iflt_varsisinitial.
*Novariantsfound
messagei260(db)intolv_msg.
lv_msgty='I'.
endif.
catchzcx_errorintolo_ex.
lv_msg=lo_ex>get_text().
lv_msgty='E'.
endtry.

endif.

WhenalltheABAPdataaredetermined,theyareconvertedintoXML
data.OntheABAPside,thisisaccomplishedbypreciselyone

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 8/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

statement:

*Transformvariantsand/ormessageintoAjaxResponseformat
calltransformationzvariants
source
variants=lt_vars
message=lv_msg
message_type=lv_msgty
repid=lv_repid
result
xmllv_result.

Ofcourse,theactualworkoftransformingisperformedinsidetheXSLT
transformationhere:zvariants.

Inthefollowingcodeoftransformationzvariants,observethatitis
possibletowritetherulesinastepdownmannerbeginningwiththe
overalldocumentstructure,andthengoingdowntothedetailsoneby
oneasacompositionofsmalltemplateswitheasyandsingle
functions.

Alsonotethatreadabilityincreaseswhenusingthecurlybracenotation
forevaluationinsideofattributevaluesofthetargetdocument:

<xsl:transformxmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<!
Givesallthevariantsofareport,intheAjaxResponseformat
DataaretakenfrominternaltableVARIANTS
MESSAGEandMESSAGE_TYPEcontainamessage(optional)
>

<xsl:stripspaceelements="*"/>

<!Maintemplate:MessageandVariants>
<xsl:templatematch="asx:abap/asx:values">
<ajax>
<xsl:calltemplatename="message"/>
<xsl:applytemplatesselect="VARIANTS"/>
</ajax>
</xsl:template>

<!Message,ifgiven>
<xsl:templatename="message">
<xsl:iftest="not(MESSAGE_TYPE='')">
<messagetype="{MESSAGE_TYPE}"text="{MESSAGE}">
<fieldname="repid"/>
</message>
</xsl:if>

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 9/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

</xsl:template>

<!Variants>
<xsl:templatematch="VARIANTS">
<!Onlyiftherearevariants>
<xsl:iftest="*">
<reportname="{../REPID}">
<xsl:applytemplatesselect="*"/>
</report>
</xsl:if>
</xsl:template>

<!Asinglelineofthevarianttable>
<xsl:templatematch="RSVARTXT">
<variantname="{VARIANT}"text="{VTEXT}"/>
</xsl:template>

</xsl:transform>

Inthisform,sucharequestisservedonamodestlytunedSAPsystem
(actually,itisoneofourteamsdevelopmentsystems)withanaverage
ABAPresponsetimeofabout20milliseconds,asthefollowing
screenshotfromSTADshows:

Exploitingthebufferingforcommonlyuseddatabaseresources,the
grossshareoftheresponsetimeisCPUtimeastatelesswebservice
ofthistypewillscaleverywell.Incomparison,arequestresponsecycle
ofevenaminimalisticBusinessServerPagerequiresafactor510
higherABAPresponsetime.Also,aBSPnavigationusuallyresultsina
reloadofthecompletewebpage,whereasAjaxtechniquescanbe
usedtoexchangeonlysmallpartsofthepage,whichadditionally
increasesoverallperformancebyreducingtheclientsideresponse
time.

ThisisnottospeakagainstBusinessServerPagesactually,BSPand
Ajaxcomplementeachotherverywell.BSPcanbeusedtomanagethe
applicationsressources(HTML,CSS,JavaScript,XMLfragments,
clientsideXSLTs)andtogeneratethepagestobeloadedfromthe

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 10/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

server.Assoonastheyareloaded,furtherinteractioncanbehandled
byAjaxrequests.

Conclusion

FromthefirstspreadofAjax,XMLwasplannedasdatatransferformat
fortheclientservercommunication.AlthoughJSONisusuallyfavorized
today,therearegoodargumentsforusingXML:Therearereliabletools
onclientaswellasonserversidetoworkwithXMLdata.Also,the
similarityofXMLDOMtoHTMLDOMmakesXMLagoodchoice.

OncethedecisionismadetoworkwithXMLforAjaxenabledweb
applications,itisusefultobasealltheservicesinvolvedonasufficiently
generalcommonAjaxResponseformat.SinceAjaxisusedformany
smallrequests,suchaformatshouldbeaslooseandasminimalisticas
possible.Thisblogdetailedaproposal.

AlertModerator

5Comments
YoumustbeLoggedontocommentorreplytoapost.

UweKunath

February8,2013at2:02pm

Thankyou,Rdigerforthisblogpost!
Onequestionthatisstillopenforme,ishowthisissuecouldbesolved:
IfwedidntuseGETrequestsbutPOSTrequestsinstead,anddontpassthe
generatedbrackettermintheURL,e.g.
http://server:8080/sap/bc/bsp/leoym/bsp00/endpoint.htm
theBSPruntimeanswersthemwithagenericformlikethis
<html><head><styletype=text/css>.middle{verticalalign:middle}</style>
</head><bodyonload=document.forms[0].submit()><formmethod=post

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 11/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

action=/sap(bD1lbiZjPTA3MA==)/bc/bsp/leoym/bsp00/endpoint.htm></form>
<tableborder=0width=100%height=100%><tr><tdalign=center
class=middle>Yourrequestisbeingprocessed</td></tr></table></body>
</html>
Abrowserwouldbeexpectedtodisplaytheformandretriggertherequestwith
thebracketintheURL.IfitwasXMLHttpRequest,thiswouldntworkofcourse.
DoyouknowanypossibilitytopreventthisbehaviourinBSPruntime?Ofcourse
wecouldfollowthelinkinthegeneratedformandresendtherequestmanually
asabrowserwouldtypicallydoit.
Butpossiblethereisabetterapproach
Thankyou,
Uwe

RdigerPlantiko Postauthor

February8,2013at2:37pm

Uwe,thanksforyourfeedbackalthoughithasnothingtodowith
thecontentofthisblog
Actually,thisisafrequentlydiscussedquestion.Thebracketpart
thattheICFgeneratesintotheURLisnecessary,sinceotherwise
thesystemwouldntknowonwhatclientandwithwhichlanguageto
performtherequest.Sowhynotincludethebracketpartinthe
URL,itdoesntchangeanyway(itsnosessionidorsomethingit
shouldonlycontainthebase64encodingofatermlike
l=DE&c=565,thelanguageandclientparameter.
Thisthreadcontainssomefurtherinformationsonthissocalled
URLmangling.
Inpractice,youdontneedtoworryabouttheredirect:Performing
anXMLHttpRequest,willautomaticallyinterprettheHTTP30x
redirectionresponse,andwillautomaticallyforwardyoutothenew
URL.Usually,aframeworkwaitsuntilitfinallyreceivesanHTTP
200statuscode,beforetriggeringaneventlikesuccess,onwhich
youregisteredyourcustomcode.See
http://stackoverflow.com/questions/4168784/ajaxredirection
handling/4168800#4168800
Regards,
Rdiger

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 12/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

RdigerPlantiko Postauthor

February9,2013at9:14am

Uwe,Iwasnowabletoreproduceyourproblem.
Itonlyhappens
ifyouservetherequestwithaBSP(notwithanownrequest
handler,asIwasusingintheblogonimplementingaRESTAPIin
ABAP),
andwhenyousendaPOSTrequest,insteadofaGETrequest
(whichhastobepossibleforaRESTAPI,ofcourse).

Indeed,theBSPrequesthandler(CL_HTTP_EXT_BSP)hasa
specialhandlingforPOSTrequeststhatrequireanURLrewrite.
Theformyoumentionisproducedinmethod
ON_CHECK_REWRITEofclassCL_BSP_RUNTIME(line522ff.in
ourrelease):

*gothere!
ifc_request>get_header_field(~request_method)=
POST.#EC*.
data:htmltypestring.
loopatffsintoff.
*replacealloccurrencesof``inffvaluewith`&quot`.
ffvalue=cl_abap_dyn_prg=>escape_xss_xml_html(
ffvalue).
concatenatehtml<inputtype=hiddenname=
ffnamevalue=ffvalue>intohtml.
endloop.
concatenate<html><head><style
type=text/css>.middle{verticalalign:middle}</style>
</head>
<bodyonload=document.forms[0].submit()>
<formmethod=postaction=l_location>
html

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 13/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

InthissituationPOSTrequests,andusingaBSPasrequest
handler,Iwouldsuggesttousethecorrectmanglingterm
containingtheclientandlanguagetomakeitwork(asIalready
statedinthepreviousreply).
Actually,IdontseethebenefitinusingBSPforimplementinga
RESTAPI,asitisdesignedforcreatingpagestobelookedatinthe
browser.Whatistheadvantageinusingit?Whynotcreatingan
ownSICFhandlerclass,asdescribedinthementionedblog?
Regards,Rdiger
Remark:AsanotherexampleofnonBSPrequesthandler(instead
ofthosedescribedinthementionedblog),seeherethecodefor
thehandlerthatgetsthevariantsofareport(
http://bsp.mits.ch/buch/job/variants?repid=RSNAST00):
http://bsp.mits.ch/code/clas/zcl_job_repid_variants

UweKunath

February10,2013at1:00pm

Thankyou,Rdiger,andsorryforthe
misunderstanding.BecauseofthesectionBSPofthis
blogpost,andbecauseitwastaggedwithBSP,I
thoughtthatyouimplicitlydescribedBSPHandlers.
However,youstatedclearlythatyouaretalkingabout
statelesswebserviceintheABAPWebAS.
Thankyouverymuchfortheexplanationofthe
manglingtermifitdoesntchangeanyway,itcould
beincludedintheURL.Thatsreallygoodnews.
ThereasonwhyBSPhandlersmightbebetterthan
ICFbasedhandlers,issessionhandling.Ofcourse,
RESTServicesshouldbestateless,butthisisoftennot
possibleoratleastleadstoperformanceissuesfor
e.g.inhybridmobileapplications.
Now,intheblogpostyoumentioned,youalsoincluded
asectioncalledSession,IdentityandLocking,which
isgoodnews#2today
Thankyouverymuch!
PS:

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 14/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

TherearealsootherinterestingapproachestoREST
inSCNlikethepythonconnector,whichisoptimizedto
leverageexistingfunctionmodules
http://scn.sap.com/community/scripting
languages/blog/2013/01/29/restprototypingwith
python

RdigerPlantiko Postauthor

February10,2013at3:16pm

Uwe,thanksforyourreply.
WorkingwithstatemeansthattheREST
APIshouldrequireasessionID
parameter,tobeprovidedbytheclient
webapplication.Ifthatapplicationisa
BSP,thesessionIDcanbeextractedfrom
thesapappcontextcookie,asexplained
inmyblog.
Thanksforpointingmyattentiontothe
Pythonconnectorwhichopensyet
anotherwayforconnectinganarbitrary
webapplicationservertotheSAPsystem
internally.
WithanownwebserverlikeApachein
betweentheSAPsystemandtheclient,
onecouldalsomapsomeURLpaths
directlytotheURLofaRESTfulABAP
webservice(usingmod_rewriteor
directiveslikeProxyPass),andthe
accessescanthenbeprogrammedin
JavaScriptontheclient.Thisisneartothe
ideasIoutlinedhereforXMLandherefor
JSONasdatatransportlayer.
Regards,Rdiger

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 15/16
2/8/2017 AnXMLFormatforAjaxResponseMessages|SAPBlogs

Share & Follow


Privacy TermsofUse LegalDisclosure Copyright Trademark Sitemap Newsletter

https://blogs.sap.com/2012/12/06/anxmlformatforajaxresponsemessages/ 16/16