Use HTTPSERVICE and ASP's pseudo -web service communication to complete the database operation
I provide a pseudo -service idea for ASP:
clientreq.xml:
------------------------------------------------ -----------------------------------------------
<? xml version = 1.0 encoding = gb2312?>
<Testpacket>
<MSGTYPE> getValueReq </msgtype>
<Version> 1.0 </version>
</testpacket>
index.mxml:
------------------------------------------------ -----------------------------------------------
<mx: MODEL ID = MREQ SOURCE = Clientreq.xml/>
<mx: httpservice id = hs url = http://asp/testserver.asp
resultFormat = xml
Method = post
ContentType = Application/XML
showbusycursor = true>
<mx: Request>
<xml> {mREQ} </xml>
</mx: Request>
</mx: httpservice>
testserver.asp:
------------------------------------------------ -----------------------------------------------
Mainly obtain data packets, parsing data packets, specified operations, and return to four steps of data
1. Get submitted data packet
set dom = server.createObject (msxml2.Document)
oDom.load request
2. Analyze the data packet and get msgtype
SMSGTYPE = TRIM (ODOM.SELECTSINGLEDE (// Msgtype) .text)
Select Case SMSGtype
Case GetValueReq
call getValue
'Case deletevalueq
'call deletevalue
case insertvalueq
'Call Insertvalue (ODOM)
'Case Updatevalueq
'call updatevalue
'Else case
'Call ShowerRMSG
end select
3. Specify the operation, complete the getValue operation here, many of which can be made into public modules for other functions
SCONN = Driver = {Microsoft Access Driver (*.mdb)}; DBQ = & Server.MAPPATH (MESSAGE.MDB)
set oconn = server.createObject (Adodb.connection)
Oconn.open SCONN
SSQL = Select * From Message Order by ID DESC
setrs = Server.createObject (Adodb.oldSet)
ORS.OPEN SSQL, Oconn, 1, 1
'Constructive record XML document
if organ.eof and ourS.BOF then
sxml = <? Xml Version = 1.0 Encoding = GB2312?> & VBCRLF & _
<Testpacket> & VBCRLF & _
<MSGTYPE> SystemResp </msgtype> & vBcrLF & _
<Version> 1.0 </version> & vBcrLF & _
<Result> 0 </result> & vBcrLF & _
</testpacket>
end if
'Construction has a record XML document
if not (iates.eof and ors.bof) then
do while not om.eof
stmpxml = stmpxml & <Messages> & vBcrLF & _
<Name> & Org (name) & </name> & vBcrLF & _
<EGE> & & & </Age> & VBCRLF & _
<sex> & & & </sex> & vBCRLF & _
<MSG> & Org (msg) & </msg> & vbcrf & _
</messages> & vBCRLF
ondenext
loop
sxml = <? Xml Version = 1.0 Encoding = GB2312?> & VBCRLF & _
<Testpacket> & VBCRLF & _
<MSGTYPE> SystemResp </msgtype> & vBcrLF & _
<Version> 1.0 </version> & vBcrLF & _
<Result> 1 </Result> & VBCRLF & STMPXML & _
</testpacket>
end if
4. Return data
set dom = server.createObject (msxml2.Document)
oDom.loadxml (SXML)
oDOM.SAVE (Response)
set oDom = nothing
Message.mdb
------------------------------------------------ -----------------------------------------------
Database name: Message.mdb
Data Title: Message
Data field: field type
ID automatic number
name text
Age number
sex text
MSG remarks
Execution results:
------------------------------------------------ -----------------------------------------------
When I set the resultFormat = text of httpservice, see the results of the display
This topic contains attachments: sf_200411813537.jpg (23359bytes)
csdn blog: http://blog.csdn.net/stefli
stefli's mp3: http://stefli.88ip.net/flex/mp3player.swf