Reply
Contributor
Posts: 11
Registered: ‎11-29-2011

Re: Problems getting ARB transaction subscriptions to save

Maybe this? Sounds like the default is ASCII / TEXT. Not the same as text/xml? I would imagine binary would not work.

 

.transfermodeinteger 0-1
Sets the http transfer mode:

0 = ascii / text
1 = binary
Defaults is:
0 ascii mode

Notes: You must set "binarysaveas" using a full path and file name.

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Problems getting ARB transaction subscriptions to save

Look like is just

inet.addHTTPHeaders "content-type","text/xml"

 

Contributor
Posts: 11
Registered: ‎11-29-2011

Re: Problems getting ARB transaction subscriptions to save

Thank you, sorry I missed that in the documentation. Now I get:

 

<?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00003</code><text>Root element is missing.</text></message></messages></ErrorResponse>

 

My XML is attached. It looks accurate to me, do you see anything?

 

<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
	<merchantAuthentication>
		<name></name>
		<transactionKey></transactionKey>
	</merchantAuthentication>
	<refId>Campaign 2012</refId>
	<subscription>
		<name>Campaign 2012</name>
		<paymentSchedule>
			<interval>
				<length>1</length>
				<unit>months</unit>
			</interval>
			<startDate>2011-12-01</startDate>
			<totalOccurrences>12</totalOccurrences>
		</paymentSchedule>
		<amount>12.00</amount>
		<payment>
			<creditCard>
				<cardNumber></cardNumber>
				<expirationDate>2014-04</expirationDate>
			</creditCard>
		</payment>
		<order>
			<invoiceNumber>12431</invoiceNumber>
		</order>
		<customer>
			<id>10000</id>
			<email>brad@bbdesign.com</email>
			<phoneNumber>610-693-6080</phoneNumber>
			<faxNumber></faxNumber>
		</customer>
		<billTo>
			<firstName>Brad</firstName>
			<lastName>Bansner</lastName>
			<company>BB Design</company>
			<address>245 Lamms Mill Road</address>
			<city>Wernersville</city>
			<state>PA</state>
			<zip>19565</zip>
			<country>UNITED STATES</country>
		</billTo>
	</subscription>
</ARBCreateSubscriptionRequest>
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: Problems getting ARB transaction subscriptions to save

Looks ok to me too, but are you sure it's actually being sent? Try posting to a URL of yours instead and then log the post.

Contributor
Posts: 11
Registered: ‎11-29-2011

Re: Problems getting ARB transaction subscriptions to save

I'm not quite sure how to do that. If I change this:

 

call inet2.openurl("https://api.authorize.net/xml/v1/request.api","GET")

 

...to something like this:

 

call inet2.openurl("http://www.mydomain.com/test.asp","GET")

 

How do I make test.asp accept the data? I normally have a variable, but I don't think there is a variable in this case? If I can get the (hopefully) incoming data, then I can store it to a DB and verify.

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Problems getting ARB transaction subscriptions to save

[ Edited ]

Try

 

inet.bypassUrlEncodeOnPost = 1
This will disable automatic urlencoding of post variables.

 

 And

 

Maybe it need the content length set, you need to change the ??? to the right length. I read that sometime there are issue with asp when sending "text/xml" without it.

inet.addHTTPHeaders "Content-Length","???"

Contributor
Posts: 11
Registered: ‎11-29-2011

Re: Problems getting ARB transaction subscriptions to save

I tried adding inet2.bypassUrlEncodeOnPost=1 but that had no affect. I tried adding this simple script to an ASP document that attemps to save the results:

 

<% for each item in request.querystring
cn1.execute("insert into tbl_log (timestamp, log) values ('" & now & "', '" & replace(request.querystring(item),"'","''") & "')")
next %>

 

I did not get anything in that table. But not sure how the component actually sends GET data when its an XML document. It handles regular POST and GET data differently than XML. I.e.:

 

This feature is an extension of the standard http POST method. To use this feature, use the same syntax as the POST example, but DO NOT call inet.addpostvars(). Instead, use the inet.xml property. The XML feature will work with Ebay's Web Services API. This feature was tested using the UPS website to return shipping rates. This requires a valid password from UPS. ( http://www.ups.com )

 

Regarding Content-Length... you mean the length of the XML I am sending? I would just count up all the characters before sending? If so, how does it handle tabs and line breaks, do those count toward the content-length? I haven't worked with that type of thing before.

 

Thank you!

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Problems getting ARB transaction subscriptions to save

For the Content-Length, it is the XML that you are sending. Should be able to use

len(xml)

 

Contributor
Posts: 11
Registered: ‎11-29-2011

Re: Problems getting ARB transaction subscriptions to save

Guys, thanks for all the help. As far as I can tell, my XML is perfect. But my KHTTP component is not communicating with the API. Can you recommend some other component I can install on a Microsoft server that has been proven to work with Authorize.Net ARB transactions? Hopefully something inexpensive or free. At this point, I just need to get this thing working for a client who is in a hurry. Thank you!

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Problems getting ARB transaction subscriptions to save

Sample code "CIM - ASP Classic" use XML to communicating with authorize.net. util.asp have the basic code to communicating to them.

It probably just need to change the xml and URL to work with ARB.