returning XML from ASP page
sir,
i want to return xml document from my ASP page
however this xml page is accessed by a java application
i'm getting a url string with some arguments from that java
application ,and after processing these arguments i return
the results as xml document
however java application is not receiving anything
following is the asp page
plz help
thanx
<%
Response.ContentType="text/xml"
On Error Resume Next
Dim AuthenticationKey
Dim UserName
Dim Name
Dim Password
Dim RecMoNum
Dim Sms
Dim DeliveryDate
Dim myType1
Dim Confirmation
Dim myResponse
Dim myRequest
Dim myconn
Dim mappedpath
Dim myRSCustInfo,MyRSPendMsg,myRSPendConf
Dim akeyfound,userfound
Dim myDoc
Dim curDate
Dim responsetag,errortag,messagetag,messagetext
Dim confirmationtag,confmessagetag,confmessagetext
Dim confmobiletag,confmobiletext
Dim confDatetag,confDatetext
Dim confddatetag,confddatetext
AuthenticationKey = Request.QueryString("AKey")
UserName = Request.QueryString("UName")
Password = Request.QueryString("Pass")
RecMoNum = Request.QueryString("RMNum")
Sms = Request.QueryString("SMS")
DeliveryDate = Request.QueryString("DDate")
myType1 = Request.QueryString("myType")
Confirmation = Request.QueryString("CR")
myResponse = Request.QueryString("res")
myRequest = Request.QueryString("req")
mappedpath = server.mappath("WebSMS.mdb")
Set myConn=Server.CreateObject("ADODB.Connection")
myDoc = server.CreateObject("Microsoft.XMLDOM")
myDoc.async=false
' myDoc.PreserveWhiteSpace = True
myconn.Provider="Microsoft.Jet.OLEDB.4.0"
myConn.Open mappedpath
responsetag=myDoc.createNode("ResponseTag")
'myDoc.documentElement=responsetag
myDoc.appendChild (responsetag)
Set myRSCustInfo = Server.CreateObject("ADODB.Recordset")
myRSCustInfo.Open "CustomerInfo", myConn, , adLockOptimistic, adCmdTable
akeyfound = false
Do While Not (myRSCustInfo.EOF or akeyfound)
If (StrComp(myRSCustInfo("AuthenticationKey"),_
Authenticationkey,vbTextCompare) = 0) Then
akeyfound = True
else
myRSCustInfo.MoveNext
End If
Loop
If Not akeyfound Then
errortag = myDoc.createElement("Error")
messagetag = myDoc.createElement("Message")
messagetext = myDoc.createTextNode("Authentication Key Not Found")
messagetag.appendchild(messagetext)
errortag.appendchild(messagetext)
responsetag.appendchild(errortag)
Response.Write(myDoc.xml)
myRSCustInfo.Close
Set myRSCustInfo = Nothing
myconn.Close
Set myconn = Nothing
Response.end
End If
If Not (StrComp(myRSCustInfo("UserName"),_
UserName,vbTextCompare) = 0) Then
errortag = myDoc.createElement("Error")
messagetag = myDoc.createElement("Message")
messagetext = myDoc.createTextNode("User Name Not Found")
messagetag.appendchild(messagetext)
errortag.appendchild(messagetext)
responsetag.appendchild(errortag)
Response.Write(myDoc.xml)
myRSCustInfo.Close
Set myRSCustInfo = Nothing
myconn.Close
Set myconn = Nothing
Response.end
End If
If Not (StrComp(myRSCustInfo("Password"), Password,vbBinaryCompare) = 0) Then
errortag = myDoc.createElement("Error")
messagetag = myDoc.createElement("Message")
messagetext = myDoc.createTextNode("Invalid Password")
messagetag.appendchild(messagetext)
errortag.appendchild(messagetext)
responsetag.appendchild(errortag)
Response.Write(myDoc.xml)
myRSCustInfo.Close
Set myRSCustInfo = Nothing
myConn.Close
Set myConn = Nothing
Response.End
End If
Name = myRSCustInfo("Name")
Set myRSPendMsg = Server.CreateObject("ADODB.Recordset")
myRSPendMsg.Open "PendingMsg", myConn, , adLockOptimistic, adCmdTable
curDate = Date()
myRSPendMsg.AddNew
myRSPendMsg("AuthenticationKey") = AuthenticationKey
myRSPendMsg("Name") = Name
myRSPendMsg("MobileNumber") = RecMoNum
myRSPendMsg("Message") = Sms
myRSPendMsg("TypeofMessage") = myType
myRSPendMsg("ConfirmationRequired") = Confirmation
myRSPendMsg("MessageDate") = curDate
myRSPendMsg("DeliveryDate") = DeliveryDate
myRSPendMsg.Update
If (Strcomp(myResponse,"yes",vbTextCompare) = 0) Then
Set myRSPendConf = Server.CreateObject("ADODB.Recordset")
myRSPendConf.Open "pendConfirmation", myConn, , adLockOptimistic, adCmdTable
Do while not myRSPendConf.eof
if (StrComp(myRSPendConf("AuthenticationKey") ,_
AuthenticationKey ,vbBinaryCompare)=0) Then
confirmationtag = myDoc.CreateElement("Confirmation")
confmessagetag = myDoc.createElement("Message")
confmessagetext=myDoc.createTextNode(myRSPendConf( "ConfirmationMessage"))
confmessagetag.appendchild(confmessagetext)
confirmationtag.appendchild(confmessagetag)
confmobiletag = myDoc.createElement("Mobile")
confmobiletext=myDoc.createTextNode(myRSPendConf(" MobileNumber"))
confmobiletag.appendchild(confmobiletext)
confirmationtag.appendchild(confmobiletag)
confDatetag = myDoc.createElement("Date")
confDatetext=myDoc.createTextNode(myRSPendConf("Me ssageDate"))
confDatetag.appendchild(confDatetext)
confirmationtag.appendchild(confDatetag)
confddatetag = myDoc.createElement("dDate")
confddatetext=myDoc.createTextNode(myRSPendConf("D eliveryDate"))
confddatetag.appendchild(confddatetext)
confirmationtag.appendchild(confddatetag)
responsetag.appendchild(confirmationtag)
End If
Loop
' myDoc.save(Server.mappath("myxml.xml"))
response.write(myDoc.xml)
myRSPendConf.Close
Set myRSPendConf = Nothing
end if
myRSCustInfo.Close
Set myRSCustInfo = Nothing
myRSPendMsg.Close
Set myRSPendMsg = Nothing
myConn.Close
Set myConn = Nothing
%>
|