Web Services
Web Services
----------------
Web Services
------------
- Web Services are open standard based web applications that interact
--------------------
---------------------
-----------------
------------------
@Path (your-path)
-----------------
Ex:
@Path("hello")
...
http://localhost:8080/RESTWSProj/hello
@GET
----
Ex:
@Path("hello")
@GET
public String sayHello()
{...}
@Produces
---------
Ex:
@Produces(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_HTML)
@Produces(MediaType.TEXT_XML) or @Produces(MediaType.APPLICATION_XML)
Jersey Libraries
----------------
---------------------------------------------------------------
Click Next
----------------------------------
Click Add Archetype
Click Ok
---------------------------------------
Click NExt
Group Id : restws
Artifact Id : RESTWSProj
Package : com.ws.rest
Click Finish
- http://localhost:8080/RESTWSProj/myresource/plain
- http://localhost:8080/RESTWSProj/myresource/html
- http://localhost:8080/RESTWSProj/myresource/xml
Date:24/Jan/2023
----------------
Create a REST Web Service which returns the product list from
Producer
--------
...
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.11.Final</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.31</version>
</dependency>
----
of RESTWSProj
src/main/java folder
Consumer
--------
Note
----
HTTP : 3333
Click Next
Click Next
Group Id : restclient
Artifact Id : RESTWSProj
Package : com.ws.rest.client
click Finish
Note
----
in com.ws.rest.client package