4 Replies Latest reply: Jan 22, 2014 6:43 AM by I_love_bits RSS

soap in APEX

I_love_bits Newbie
Currently Being Moderated

Hy experts,

 

Does anybody have some experience with sending a pdf from a web service to a printer?

I think I will need a soap call for this purpose.

Is this possible with APEX?

 

I would appreciate some hints.

 

Kind regards,

ilb

  • 1. Re: soap in APEX
    TexasApexDeveloper Guru
    Currently Being Moderated

    You do understand that a printer doesn't know what a pdf file is right? A print server would accept a print job from a process and the print it, so your web service will need to convert your pdf into a print job and then go from there...

     

    What exactly are you trying to accomplish?  If you explain HOW Your PDF was built maybe a solution can be had from that....

     

    Thank you,

     

    Tony Miller

    LuvMuffin Software

    Ruckersville, VA

  • 2. Re: soap in APEX
    I_love_bits Newbie
    Currently Being Moderated

    Hy and thanks for your replay texasApexDeveloper,


    Description:

     

    Right now I'm just looking for the right way, so this is not reaaaly a problem description.

     

    We will have a terminal where the user will interact with our apex-application. If the user will choose to print a particular pdf, the pdf is generate (of course) on the server side.

     

    Actually I don't know exactly how to generate this pdf... but I think this is the smaller problem

    The real problem for me right now is: How to get the pdf from the server to the client and in addition print the pdf automatically in the terminal!

    I guess I need a windows service which captures a soap call from the apex server and generates a print job. (Am I wrong?)

     

    I have read, that we can send base64 data with soap... So I would have to convert the pdf to a base64 string and put it in the soap call...

     

    Thanks for your help,

    ilb

  • 3. Re: soap in APEX
    Mike Kutz Expert
    Currently Being Moderated

    If you can stick with APEX's reporting capabilities, read Oracle's white paper:  http://www.oracle.com/technetwork/developer-tools/apex/learnmore/custom-pdf-reports-1953918.pdf

     

    From there:

    APEX_UTIL.download_print_document() is used to allow the client machine to 'download' the PDF (which will allow the end-user to manually print the PDF)

    APEX_UTIL.get_print_document() will return a BLOB with the PDF

    APEX_WEB_SERVICE.BLOB2CLOBBase64() already exists

     

    Remember, a server (eg Oracle, GlassFish, APEX, etc.) is not allowed to run code on client machines.

    You'll have to "print from the server".

     

    As you have suggested, building a SOAP Service Provider could work.

     

    However, I'm more familiar with FILE_UTL and DBMS_SCHEDULER than creating SOAP Providers.

    This is how I would solve it:

    • Write the PDF BLOB to DB file system using FILE_UTL
    • Run a batch script that prints the file using DBMS_SCHEDULER (lp on unix, acrord.exe on windows.  google to find proper command line switches)
    • I believe the Oracle Scheduler Agent would need to be installed and configured. (part of Oracle Client Install CD)

     

    suggestion

    Printers don't always act nicely

    wrap all of the code in a procedure (in a package) so that it can be re-ran with the click of a button (on any page) when the printer decides to eat the paper.

     

    MK

  • 4. Re: soap in APEX
    I_love_bits Newbie
    Currently Being Moderated

    First of all: thanks for the hints. now I have a good idea how to generate the pdf and how to convert it to base64. I really appreciate it.

     

    What I do not understand completely is the second point here:

     

    However, I'm more familiar with FILE_UTL and DBMS_SCHEDULER than creating SOAP Providers.

    This is how I would solve it:

    • Write the PDF BLOB to DB file system using FILE_UTL
    • Run a batch script that prints the file using DBMS_SCHEDULER (lp on unix, acrord.exe on windows.  google to find proper command line switches)
    • I believe the Oracle Scheduler Agent would need to be installed and configured. (part of Oracle Client Install CD)

     

     

    With "dbms_scheduler" I am able to run 'external' programms (I think so). I'm sure there is an easy way to print the saved pdf.

    But the print-command is still executed on the server.

    I need the pdf to be printed on the client.

     

    kind regards,

    Ilb

     

    ps.: (the client does not have a network capable printer)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points