Integrate API with Web Application Java

Do you want to create a native client or integrate with third party applications: webservices are the solution.

Moderator: car031

Locked
khot.raj
Posts: 8
Joined: Thu Sep 08, 2016 8:14 am

Integrate API with Web Application Java

Post by khot.raj » Wed Sep 14, 2016 12:31 pm

Hello,

I have used webserviceTests project to test various apis provided by LogicalDoc. It all works absolutely fine on my local machine as well * remote machine from simple java code.
Now I want to make it dynamic. I have created one Dynamic Web Application [J2EE] in Java. Now I want that user will upload a file from GUI. I have managed to get file path in servlet. So next step is authenticate with server using Auth and then upload that file on server using Document api respectively. But problem is there are two separate projects, in which one is webserviceTests and other one in my UploadGUI J2EE project.
I wants to call methods of webserviceTests into UploadGUI. I have read on net that it is possible using java build path. I have done that. But it says ClassNotFoundException.
Please help me fix this problem.

Output:-
Sep 14, 2016 3:58:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet APIListener threw exception
java.lang.ClassNotFoundException: com.logicaldoc.webservice.auth.AuthClient
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at APIListener.doPost(APIListener.java:81)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:745)

shatzing
Posts: 36
Joined: Tue Jan 21, 2014 9:46 am

Re: Integrate API with Web Application Java

Post by shatzing » Wed Sep 14, 2016 4:51 pm

Hi khot.raj,
you should put the jar libraries of the LogicalDOC webservice API into the folder lib of your application in Tomcat.

So if your web-application is named UploadGUI you should place the jars into

C:\tomcat\webapps\UploadGUI\WEB-INF\lib

Note: You will need to copy the jars of LogicalDOC of the correct version so if you're using LD 7.5.2 you will have to copy logicaldoc-webservice-7.5.2-plugin.jar, logicaldoc-core-7.5.2-plugin.jar and logicaldoc-util-7.5.2.jar
Otherwise for LD 7.4.3 logicaldoc-webservice-7.4.3-plugin.jar, logicaldoc-core-7.4.3-plugin.jar and logicaldoc-util-7.4.3.jar

The best option if you're using Maven 3.x is to include the libraries in your project

Code: Select all

	<dependency>
			<groupId>com.logicaldoc</groupId>
			<artifactId>logicaldoc-webservice</artifactId>
			<version>7.5.2</version>
			<type>jar</type>
		</dependency>	
		<dependency>
			<groupId>com.logicaldoc</groupId>
			<artifactId>logicaldoc-core</artifactId>
			<version>7.5.2</version>
			<type>jar</type>
		</dependency>
		<dependency>
			<groupId>com.logicaldoc</groupId>
			<artifactId>logicaldoc-util</artifactId>
			<version>7.5.2</version>
			<type>jar</type>
		</dependency>
Of course you will need to add the repositories

Code: Select all

	<repositories>
		<repository>
			<id>ibiblio</id>
			<name>Ibiblio Repository</name>
			<url>http://www.ibiblio.org/maven2</url>
		</repository>
		<repository>
			<id>logicaldoc</id>
			<name>LogicalDOC Repository</name>
			<url>http://logicaldoc.sourceforge.net/maven</url>
		</repository>
	</repositories>
Frank

khot.raj
Posts: 8
Joined: Thu Sep 08, 2016 8:14 am

Re: Integrate API with Web Application Java

Post by khot.raj » Tue Sep 20, 2016 8:07 am

Issue has been solved..
Thanks boss. :)

Locked

Who is online

Users browsing this forum: No registered users and 2 guests