Hello,
I have written a webservice method which return byte[] of a pdf file
the code snippet is as follows:
public byte[] getStatement(String cardNo, String statementDate) {
byte[] returnValue = null;
try {
Class.forName(formsParameter.getDriver());
con = DriverManager.getConnection(formsParameter.getUrl(),
formsParameter.getUsername(), formsParameter.getPassword());
statement = con.createStatement();
ResultSet resultSet = statement
.executeQuery("SELECT \"pdfFileName\" ap, \"pdfFileId\", \"cycleId\" ac FROM \""
+ formsParameter.getSchema()
+ "\".\"pdffiles\" WHERE \"accountID\" = '" + cardNo + "' AND \"pdfFileStatementDate\" = TO_DATE('" + statementDate + "', 'YYYY-MM-DD')");
if (resultSet.next()){
File pdfFile = new File(formsParameter.getStatementDrive() + "//" +
formsParameter.getStatementRoot() + "//" +
formsParameter.getStatementStore() + "//" +
resultSet.getInt("ac") + "//" +
resultSet.getString("ap"));
returnValue = getBytesFromFile(pdfFile);
}
con.close();
} catch (Exception ex) {
ex.printStackTrace();
returnValue = null;
} finally {
return returnValue;
}
}
this webservice method when invoded through a java webservice client, displays the pdf file on the web browser code snippet :
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setHeader("Content-disposition",
"inline; filename=statement.pdf");
ServletOutputStream oOutput = response.getOutputStream();
ABBCCStmtPortTypeProxy aBCCStmtPortTypeProxy = new ABCCStmtPortTypeProxy();
byte[] bytes = abCCStmtPortTypeProxy.getStatement(
"4718610100014696", "2008-08-20");
oOutput.write(bytes);
}
However when this webservice method is invoked through a .NET application it fails.
Any comment or help on this please
——————————
Regards,
Ashish Saraf