jeudi 21 mai 2015

Spring Web Service non-Spring Client

So I'm trying to consume a Spring Web Service from a non-Spring Java EE application.

All the example Spring Web Service clients use the RestTemplate from Spring.

Is it possible to consume the web service without it?

I was trying to make a simple post request like with Restful web services:

URL url = new URL("http://ift.tt/1AgRQss");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("type", "lololol");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));

The request that reaches the Spring Web Service is of type GET and does not contain the request property.

What am I missing?

Thanks in advance,

tarja




Aucun commentaire:

Enregistrer un commentaire