Warning

 

Close

Confirm Action

Are you sure you wish to do this?

Confirm Cancel
BCM
User Panel

Site Notices
Posted: 1/17/2020 12:44:15 PM EDT
All samples i find incorporate a number of other tools.

What i am looking for are steps to set up a simple RESTful service using java and command line.

Have you come across one?
Link Posted: 1/17/2020 2:37:04 PM EDT
[#1]
Using Java Spring:

https://spring.io/guides/gs/rest-service/

Otherwise you'd go crazy.
Link Posted: 1/17/2020 5:20:24 PM EDT
[#2]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
Using Java Spring:

https://spring.io/guides/gs/rest-service/

Otherwise you'd go crazy.
View Quote
Thanks.  Will check it out.

I used this site (https://www.codejava.net/java-ee/web-services/create-client-server-application-for-web-service-in-java) for a general web service.
Seeing all the steps required really helped get an understanding of what is going on especially the wsimport section.

My concern with using some tool is some of the behind the scenes stuff gets lost and as a result so does some understanding.
Link Posted: 2/1/2020 11:13:14 PM EDT
[#3]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
My concern with using some tool is some of the behind the scenes stuff gets lost and as a result so does some understanding.
View Quote
Spring Boot is what we're using for our microservices. It's an incredibly robust framework. Here is a simple example.

I think you need to separate a tool from a framework in your mindset. When I think of a tool, I think of something like MS Frontpage creating this awesome webpage with a metric ton of shit behind the scenes to pull it off. There's little way a person is going to look at it outside the tool and be able to make heads or tails of it. A framework, on the other hand, does all of the heavy lifting for you so you don't have to do much if anything to implement it. The code is available to you. The functionality is just abstracted.

For example, we provide our own template app that other teams can use. Right out of the box they get security (JWT, TLS, etc), configuration management, distributed tracing, metrics, health endpoints, and a myriad of other functionality. All they have to do is add their business logic.
Link Posted: 2/2/2020 9:06:47 AM EDT
[#4]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
Spring Boot is what we're using for our microservices. It's an incredibly robust framework. Here is a simple example.

I think you need to separate a tool from a framework in your mindset. When I think of a tool, I think of something like MS Frontpage creating this awesome webpage with a metric ton of shit behind the scenes to pull it off. There's little way a person is going to look at it outside the tool and be able to make heads or tails of it. A framework, on the other hand, does all of the heavy lifting for you so you don't have to do much if anything to implement it. The code is available to you. The functionality is just abstracted.

For example, we provide our own template app that other teams can use. Right out of the box they get security (JWT, TLS, etc), configuration management, distributed tracing, metrics, health endpoints, and a myriad of other functionality. All they have to do is add their business logic.
View Quote
I actually have a nice "Hello World" sample working but then move on to trying to send a Java object and that is a pain.
I have followed a few different samples and each one generates an error.
It is likely these samples are leaving out a small but important detail about the configuration.
Link Posted: 2/2/2020 9:17:45 AM EDT
[#5]
Amazing that Java is still a thing....
Link Posted: 2/2/2020 7:44:31 PM EDT
[#6]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
Amazing that Java is still a thing....
View Quote
Why? It works very well.

I'm not opposed to new things, though. My goal (if I can find some time) is to try to convert one or two of our Java microservices to Go. The trick is finding libraries to provide the same functionality. It's so easy with Spring Boot I dread having to pull it all together myself.
Link Posted: 2/4/2020 3:16:34 PM EDT
[#7]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
Why? It works very well.

I'm not opposed to new things, though. My goal (if I can find some time) is to try to convert one or two of our Java microservices to Go. The trick is finding libraries to provide the same functionality. It's so easy with Spring Boot I dread having to pull it all together myself.
View Quote
What do you make of Kotlin?
Link Posted: 2/4/2020 3:29:02 PM EDT
[#8]
Does it really have to be java? With python+flask the whole project takes 7 lines, including the import statements.

If you're learning to support an existing project or trying to qualify for a specific job, carry on. But if you're looking to start a new project or just learn a new skill, I'd stay away from java.
Link Posted: 2/4/2020 6:01:39 PM EDT
[#9]
Its for an existing project.
Haven't had time to get back to it, but still looking for an example passing a Java object.
Link Posted: 2/4/2020 9:33:03 PM EDT
[#10]
Quoted:

What do you make of Kotlin?
View Quote
No. I've glanced at it and it has some impressive features, though. One of my developers is a fan.
Quoted:
Its for an existing project.
Haven't had time to get back to it, but still looking for an example passing a Java object.
View Quote
You're trying to pass an object how? To what? What's your goal?
Link Posted: 2/4/2020 9:41:30 PM EDT
[#11]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
No. I've glanced at it and it has some impressive features, though. One of my developers is a fan.
You're trying to pass an object how? To what? What's your goal?
View Quote
Goal is to take the next step from a simple Hello World RESTful Service to one that accepts a Java Object.

How? Well, at this point I am open. Some use XML and other JSON to pass the object and these contribute to which annotations are used with the RESTful Service.
My objective at this point is to get the object over. From there I will expand to the specifics.
I have tried a few examples of various means and each one fails.
Usually these sample leave out a minor yet important detail that I suspect is a well known step with RESTful Services but only well known if you have done it before.
Link Posted: 2/4/2020 9:47:19 PM EDT
[#12]
Discussion ForumsJump to Quoted PostQuote History
Quoted:

Goal is to take the next step from a simple Hello World RESTful Service to one that accepts a Java Object.

How? Well, at this point I am open. Some use XML and other JSON to pass the object and these contribute to which annotations are used with the RESTful Service.
My objective at this point is to get the object over. From there I will expand to the specifics.
I have tried a few examples of various means and each one fails.
Usually these sample leave out a minor yet important detail that I suspect is a well known step with RESTful Services but only well known if you have done it before.
View Quote
So, it sounds like your project is to introduce a deserialization vulnerability
Link Posted: 2/4/2020 10:47:05 PM EDT
[#13]
So what fails? It should be fairly straightforward to receive a JSON payload which Jackson can easily consume. It's great for serializing/deserializing.

Tutorial
Link Posted: 2/5/2020 4:45:47 PM EDT
[#14]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
So, it sounds like your project is to introduce a deserialization vulnerability
View Quote View All Quotes
View All Quotes
Discussion ForumsJump to Quoted PostQuote History
Quoted:
Quoted:

Goal is to take the next step from a simple Hello World RESTful Service to one that accepts a Java Object.

How? Well, at this point I am open. Some use XML and other JSON to pass the object and these contribute to which annotations are used with the RESTful Service.
My objective at this point is to get the object over. From there I will expand to the specifics.
I have tried a few examples of various means and each one fails.
Usually these sample leave out a minor yet important detail that I suspect is a well known step with RESTful Services but only well known if you have done it before.
So, it sounds like your project is to introduce a deserialization vulnerability
yea.... dont roll your own, stick with existing frameworks unless you really understand what you are doing.
if you can get away with doing it yourself (if its really that simple and robust what you build) then great, otherwise youll need to update your stuff as security bugs are fixed in those frameworks.
Link Posted: 2/5/2020 6:31:18 PM EDT
[#15]
Discussion ForumsJump to Quoted PostQuote History
Quoted:
So what fails? It should be fairly straightforward to receive a JSON payload which Jackson can easily consume. It's great for serializing/deserializing.

Tutorial
View Quote
The Jackson tutorial is neat although it adds another layer I need to learn but it seems straightforward.

I think a major issue with my sample is the RESTful service is not set up properly to accept the object.
There are certain annotations used based on how the object is being passed.

This is why I am looking for a complete example to ensure especially the server is set up correctly.
Link Posted: 2/5/2020 10:27:49 PM EDT
[#16]
Maybe it would help if you could post the sample you followed.
Close Join Our Mail List to Stay Up To Date! Win a FREE Membership!

Sign up for the ARFCOM weekly newsletter and be entered to win a free ARFCOM membership. One new winner* is announced every week!

You will receive an email every Friday morning featuring the latest chatter from the hottest topics, breaking news surrounding legislation, as well as exclusive deals only available to ARFCOM email subscribers.


By signing up you agree to our User Agreement. *Must have a registered ARFCOM account to win.
Top Top