added spring boot example using msb java sdk
[msb/java-sdk.git] / example-spring-boot / src / main / java / org / onap / boot / example / demo / ExampleClient.java
1 package org.onap.boot.example.demo;
2
3 import java.io.IOException;
4
5 import org.onap.boot.example.demo.model.Employee;
6 import org.onap.msb.sdk.httpclient.RestServiceCreater;
7 import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
8
9 import retrofit2.Response;
10
11
12 public class ExampleClient {
13
14   /**
15    * @param args
16    * @throws IOException
17    */
18   public static void main(String[] args) throws IOException {
19     //For real use case, MSB IP and Port should come from configuration file instead of hard code here
20     String MSB_IP="192.168.0.110";
21     int MSB_Port=10081;
22
23     MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);
24
25     RestServiceCreater restServiceCreater =
26         new RestServiceCreater(msbClient);
27
28     EmployeeServiceClient implProxy =
29         restServiceCreater.createService(EmployeeServiceClient.class);
30
31     Employee employee = implProxy.queryEmployee().execute().body();
32     System.out.println("Employee:" + employee);
33   }
34
35 }