NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Problem printing in web service application from server

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
jeffreehy



Joined: 21 May 2009
Posts: 1

PostPosted: Thu May 21, 2009 4:56 pm    Post subject: Problem printing in web service application from server Reply with quote

Hi all,

I develop a Web Service Client application in Tomcat and Axis2, using NetBeans, This applications acces SQL Server Data Bases, and connects to the Web Service Provider trough internet, everithing goes ok, when I run the application locally , I mean I deploy the application in Tomcat/Axis2 in my local computer I consume the Web Service, them when I got the response from the Web Service provider I have to print (save) the informattion to a local file, and after save it, print the ifo to a phisical printer. this is done OK. but when I deploy de Application in >Tomcat/Axis2 in the server it does not print. how can I do to address the file to the client computer insted of the server? the following is part of the code I use to save and print the file.

Code:


FileOutputStream os = new FileOutputStream("C:/HONDUTEL/recibo.log");
// FileOutputStream os = new FileOutputStream("C:/HONDUTEL/CEIBENA/recibo.log");
PrintStream ps = new PrintStream(os);
ps.println(" ORGANIZACION DE DESARROLLO EMPRESARIAL FEMENINO");
ps.println(" O D E F ");
ps.println(" ======================================== ");
ps.println(" ");
ps.println("Por LPS, : " valortotalapagar.getValue().toString());
ps.println(" NĂºmero de Telefono = " algo );
ps.println(" " nombre.getValue().toString());

ps.println(" V A L O R P A G A D O = " valortotalapagar.getValue().toString());


ps.close();

String filename = ("C:/HONDUTEL/recibo.log"); // THIS IS THE FILE I WANT TO PRINT

PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE; // MY FILE IS .txt TYPE
PrintService printService[] =
PrintServiceLookup.lookupPrintServices(flavor, pras);
PrintService defaultService =
PrintServiceLookup.lookupDefaultPrintService();

PrintService servicex = ServiceUI.printDialog(null, 200, 200,
printService, defaultService, flavor, pras);

if (service != null) {

DocPrintJob job = servicex.createPrintJob();

FileInputStream fis = new FileInputStream(filename);

DocAttributeSet das = new HashDocAttributeSet();

Doc doc = new SimpleDoc(fis, flavor, das);

job.print(doc, pras);

Thread.sleep(10000);

}





Thanks in advance.

Jeff.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo