cancel
Showing results for 
Search instead for 
Did you mean: 

java DPM relay_response script timing out

Hi, I'm getting this email with every transaction:

 

Your script timed out while we were trying to post transaction results to it.
   Transaction ID: REDACTED (non-zero transaction id number)
Transaction Result: This transaction has been declined.

 

I see that my relay_response.jsp is executing but my browser never lands on the order_receipt.jsp. 

 

Here is my relay_receipt.jsp:

 

<%@ page import="java.util.Map" %>
<%@ page import="net.authorize.*" %>

<%
String apiLoginId = "REDACTED";
String receiptPageUrl = "https://REDACTED.com/order_receipt";
String MD5HashKey = "";

net.authorize.sim.Result result = net.authorize.sim.Result.createResult(apiLoginId, MD5HashKey, request.getParameterMap());
StringBuffer receiptUrlBuffer = new StringBuffer(receiptPageUrl);

if(result != null) {
	receiptUrlBuffer.append("?");
	receiptUrlBuffer.append(ResponseField.RESPONSE_CODE.getFieldName()).append("=");
	receiptUrlBuffer.append(result.getResponseCode().getCode());
	receiptUrlBuffer.append("&");
	receiptUrlBuffer.append(ResponseField.RESPONSE_REASON_CODE.getFieldName()).append("=");
	receiptUrlBuffer.append(result.getReasonResponseCode().getResponseReasonCode());
	receiptUrlBuffer.append("&");
	receiptUrlBuffer.append(ResponseField.RESPONSE_REASON_TEXT.getFieldName()).append("=");
	receiptUrlBuffer.append(result.getResponseMap().get(ResponseField.RESPONSE_REASON_TEXT.getFieldName()));
	
	if (result.isApproved()) {
		receiptUrlBuffer.append("&").append(ResponseField.TRANSACTION_ID.getFieldName()).append("=");
		receiptUrlBuffer.append(result.getResponseMap().get(ResponseField.TRANSACTION_ID.getFieldName()));
	}
}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<script type="text/javascript">
		function redirectReceipt() {
			var referrer = document.referrer;
			if (referrer.substr(0,7)=="http://") referrer = referrer.substr(7);
			if (referrer.substr(0,8)=="https://") referrer = referrer.substr(8);
			if (referrer && referrer.indexOf(document.location.hostname) != 0) {
				document.location = "<%=receiptUrlBuffer.toString()%>";
			}	
		}
	</script>
	<meta http-equiv="refresh" content="0;url=<%=receiptUrlBuffer.toString()%>">
</head>
<body onload="redirectReceipt();">
</body>
</html>

 Any ideas?  I do not have an MD5 hash configured.

ab
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Yeah, ... I had but I was thinking about things all wrong.  For instance, I hadn't yet grokked that the relay response, though it runs on my server, the HTML that is gets generated by it is taken by Authorize Net, and they in turn give it to the customer. 

 

The content encoding meta tag causes problems, and also btw one cannot call remote java scripts at cdns and stuff on your relay response. 

 

Anyway, I wrote a form and had it submit on load with the fields that my receipt needed. 

 

Thank you

View solution in original post

2 REPLIES 2
RaynorC1emen7
Expert

Yeah, ... I had but I was thinking about things all wrong.  For instance, I hadn't yet grokked that the relay response, though it runs on my server, the HTML that is gets generated by it is taken by Authorize Net, and they in turn give it to the customer. 

 

The content encoding meta tag causes problems, and also btw one cannot call remote java scripts at cdns and stuff on your relay response. 

 

Anyway, I wrote a form and had it submit on load with the fields that my receipt needed. 

 

Thank you