1

I am a complete newbie to webservices but have some experience in Java. We have been provided with Liverail API documentation with a list of Entities that we can consume. This is what their doc says:

"Logical flow An API client must always use the /login method followed by the /set/entity method. All the remaining APIcalls will be executed on the selected entity. If you need to switch the current entity, you should use /unset/entity followed by a new /set/entity with the new entity ID as parameter. It is also recommended to call /logout once the API client ends its execution"

XML response format The LiveRail API XML response is always formated like bellow.

My dilema is that i dont know how to make the GET calls.

What i would like to do in java is :

  1. Create a http login to API webservices
  2. Fetch a list of data (response is in XML format) 3 Convert this XML response into CSV file.

Any help will be highly appreciated.

1 Answers1

1

Why not using RestTemplate?

final String uri = "http://localhost:8080/springrestexample/employees/{id}";

Map<String, String> params = new HashMap<String, String>();
params.put("id", "1");

RestTemplate restTemplate = new RestTemplate();
EmployeeVO result = restTemplate.getForObject(uri, EmployeeVO.class, params);

System.out.println(result);

Here is for more tutorials http://howtodoinjava.com/2015/02/20/spring-restful-client-resttemplate-example/

Faruk
  • 5,438
  • 3
  • 30
  • 46