Code: Select all
"OFXHEADER:100\n
DATA:OFXSGML\n
VERSION:102\n
SECURITY:NONE\n
ENCODING:USASCII\n
CHARSET:1252\n
COMPRESSION:NONE\n
OLDFILEUID:oldFileID\n
NEWFILEUID:newFileID\n"
Code: Select all
public OFXResponse getOFXResponse(OFXRequest ofxRequest) throws OFXSignOnException {
System.out.println("*****Sending request*****");
System.out.println(ofxRequest.toString());
PostMethod method = new PostMethod(NW_URL);
RequestEntity request;
String response = null;
try {
request = new StringRequestEntity(ofxRequest.toString(), "application/x-ofx", "UTF-8");
method.setRequestEntity(request);
client.executeMethod(method);
response = method.getResponseBodyAsString();
System.out.println( "Response: " + response); }
catch (UnsupportedEncodingException e) {
//Should never happen
e.printStackTrace(); }
catch (HttpException e) {
e.printStackTrace(); }
catch (IOException e) { .
e.printStackTrace(); } //clean up the connection resources
method.releaseConnection(); //Something must have gone wrong
if (response == null) return null;
OFXResponse ofxResponse = new OFXResponse(response);
//Check for any status errors and throw exceptions if anything is not right
handleResponseStatus(ofxResponse);
return ofxResponse;
}