Expand my Community achievements bar.

Invoking LiveCycle API methods using PHP WebService

Avatar

Level 2

Hello experts

Has anyone some experience in invoking LC ES3 API methods using PHP WebService?

I am chiefly interested in method (renderPDFForm I think…) which will render a PDF form merging XDP template and corresponding XML data inside browser.

Please note I would prefer to avoid writing Java code. I would like to do following:

1. Setup LC ES3 server (with minimal number of modules) to serve as PDF rendering service merging XDP templates with corresponding XML data. I would also like to Reader Extend rendered PDF forms (presumably I will need to purchase additionally Reader Extensions module) so users will be able to save data locally prior to submitting data back to the server.

2. Create web application (PHP backend). This application will allow users to download forms (Reader Extended PDFs) onto their PCs. When user will request download of particular form I want to use PHP WebService to call LiveCycle server and render (merging template with existing data, if applicable) form Reader Extending it.

Has anyone got any experience in such setup? I have found one example of such code (I am yet to try it) but I did not find any documentation on Adobe website. All examples I have found involved coding in Java (which I would like to avoid).

I am also considering setting up PHP to Java bridge so I can call Java code from my PHP methods. Having said that, I'd rather keep it as simple as possible, hence I would like to use WebServices instead. Problem is that there are virtually no examples for such integration.

I will appreciate any help/suggestions.

Regards

Michael

2 Replies

Avatar

Level 2

I have managed to authenticate and consume WebService however I did not get far in terms of getting any results back from method renderPDFForm. I think that there is something wrong with my input parameters.

My test case if as follows:

1) XDP template C:\Users\Michael\Desktop\LoanApplication\LoanApplication.xdp

2) XML data C:\Users\Michael\Desktop\LoanApplication\LoanApplication.xml

I am trying to merge these 2 calling method renderPDFForm (utilizing WebService of module FormsService).

Ideally I would not like to store my templates inside LiveCycle but to store them in my application effectively using LiveCycle server only as a rendering engine and Reader Extensions issuer.

I have created following array in PHP:

array(5) {

  ["formQuery"]=>

  string(19) "LoanApplication.xdp"

  ["inDataDoc"]=>

  array(1) {

    ["remoteURL"]=>

    string(60) "C:\Users\Michael\Desktop\LoanApplication\LoanApplication.xml"

  }

  ["pdfFormRenderSpec"]=>

  array(6) {

    ["cacheEnabled"]=>

    string(4) "true"

    ["locale"]=>

    string(5) "en_US"

    ["XMLData"]=>

    string(4) "true"

    ["linearizedPDF"]=>

    string(5) "false"

    ["standAlone"]=>

    string(5) "false"

    ["taggedPDF"]=>

    string(5) "false"

  }

  ["urlSpec"]=>

  array(3) {

    ["applicationWebRoot"]=>

    string(33) "http://localhost/LoanApplication/"

    ["contentRootURI"]=>

    string(41) "C:\Users\Michael\Desktop\LoanApplication\"

    ["targetURL"]=>

    string(0) ""

  }

  ["attachments"]=>

  NULL

}

and I am passing it when calling method renderPDFForm. Sadly, I am getting error I am not able to decipher:

SoapFault exception: [soapenv:Server.userException] javax.ejb.EJBException: RuntimeException in C:\Program Files (x86)\Zend\Apache2\htdocs\LoanApplication\index.php:33

Stack trace:

#0 C:\Program Files (x86)\Zend\Apache2\htdocs\LoanApplication\index.php(33): SoapClient->__call('renderPDFForm', Array)

#1 C:\Program Files (x86)\Zend\Apache2\htdocs\LoanApplication\index.php(33): SoapClient->renderPDFForm(Array)

#2 {main}

Can anyone help me to make some sense out of this message? Perhaps I need to setup a trace to get more information. How can I do that?

Can someone advise me if I am going in the right direction? Perhaps I should be storing these templates inside LiveCycle repository after all. Please note I do not want to use LiveCycle interface. I will need to create whole new application (both frontend and backend) around LC, using LC only as rendering engine and Reader Extensions issuer (as previously mentioned).

Any help/advice would be greatly appreciated.

Regards

Michael

Avatar

Level 2

I have decided to use PDF template (instead of XDP).

That resulted in following error message:

SoapFault exception: [soapenv:Server.generalException] BLOB.remoteURL field containes a malformed URL: C:\Users\Michael\Desktop\LoanApplication\LoanApplication.xml in C:\Program Files (x86)\Zend\Apache2\htdocs\LoanApplication\index.php:34

Does it mean that method renderPDFForm will not accept absolute paths (note that path in the error message is valid)?

How else can I setup this test case? Normally templates would be stored inside application created in Workbench but since I do not need an application, where shall I store my templates? Do I need to setup some dummy application just to serve as a container for my templates? Can someone please advise me on best approach here?

Regards

Michael