Does anyone know of any resources to get help setting up ARB using ASP Classic? I keep getting errors regarding the XML submission. The latest error is "Invalid at the top level of the document. Error processing resource..." I am fairly confident that there are not errors in the XML, so there must be something in the submission or the retrieval of the response.
The only sample files provided show the XML, not how to submit it. I need help posting XML. I have coded ASP for years, but have never had to do XML before now.
Thanks for any help.
Solved! Go to Solution.
โ03-22-2010 05:27 AM
hi dzarro
actully i tried on your code...but its showing invalid token...valiid token is "or"...what does it mean?
โ07-21-2012 03:50 AM
Hi Michell....
i Tried with u r instruction...but still its not working...can u send me the correct code classic asp
โ07-21-2012 03:52 AM
Hey again,
We don't have sample code for ARB in ASP Classic. If that's what you're looking for, you'll need to find that elsewhere. If you're having a problem with any of the code we do have in ASP, then you can post the code and the response you're getting and we can try to troubleshoot.
Thanks,
Michelle
Developer Community Manager
โ07-25-2012 10:23 AM
how disappointing that you cant supply sample code for ASP
โ10-15-2013 02:38 AM
Some of you all have requested sample code. Based on dzarro's original code and later comments, I put together working code for ARB entry using ASP Classic. Here you go:
<%
KID = "recurtest"
theName = "Recur TEST Member Subscription"
theDate = "2015-05-27"
numOccur = "12"
amt = "423.45"
txtCCExp = "2029-07"
txtCCNum = "4111111111111111"
txtBillingFName = "Test"
txtBillingLName = "Person"
txtBillingAddress = "123 E. 4th"
txtBillingZip = "12345"
strTransKey = "xxxxxxxxxxxxxxxx"
apiLogin = "xxxxxxxxxxx"
post_url = "https://apitest.authorize.net/xml/v1/request.api"
strXml = "<?xml version='1.0' encoding='utf-8'?>"
strXml = strXml & "<ARBCreateSubscriptionRequest xmlns='AnetApi/xml/v1/schema/AnetApiSchema.xsd'>"
strXml = strXml & "<merchantAuthentication>"
strXml = strXml & "<name>" & apiLogin & "</name>"
strXml = strXml & "<transactionKey>" & strTransKey & "</transactionKey>"
strXml = strXml & "</merchantAuthentication>"
strXml = strXml & "<refId>" & KID & "</refId>"
strXml = strXml & "<subscription>"
strXml = strXml & "<name>" & theName & "</name>"
strXml = strXml & "<paymentSchedule>"
strXml = strXml & "<interval>"
strXml = strXml & "<length>1</length>"
strXml = strXml & "<unit>months</unit>"
strXml = strXml & "</interval>"
strXml = strXml & "<startDate>" & theDate & "</startDate>"
strXml = strXml & "<totalOccurrences>" & numOccur & "</totalOccurrences>"
'strXml = strXml & " <trialOccurrences>1</trialOccurrences>" & vbcrlf
strXml = strXml & "</paymentSchedule>"
strXml = strXml & "<amount>" & amt & "</amount>"
'strXml = strXml & " <trialAmount>0.00</trialAmount>" & vbcrlf
strXml = strXml & "<payment>"
strXml = strXml & "<creditCard>"
strXml = strXml & "<cardNumber>" & txtCCNum & "</cardNumber>"
strXml = strXml & "<expirationDate>" & txtCCExp & "</expirationDate>"
strXml = strXml & "</creditCard>"
strXml = strXml & "</payment>"
strXml = strXml & "<billTo>"
strXml = strXml & "<firstName>" & txtBillingFName & "</firstName>"
strXml = strXml & "<lastName>" & txtBillingLName & "</lastName>"
strXml = strXml & "<address>" & txtBillingAddress & "</address>"
strXml = strXml & "<zip>" & txtBillingZip & "</zip>"
strXml = strXml & "</billTo>"
strXml = strXml & "</subscription>"
strXml = strXml & "</ARBCreateSubscriptionRequest>"
Set objXMLDOC = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
Set objXMLDOM = Server.CreateObject("Msxml2.DomDocument")
Set oNode = Server.CreateObject("Microsoft.XMLDOM")
'SET CALL TIMEOUTS
lResolve = 8 * 1000 'Timeout values are in milli-seconds
lConnect = 8 * 1000
lSend = 10 * 1000
lReceive = 10 * 1000
objXMLDOC.setTimeouts lResolve, lConnect, lSend, lReceive
'MAKE THE CALL
objXMLDOC.open "POST", post_url, False
objXMLDOC.setRequestHeader "Content-Type", "text/xml"
objXMLDOC.send(strXml)
objXMLDOM.async = false
objXMLDOM.LoadXML objXMLDOC.responseText
'output response to screen (view source to see tags)
'response.write objXMLDOC.responseText & "<br/><br/>"
'PROCESS THE CALL
If objXMLDOM.parseError.errorCode <> 0 Then 'parser error found
Response.Write "parser error found"
Else 'no parser error
'BEGIN CHECK FOR ERROR FROM Authorize.net
'Set oNode = objXMLDOM.getElementsByTagName("*")
'Response.Write "oNode length = " & oNode.length & "<br>"
Set oNode = objXMLDOM.getElementsByTagName("resultCode")
If (oNode.item(0).text="Error") Then
Set oNode = objXMLDOM.getElementsByTagName("text")
Response.Write "Error: " & oNode.item(0).text & "<br>"
Else
'PROCESS SUCCESSFUL CALL
Set oNode = objXMLDOM.getElementsByTagName("subscriptionId")
If (Not oNode Is Nothing) Then
Response.Write "subscriptionId returned " & oNode.item(0).text & "<br>"
else
Response.Write "subscriptionId not returned" & "<br>"
End If
End If
Set oNode = Nothing
End If
Set objXMLDOC = Nothing
Set objXMLDOM = Nothing
%>
โ02-18-2015 08:47 AM
Where I can I get the ASp sample code? it's not on the samples page anywhere...
โ04-14-2016 11:14 AM