Monday, July 31, 2017

Setting Apache Maven In Eclipse

Download Apache Maven from site(https://maven.apache.org/download.cgi)
















Unzip to folder some folder C:/tools


Open the C:\tools\apache-maven-3.5.0\conf\settings.xml for specifying local repository path
to  <localRepository>C:/mvnrepo/.m2/repository</localRepository>

Setup Maven environment variables:

MAVEN_HOME=C:\tools\apache-maven-3.5.0
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
Path=%Path%;C:\tools\apache-maven-3.5.0\bin;C:\Program Files\Java\jdk1.7.0_79\bin;

Check Maven version to see if environment variables is setup













Open your Eclipse
Go to the Windows --> Preferences -- > Maven
(Note: Install Maven plugin if its not visible in Eclipse)



Add Remote catalog in Maven Archetypes

(http://repo.maven.apache.org/maven2/archetype-catalog.xml)


















Add External Maven Installation path to C:\tools\apache-maven-3.5.0


Update User Settings to External Maven Settings file

Click on Update Settings button and Apply and then OK button

Create a New Maven Web Project:


After setting the archetype and group, it will automatically download the dependencies to local repository folder



You can also add dependency in pom.xml and see the new jars coming into the above local repository folder.

Saturday, July 29, 2017

Creating Web Service in Java Using Eclipse

Open Eclipse and create new Dynamic Web Project









































Setup the Target runtime to Tomcat 7 


































After updating the Tomcat 7 server










































Click Finish and after that create a new class HelloWorldService







































Add new method sayHello(String name)
















Right click on project and create a new WebService and add the above class at the creation of new webservice






























and select the Test service and Test Client and check the Publish the web Service checkbox










































Click Next









































Click Next and Click on Start Server button








































Once the server will start..Click on Next and Launch WebService Explorer








































It will open the  HelloWorld WebService sayHello web method. You can test the same.






























































Click Next Test WebService









































Click Next





































Click Next




































Click Finish. You will see the 

http://localhost:7534/HelloWorldWebServiceClient/sampleHelloWorldServiceProxy/TestClient.jsp