为什么这个ofx请求失败?

时间:2015-02-20 05:32:49

标签: curl ofx

我正在尝试下载Janney Montgomery Scott LLC的个人资料,但它没有给我正确的回复。我可以看到,我可以得到它,Intuit OFX Test Tool也是如此。

我抓住OFX测试工具的请求并将其保存为ofx.txt:

OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE

<OFX><SIGNONMSGSRQV1><SONRQ><DTCLIENT>20150220033100<USERID>anonymous00000000000000000000000<USERPASS>anonymous00000000000000000000000<LANGUAGE>ENG<FI>
<ORG>AFS
<FID>11326
</FI>
<APPID>QWIN<APPVER>2000</SONRQ></SIGNONMSGSRQV1><PROFMSGSRQV1><PROFTRNRQ><TRNUID>1424403060<PROFRQ><CLIENTROUTING>MSGSET<DTPROFUP>19970101</PROFRQ></PROFTRNRQ></PROFMSGSRQV1></OFX>

然后我使用curl使用命令

发出请求
curl -v -X POST --data-binary @ofx.txt --header "Content-Type:application/x-ofx" --header "Accept:*/*, application/x-ofx" https://jmsofx.automatedfinancial.com

我得到了这个输出:

* Rebuilt URL to: https://jmsofx.automatedfinancial.com/
*   Trying 147.249.46.82...
* Connected to jmsofx.automatedfinancial.com (147.249.46.82) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: /opt/local/share/curl/curl-ca-bundle.crt
  CApath: none
* TLSv1.2, TLS Unknown, Unknown (22):
* TLSv1.2, TLS handshake, Client hello (1):
* SSLv2, Unknown (22):
* TLSv1.2, TLS handshake, Server hello (2):
* SSLv2, Unknown (22):
* TLSv1.2, TLS handshake, CERT (11):
* SSLv2, Unknown (22):
* TLSv1.2, TLS handshake, Server finished (14):
* SSLv2, Unknown (22):
* TLSv1.2, TLS handshake, Client key exchange (16):
* SSLv2, Unknown (20):
* TLSv1.2, TLS change cipher, Client hello (1):
* SSLv2, Unknown (22):
* TLSv1.2, TLS handshake, Finished (20):
* SSLv2, Unknown (20):
* TLSv1.2, TLS change cipher, Client hello (1):
* SSLv2, Unknown (22):
* TLSv1.2, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES128-SHA
* Server certificate:
*    subject: C=US; ST=Alabama; L=Birmingham; O=SunGard Business Systems LLC; CN=jmsofx.automatedfinancial.com
*    start date: 2014-04-28 00:00:00 GMT
*    expire date: 2015-07-24 23:59:59 GMT
*    subjectAltName: jmsofx.automatedfinancial.com matched
*    issuer: C=US; O=Thawte, Inc.; CN=Thawte SSL CA
*    SSL certificate verify ok.
* SSLv2, Unknown (23):
> POST / HTTP/1.1
> User-Agent: curl/7.40.0
> Host: jmsofx.automatedfinancial.com
> Content-Type:application/x-ofx
> Accept:*/*, application/x-ofx
> Content-Length: 505
> 
* upload completely sent off: 505 out of 505 bytes
* SSLv2, Unknown (23):
< HTTP/1.1 200 OK
< Server: AFS-Prospero/6.32.00
< Date: Fri, 20 Feb 2015 03:41:11 GMT
< Last-modified: Wed, 28 Aug 2013 10:14:42 GMT
< Content-type: text/html
< Content-length: 317
< 
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT"><!--
var host=window.location.hostname;
if(window.location.protocol=="https:") host=window.location.host;
window.location.href='https://'+host+'/secure_login.html';
//-->
</SCRIPT>
<link rel="stylesheet" type="text/css" href="/css/retail_style.css"></head>
* Connection #0 to host jmsofx.automatedfinancial.com left intact
</HTML>

我已尝试使用DOS和UNIX样式的行结尾。

我已经能够通过这种方法连接到其他机构。我究竟做错了什么?

1 个答案:

答案 0 :(得分:0)

要回答我自己的问题,问题出现在curl命令行中 - “content-type:”和“application / x-ofx”之间应该有一个空格:

curl -v -X POST --data-binary @ofx.txt --header "Content-Type: application/x-ofx" --header "Accept:*/*, application/x-ofx" https://jmsofx.automatedfinancial.com