How to write json webservice in java

Find centralized, trusted content and collaborate around the technologies you use most. Connect and share knowledge within a single location that is structured and easy to search.

Additional menu

But I could not figure out a way to call this method from a java rest client to send and receive the json data. I tried the following way to write the client.

how to write json webservice in java

Your use of PathParam is incorrect. It does not follow these requirements as documented in the javadoc here.

1. Maven configuration (pom.xml)

You can fix this in your resource method to accept JSON entity. I am using jersey 2. The above problem can be solved by adding the following dependencies in your project, as i was facing the same problem.

how to write json webservice in java

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.

2. Defining the web.xml

Learn more. Asked 9 years ago. Active 2 years, 5 months ago. Viewed k times. ClientHandlerException: com.

how to write json webservice in java

ClientHandlerException: A message body writer for Java type, class java. Improve this question. Grimeh 2 2 silver badges 12 12 bronze badges.

how to write json webservice in java

Ayan Biswas Ayan Biswas 1, 8 8 gold badges 32 32 silver badges 54 54 bronze badges. Add a comment.]