Archived Forum Post

Index of archived forum posts

Question:

Delphi DLL HCkRsa fails on 2nd and subsequent calls

Sep 15 '15 at 20:13

This on a call to Xero.

I am upgrading from ActiveX to DLL's. I am using Delphi 2010 which may not be recommended for the DLL product but everything else is working, i.e. HTTP, Request and Response.

As soon as I introduce the RSA calls the first calls works and 2nd and subsequent fail with a 500 server error. If anyone can confirm that this is just a Delphi 2010 problem I will put the upgrade on hold until 2016. This is the event log for the failing call...

SocketConnect: 127.0.0.1:8888
SocketConnected: 127.0.0.1:8888
SslHandshake: Starting
SslHandshake: Finished
HttpRequestBegin: GET,/api.xro/2.0/Accounts
RequestHeader: Content-Type: text/xml
Authorization: OAuth realm="https://api.xero.com/api.xro/2.0/", oauth_signature_method="RSA-SHA1", oauth_timestamp="1442222184", oauth_nonce="1808283F6F87A151622A7BE2BCD66EAD", oauth_version="1.0", oauth_consumer_key="NRYGNNO7K7YDFCGN2WXAZVQ9P6DQQT", oauth_token="NRYGNNO7K7YDFCGN2WXAZVQ9P6DQQT", oauth_signature="%B3B0%2E5%81E0%467rP6fw4RFsgjeIAmpZHfFUqLX%2FU8l5jP%2BGuyX5Xzg7aCioBKaOUO8ZsAWXtqaQXFXtPUcvMSUFDgSF2EhJZs6fRx%2Bc82ZEUWcg4loQIjnh8BcJHwlxDXZaFw94VZ%2BDk0Y%2F2nHeWK222W8Caz%2BcYNyZVjuAFOCC7jklsU0wEY%3D"
Host: api.xero.com
Content-Length: 0

StartSendingRequest: 618
HttpInfo: Begin reading response
RecvByteCount: 5
RecvBytesPerSec: 9
ResponseHeader: HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/html; charset=utf-8
X-S: 445761-O1VMAP04
Strict-Transport-Security: max-age=31536000
Date: Mon, 14 Sep 2015 09:16:26 GMT
Content-Length: 6118

SendByteCount: 677
SendBytesPerSec: 1272
RecvByteCount: 293
RecvBytesPerSec: 550
HttpStatusCode: 500
ResponseContentLength: 6118
HttpInfo: Begin reading response body...
PercentDone: 100
RecvByteCount: 6474
RecvBytesPerSec: 12169
StatusCode: 500
StatusLine: HTTP/1.1 500 Internal Server Error

This is for the one that works...

SocketConnect: 127.0.0.1:8888
SocketConnected: 127.0.0.1:8888
SslHandshake: Starting
SslHandshake: Finished
HttpRequestBegin: GET,/api.xro/2.0/Accounts
RequestHeader: Content-Type: text/xml
Authorization: OAuth realm="https://api.xero.com/api.xro/2.0/", oauth_signature_method="RSA-SHA1", oauth_timestamp="1442223641", oauth_nonce="846E2EC50D87DEF6F3BB42E481A37AAA", oauth_version="1.0", oauth_consumer_key="NRYGNNO7K7YDFCGN2WXAZVQ9P6DQQT", oauth_token="NRYGNNO7K7YDFCGN2WXAZVQ9P6DQQT", oauth_signature="wD%2FQxBZb6ipP0Fgi9SIRPsDOMSZV3ojUedNyh6sm3td0Y1PccjqLOjxL%2FGgfz4u1%2Fr9aALg%2FJB6qPa8n75Aup6A1ejejLSe5V%2F8TlAmx58aQmKjlr2R3mLPaMJiwX68U5ULL4vfyeiCwmfjIg4DxgJI55BEoTExy1rLMUdm7S%2Fo%3D"
Host: api.xero.com
Content-Length: 0

StartSendingRequest: 604
HttpInfo: Begin reading response
RecvByteCount: 5
RecvBytesPerSec: 4
ResponseHeader: HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 57615
Content-Type: text/xml; charset=utf-8
X-S: 445760-O1VMAP03
WWW-Authenticate: OAuth Realm="api.xero.com"
X-S: 445760-O1VMAP03
Strict-Transport-Security: max-age=31536000
Date: Mon, 14 Sep 2015 09:40:43 GMT

SendByteCount: 661
SendBytesPerSec: 587
RecvByteCount: 341
RecvBytesPerSec: 303
HttpStatusCode: 200
ResponseContentLength: 57615
HttpInfo: Begin reading response body...
PercentDone: 5
PercentDone: 7
PercentDone: 10
PercentDone: 12
PercentDone: 15
PercentDone: 22
PercentDone: 25
PercentDone: 27
PercentDone: 28
RecvByteCount: 16511
RecvBytesPerSec: 12008
PercentDone: 56
PercentDone: 82
PercentDone: 85
RecvByteCount: 49523
RecvBytesPerSec: 30759
PercentDone: 100
RecvByteCount: 58323
RecvBytesPerSec: 36225

Accepted Answer

I have put it down to using the DLL's in Delphi 2010. Not a good idea. I swapped to the ActiveX component and it all works beautifully :-)