DEV Community

Discussion on: Webservices using Java 10

Collapse
 
dankwansere profile image
Dankwansere

What kind of web services, rest? soap?

There are definitely lots of ways to create web services in java 10.

Try looking at
Jax-rs (rest services)

Jax-ws (soap services)

the Spring MVC framework comes with it's own build it rest API that can be used to create restful services.

Collapse
 
karytricia profile image
Carla Augusto

Thanks for your answer. I'm trying to upgrade a simple java soap web service that I already created without any framework. It was created with Java 8.

However as soon I started using Java 10, my program failed to compile since the Java EE modules has been annotated as deprecated for removal. I don't know which technology is being used to develop simple web services in Java 10.

Collapse
 
hwesselmann profile image
Hauke Wesselmann

If you really need to move to Java 10 right now (maybe its a public service?), I would move over to Jax-WS as it still keeps the code pretty straightforward.

I am doing soap services using Spring-Boot most of the time, as it allows to add stuff like jpa, security or monitoring fairly easy.

Thread Thread
 
karytricia profile image
Carla Augusto

Thanks for your reply.

Collapse
 
dankwansere profile image
Dankwansere

I would recommend using a library such as the ones I mentioned from my previous post to create web services(Rest or SOAP) in java. The benefit of libraries is that the dependencies of the java versions are usually taken care for you.

However if you want to use pure jdk tools for creating the webservice then you can use the javax.xml.soap API

docs.oracle.com/javase/10/docs/api...

Thread Thread
 
karytricia profile image
Carla Augusto

Using the javax.xml.soap API directly doesn't work. It only works if I use the --add-modules option.

However, this solution is for Java 9 and Java 10 only. For later versions it won't work as the Java EE related modules will be entirely removed from Java SE.

Thanks for your reply.