DEV Community

loading...

Webservices using Java 10

karytricia profile image Carla Augusto ・1 min read

Does anyone know if there is a way to create webservices using Java 10?

Discussion (13)

pic
Editor guide
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 Author

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 Author

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 Author

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.

Collapse
carey profile image
Carey

All the code that’s being removed from Java 9+ is available from Maven, though the exact list of dependencies and versions eludes me. This is my work in progress:

Alternatively, it may work better to use Apache Axis 2 or Apache CXF for your web services, now that the reference implementation isn’t bundled with JavaSE.

Collapse
karytricia profile image
Carla Augusto Author

Thanks for your reply.

Collapse
mohammedestaitieh profile image
MohammedEstaitieh

Hi Carla ,can u give me some resources of soap in java i want to create web service(SOAP)

Collapse
karytricia profile image
Carla Augusto Author

Hi Mohammed!
My best resources to learn how to create a simple soap web service in Java are the following:
mkyong.com/webservices/jax-ws/jax-...

mkyong.com/webservices/jax-ws/depl...

Then you can check a simple soap webservice that I created for demonstration purposes only on my github account:
github.com/karylicious/calculatorw...

Collapse
mohammedestaitieh profile image
MohammedEstaitieh

Thank you Carla

Thread Thread
mohammedestaitieh profile image
MohammedEstaitieh

did u know how can i run the jsp page in glassfish server ,am run it but i got an error , am new here i dont know how to create post

Thread Thread
karytricia profile image
Carla Augusto Author

Sorry. I have no idea.