PDF Generation webservice

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PDF Generation webservice

mibi
I have an orbeon form and when someone has fill out the form, I want it to create a pdf and sent it to my webservice.

Right now, when the form is fill out and you press sent, the document id, app name and form name are sent to the webservice.

Can anyone help me with a guide or an example ?

Best regard
Martin

Reply | Threaded
Open this post in threaded view
|

Re: PDF Generation webservice

Alessandro  Vernet
Administrator
Hi Martin,

I imagine you're using the send action in a process that runs when users submit the form? Then it should just be a matter of adding the parameter content = "pdf-url", and the URL of the PDF should be sent instead of the XML. And as hinted by the value of the parameter, your service won't get the PDF itself, but a URL pointing back to Orbeon Forms, and it can make a GET request to that URL to retrieve the PDF.

https://github.com/orbeon/orbeon-forms/wiki/Form-Runner:-Buttons-and-Processes#send

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: PDF Generation webservice

mibi
Hey Alex,

My Gateway integration looks like this.

<property as="xs:anyURI" name="oxf.fr.detail.send.uri.*.*" value="http://localhost:8090/first/secound/request"/>
    <property
            as="xs:string"
            name="oxf.fr.detail.process.send.*.*"
            value='require-uploads
     then validate-all
     then save-draft

     then send("oxf.fr.detail.send")
     then navigate("/receipt")
     recover error-message(message = "Blanketten kunne ikke indsendes. Kladden er gemt, prøv venligst senere.")'/>

    <property as="xs:boolean" name="oxf.fr.detail.send.success.prune.*.*" value="true"/>


how shall the new one look ?


How do i get the PDF Url at the webservice ?

Best regards
Martin
Reply | Threaded
Open this post in threaded view
|

Re: PDF Generation webservice

mibi
When I add content="pdf-url", I'm getting this error.

Can anyone help me, and tell me why I'm getting it, and how I can fix it?


dd-MM-yyyy HH:mm:ss,SSS}^[PageFlowControllerProcessor]^ ERROR error caught {controller: "oxf:/apps/fr/page-flow.xml", method: "POST", path: "/fr/service/Netcompany/global/pdf/b6fe9122f86956609945125435014f50d595956a"}
dd-MM-yyyy HH:mm:ss,SSS}^[PageFlowControllerProcessor]^ ERROR
+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Got invalid return code while loading resource: http://localhost:8080/bs/xforms-server/bf4532aaf8aa2306e7c|
|4be5f63159bfffe1e20ce/orbeon-0f68c6c7df55d5746bbb48a0c5b3ffe44523795c.css, 403                                        |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/page-flow.xml                                                        |reading page view data output |  92|
|······················································································································|
|element=<service path="/fr/service/([^/^.]+)/([^/^.]+)/(pdf)(/([^/^.]+))?" view="print/print-form.xpl"/>              |
|view   =print/print-form.xpl                                                                                          |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/print/print-form.xpl                                                 |reading processor output      |  57|
|······················································································································|
|element=<p:output name="data" ref="data"/>                                                                            |
|name   =data                                                                                                          |
|ref    =data                                                                                                          |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/print/print-form.xpl                                                 |reading processor output      |  44|
|······················································································································|
|element=<p:output name="data" id="form-pdf"/>                                                                         |
|name   =data                                                                                                          |
|id     =form-pdf                                                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/print/pdf-view.xpl                                                   |reading processor output      |  55|
|······················································································································|
|element=<p:output name="data" ref="data"/>                                                                            |
|name   =data                                                                                                          |
|ref    =data                                                                                                          |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/print/print-pdf-notemplate.xpl                                       |reading processor output      | 104|
|······················································································································|
|element=<p:output name="data" ref="data"/>                                                                            |
|name   =data                                                                                                          |
|ref    =data                                                                                                          |
|----------------------------------------------------------------------------------------------------------------------|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.oxf.common.OXFException                                                                         |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor$1 |resolveAndOpenStream          |XHTMLToPDFProcessor.java      | 131|
|org.xhtmlrenderer.swing.NaiveUserAgent             |getCSSResource                |NaiveUserAgent.java           | 143|
|org.xhtmlrenderer.context.StylesheetFactoryImpl    |parse                         |StylesheetFactoryImpl.java    |  90|
|org.xhtmlrenderer.context.StylesheetFactoryImpl    |getStylesheet                 |StylesheetFactoryImpl.java    | 174|
|org.xhtmlrenderer.context.StyleReference           |readAndParseAll               |StyleReference.java           | 123|
|org.xhtmlrenderer.context.StyleReference           |setDocumentContext            |StyleReference.java           | 107|
|org.xhtmlrenderer.pdf.ITextRenderer                |setDocument                   |ITextRenderer.java            | 176|
|org.xhtmlrenderer.pdf.ITextRenderer                |setDocument                   |ITextRenderer.java            | 143|
|org.orbeon.oxf.processor.pdf.XHTMLToPDFProcessor   |readInput                     |XHTMLToPDFProcessor.java      | 154|
|.processor.serializer.legacy.HttpBinarySerializer$1|readImpl                      |HttpBinarySerializer.java     |  79|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.oxf.common.OXFException                                                                         |
|----------------------------------------------------------------------------------------------------------------------|
|.processor.serializer.legacy.HttpBinarySerializer$1|readImpl                      |HttpBinarySerializer.java     |  85|
|essor.impl.ProcessorOutputImpl$TopLevelOutputFilter|read                          |ProcessorOutputImpl.java      | 258|
|org.orbeon.oxf.processor.impl.ProcessorOutputImpl  |read                          |ProcessorOutputImpl.java      | 404|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.oxf.common.ValidationException                                                                  |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.common.OrbeonLocationException$     |wrapException                 |OrbeonLocationException.scala |  60|
|org.orbeon.oxf.common.OrbeonLocationException      |wrapException                 |OrbeonLocationException.scala |    |
|org.orbeon.oxf.processor.impl.ProcessorOutputImpl  |read                          |ProcessorOutputImpl.java      | 407|
|org.orbeon.oxf.processor.ProcessorImpl             |readInputAsSAX                |ProcessorImpl.java            | 262|
|orbeon.oxf.processor.pipeline.PipelineProcessor$1$1|run                           |PipelineProcessor.java        |  93|
|org.orbeon.oxf.processor.pipeline.PipelineProcessor|executeChildren               |PipelineProcessor.java        | 680|
|org.orbeon.oxf.processor.pipeline.PipelineProcessor|access$000                    |PipelineProcessor.java        |  60|
|g.orbeon.oxf.processor.pipeline.PipelineProcessor$1|readImpl                      |PipelineProcessor.java        |  91|
|essor.impl.ProcessorOutputImpl$TopLevelOutputFilter|read                          |ProcessorOutputImpl.java      | 258|
|org.orbeon.oxf.processor.impl.ProcessorOutputImpl  |read                          |ProcessorOutputImpl.java      | 404|
|org.orbeon.oxf.processor.ProcessorImpl             |readInputAsSAX                |ProcessorImpl.java            | 262|
|orbeon.oxf.processor.pipeline.PipelineProcessor$1$1|run                           |PipelineProcessor.java        |  93|
|org.orbeon.oxf.processor.pipeline.PipelineProcessor|executeChildren               |PipelineProcessor.java        | 680|
|org.orbeon.oxf.processor.pipeline.PipelineProcessor|access$000                    |PipelineProcessor.java        |  60|
|g.orbeon.oxf.processor.pipeline.PipelineProcessor$1|readImpl                      |PipelineProcessor.java        |  91|
|essor.impl.ProcessorOutputImpl$TopLevelOutputFilter|read                          |ProcessorOutputImpl.java      | 258|
|org.orbeon.oxf.processor.impl.ProcessorOutputImpl  |read                          |ProcessorOutputImpl.java      | 404|
|processor.pipeline.choose.ConcreteChooseProcessor$1|readImpl                      |ConcreteChooseProcessor.java  | 125|
|essor.impl.ProcessorOutputImpl$TopLevelOutputFilter|read                          |ProcessorOutputImpl.java      | 258|
|org.orbeon.oxf.processor.impl.ProcessorOutputImpl  |read                          |ProcessorOutputImpl.java      | 404|
|---8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<---|
|org.apache.catalina.core.ApplicationFilterChain    |internalDoFilter              |ApplicationFilterChain.java   | 243|
|org.apache.catalina.core.ApplicationFilterChain    |doFilter                      |ApplicationFilterChain.java   | 210|
|.springframework.web.filter.CharacterEncodingFilter|doFilterInternal              |CharacterEncodingFilter.java  |  88|
|org.springframework.web.filter.OncePerRequestFilter|doFilter                      |OncePerRequestFilter.java     |  76|
|rg.springframework.web.filter.DelegatingFilterProxy|invokeDelegate                |DelegatingFilterProxy.java    | 346|
|rg.springframework.web.filter.DelegatingFilterProxy|doFilter                      |DelegatingFilterProxy.java    | 259|
|org.apache.catalina.core.ApplicationFilterChain    |internalDoFilter              |ApplicationFilterChain.java   | 243|
|org.apache.catalina.core.ApplicationFilterChain    |doFilter                      |ApplicationFilterChain.java   | 210|
|org.apache.catalina.core.StandardWrapperValve      |invoke                        |StandardWrapperValve.java     | 222|
|org.apache.catalina.core.StandardContextValve      |invoke                        |StandardContextValve.java     | 123|
|org.apache.catalina.core.StandardHostValve         |invoke                        |StandardHostValve.java        | 171|
|org.apache.catalina.valves.ErrorReportValve        |invoke                        |ErrorReportValve.java         |  99|
|org.apache.catalina.core.StandardEngineValve       |invoke                        |StandardEngineValve.java      | 118|
|org.apache.catalina.connector.CoyoteAdapter        |service                       |CoyoteAdapter.java            | 408|
|org.apache.coyote.http11.AbstractHttp11Processor   |process                       |AbstractHttp11Processor.java  |1023|
|e.coyote.AbstractProtocol$AbstractConnectionHandler|process                       |AbstractProtocol.java         | 589|
|.apache.tomcat.util.net.JIoEndpoint$SocketProcessor|run                           |JIoEndpoint.java              | 312|
|java.util.concurrent.ThreadPoolExecutor            |runWorker                     |ThreadPoolExecutor.java       |1145|
|java.util.concurrent.ThreadPoolExecutor$Worker     |run                           |ThreadPoolExecutor.java       | 615|
|java.lang.Thread                                   |run                           |Thread.java                   | 744|
+----------------------------------------------------------------------------------------------------------------------+
Reply | Threaded
Open this post in threaded view
|

Re: PDF Generation webservice

mibi
I have found out that i can get the css file, if i change the port from 8080 to 8081 and run it in a browser.

How do i get orbeon to change the port to 8081, when requesting the css ?