cancel
Showing results for 
Search instead for 
Did you mean: 

Using WebDynpro api's in java Application

former_member187990
Participant
0 Kudos

Hi all,

Let me explain what i am doing.

I am trying to use WebDynPro API's in java.

With the help of the e-learning by Angel Dichev on Extracting xml data from PDF using WebDynPro Api's,I created an ejb in which the code for data extraction is placed in a business methos which accepts pdf content as inputstream and gives back the xml output as string.I have created a java application which will call the ejb method and supply the input to the EJB.I have given the runtime references in the ear file which is deployed in the server.

For some pdf contents (passed as inputstream) exceptions are raised and for some the output comes perfectely.

Please tell me what i am missing and where

I am posting the exception for your understanding

Error : com.sap.tc.webdynpro.pdfobject.core.PDFObjectRuntimeException:

Processing exception during a "GetData" operation.

Request start time: Fri Dec 21 19:12:34 IST 2007

com.adobe.ads.exception.FailedCreationException:

Specific error information:

$$$/Err/PDFCommands/PDFlibError=: PDF command failed due to PDFlib error: ^0

The file is damaged and could not be repaired.

General error information:

IDL:com/adobe/document/pdf/PDFOperationFailure:1.0

Exception Stack Trace:

com.adobe.ads.exception.FailedCreationException:

Specific error information:

$$$/Err/PDFCommands/PDFlibError=: PDF command failed due to PDFlib error: ^0

The file is damaged and could not be repaired.

General error information:

IDL:com/adobe/document/pdf/PDFOperationFailure:1.0

* at com.adobe.EJB_PDFAgent.getRemotePdfDocument(Unknown Source)*

* at com.adobe.EJB_PDFAgent.getFormType(Unknown Source)*

* at com.adobe.ads.request.GetData.execute(Unknown Source)*

* at com.adobe.BaseADSRequest.doWork(Unknown Source)*

* at com.adobe.AdobeDocumentServicesWorker.execute(Unknown Source)*

* at com.adobe.AdobeDocumentServicesEJB.processRequest(Unknown Source)*

* at com.adobe.AdobeDocumentServicesEJB.rpData(Unknown Source)*

* at com.adobe.AdobeDocumentServicesLocalLocalObjectImpl0.rpData(AdobeDocumentServicesLocalLocalObjectImpl0.java:120)*

* at sun.reflect.GeneratedMethodAccessor2225.invoke(Unknown Source)*

* at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)*

* at java.lang.reflect.Method.invoke(Method.java:324)*

* at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)*

* at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:157)*

* at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:79)*

* at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)*

* at SoapServlet.doPost(SoapServlet.java:51)*

* at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)*

* at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)*

* at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)*

* at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)*

* at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)*

* at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)*

* at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)*

* at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)*

* at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)*

* at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)*

* at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)*

* at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)*

* at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)*

* at java.security.AccessController.doPrivileged(Native Method)*

* at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)*

* at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)*

Caused by: com.adobe.document.pdf.PDFOperationFailure: IDL:com/adobe/document/pdf/PDFOperationFailure:1.0

* at com.adobe.document.pdf.PDFOperationFailureHelper.read(PDFOperationFailureHelper.java:67)*

* at com.adobe.document.pdf._PDFFactoryStub.openPDF(_PDFFactoryStub.java:29)*

* ... 32 more*

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member187990
Participant
0 Kudos

Hi Angel Dichev ,

Thanks for the support given by you.

The problem was in the transeferring of data to the business method.

The solution given by was very helpful.

Regards

Satish Kumar SV

reema
Associate
Associate
0 Kudos

Hi Satish,

I also need to do exactly same thing as explained by you above.

Could you please share some info/code details on this.

I am continously facing the exception which you were facing.

Thanks & Best Regards,

Reema

former_member187990
Participant
0 Kudos

Hi,

I have given the Reference in the EAR file.

I will explain what i have to do.

I will get a pdf as Inputstream from the mail.

I have to send the inputstream to the ejb method for extracting xml data.

So i created a proxy class which will call the ejb method.

In the proxy class,i will convert the stream to byte array and send that to the ejb method.(I can't pass the inputstream directly to ejb,because of serialization problem).In the business method i convert the byte array to Stream and processed further with the Webdynpro API's to get the xml data

For some pdf's,i can able to extract the xml data.But for some it is raising exception.

The Exception is : com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentRuntimeException: PDFDocument Processor failed to process InputPDF Request.

I am using IWDPDFDocumentHandler,IWDPDFDocumentAccessibleContext,IWDPDFDocument API's

The exception is raised at the place where execute method is called.

Is there any problem in sending the data as byte array to the business method.

Regards

Satish

former_member187990
Participant
0 Kudos

Hi,

I tried the business logic in the WD Application.It is working fine.

Scenario: I need to pass the pdf as inputstream to the the ejb which will give back the xml data.

Any runtime reference is needed.

angel_dichev
Active Participant
0 Kudos

Hi,

mostlikely you'll need references to runtime webdynpro and PDF API.

So you'll need to create entried in the EAR file -> application-j2ee-engine.xml like these:

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="service">webdynpro</reference-target>

</reference>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="library">tc/wd/pdflib</reference-target>

</reference>

Regards,

angel_dichev
Active Participant
0 Kudos

Hi Satish,

Could you please specify what's the release SP? of the Application server Java that you use?

Also could it be that however this exception the PDF file may not be broken,

Could you please try to move your business logic that you have in the EJB and execute it direct from the WD application and see if you have the same exception.

Also you are saying that just some PDFs are broken,

could you please explain what's the data.xml and the template.xdp used to produce the exception, could you please upload them here:

(only one file possible to upload so please zip)

https://sapmats-us.sap-ag.de/upload/index.cgi?id=TOPT67V0JPY940JBMIF5ZZAC9JGB6SH0HVAMNA410Y1HB6CQSR

Regards, Angel