cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up ARB using ASP Classic

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.

dzarro
Member
1 ACCEPTED SOLUTION

Accepted Solutions

It turns out that I had three problems.  The authorization name was not correct.  The date format was not correct.  And I was not properly parsing the return XML.  I ended up hiring one of the certified developers to help me troubleshoot the problem.  He was willing to fix it for a reasonable price.  It wasn't very "broken" so it did not take much time.

 

Thanks for your responses and your help.

View solution in original post

15 REPLIES 15

Greetings,

 

Please post a code sample on how you're parsing the xml document.

 

Thank You!

soundcommerce
Trusted Contributor
Trusted Contributor

Thank you for looking at this.

 

This is the XML...

 

strXml = "<?xml version='1.0' encoding='utf-8'?>"
strXml = strXml & "<ARBCreateSubscriptionRequest xmlns='AnetApi/xml/v1/schema/AnetApiSchema.xsd'>"
strXml = strXml & "<merchantAuthentication>"
strXml = strXml & "<name>ACC Test</name>"
strXml = strXml & "<transactionKey>" & strTransKey & "</transactionKey>"
strXml = strXml & "</merchantAuthentication>"
strXml = strXml & "<refId>" & KID & "</refId>"
strXml = strXml & "<subscription>"
strXml = strXml & "<name>Cockapoo Find Member Subscription</name>"
strXml = strXml & "<paymentSchedule>"
strXml = strXml & "<interval>"
strXml = strXml & "<length>1</length>"
strXml = strXml & "<unit>months</unit>"
strXml = strXml & "</interval>"
strXml = strXml & "<startDate>" & date() & "</startDate>"
strXml = strXml & "<totalOccurrences>12</totalOccurrences>"
'strXml = strXml & "      <trialOccurrences>1</trialOccurrences>" & vbcrlf
strXml = strXml & "</paymentSchedule>"
strXml = strXml & "<amount>" & request.Form("amt2") & "</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>"

 

---------------------

And this is the code that sends it.....

 

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
'set objXMLDOM = objXMLDOC.responseXML

'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>"
If (Not oNode Is Nothing) Then
Response.Write oNode.item(0).text & "<br>"
Else
'PROCESS SUCCESSFUL CALL
Set oNode = objXMLDOM.getElementsByTagName("subscriptionId")
If (Not oNode Is Nothing) Then
Response.Write "subscriptionId returned" & "<br>"
else
Response.Write "subscriptionId not returned" & "<br>"
End If


'End If

'CLEAN UP EVERYTHING
Set objXMLDOC = Nothing
Set objXMLDOM = Nothing
Set oNode = Nothing

End If
End If

Greetings,

 

Please try processing the root node first. Seems like the DOM Parser can't find the subscriptionId element without processing the root element first.

 

ARBCreateSubscriptionResponse <-- Root Element
soundcommerce
Trusted Contributor
Trusted Contributor

It turns out that I had three problems.  The authorization name was not correct.  The date format was not correct.  And I was not properly parsing the return XML.  I ended up hiring one of the certified developers to help me troubleshoot the problem.  He was willing to fix it for a reasonable price.  It wasn't very "broken" so it did not take much time.

 

Thanks for your responses and your help.

Glad you were able to get it resolved.

 

Thanks!

soundcommerce
Trusted Contributor
Trusted Contributor

Hi dear,

 

I think I will face same problem you had.

How did you accomplish your ARB with other's help?

Is it possilbe that the ARB can be done with in classic ASP?

Only language what I know it that ASP with some basic XML.

I need to integrate with my subscription website.

 

Give some your advice for the late comer with ASP.

 

Best,

David

Can you please share your working code with others. Thanks

hi all,

 

             how to implement Automated Recurring Billing (ARB)  on authorize.net using classic asp,

           Please help me any one

            

thanks

Kamal.S

Hey Kamal.S,

 

You can check out our sample code page for some examples of AIM/SIM in ASP Classic. Then for more info on ARB, please have a look at our ARB guides. Hopefully this will help you out.

 

Thanks,

 

Michelle

Developer Community Manager