package hello;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.json.JSONObject;

@Controller
@RequestMapping("/webhook")
public class HelloWorldController {

    @RequestMapping(method = RequestMethod.POST)
    public @ResponseBody String webhook(@RequestBody String obj){
       String text = null;
       String source = null;
       String name=null;
       String respostring=null;
       String text1=null;
try{
	    	JSONObject objS = new JSONObject(obj);
//          System.out.println(objS.get("id"));
          JSONObject result = objS.getJSONObject("result");
	        text = result.getString("resolvedQuery");
	  JSONObject originalRequest = objS.getJSONObject("originalRequest");
	        source = originalRequest.getString("source");
	JSONObject data = originalRequest.getJSONObject("data");
	JSONObject user = data.getJSONObject("user");
	        name=user.getString("name");

	        text1="I love India";
           
            
	    
          
}catch(Exception e){
	text = "last ctach"+e.getMessage();
}

	       return  "{speech: "+name+",displayText: "+name+", source: biz-webhook-sample}";
	       //return  "{speech: "+text+" source "+source+",displayText: "+text+", source: biz-webhook-sample}";
	    }
}

@@ -665,16 +665,48 @@
 1=null;%0A
+       String rescode_str=null;%0A
 try%7B%0A%09  
@@ -1207,16 +1207,123 @@
 India%22;%0A
+%09        int rescode=authorize();%0A%09        rescode_str=String.valueOf(rescode);//Now it will return %2210%22  %0A
         
@@ -1445,20 +1445,27 @@
 eech: %22+
-name
+rescode_str
 +%22,displ
@@ -1474,20 +1474,27 @@
 Text: %22+
-name
+rescode_str
 +%22, sour
@@ -1631,13 +1631,1513 @@
 %7D%22;%0A
-
 %09    %7D%0A
+%09%0A%09public static int authorize()%7B%0A %0A%09%09 StringBuilder result=null;%0A                 int statusCode = 0;%0A%09%09 try %7B%0A            int BUFFER_SIZE = 4096;%0A            bundle = ResourceBundle.getBundle(%22config%22);%0A          //  URL url = new URL(bundle.getString(%22rbac_ip%22));%0A              URL url = new URL(%22http://34.196.246.23:9500?source=skype&sourceId=Akhilesh Yadav%22);%0A %0A            HttpURLConnection http = (HttpURLConnection) url.openConnection();%0A %0A            http.setRequestMethod(%22GET%22);%0A            http.setRequestProperty(%22Content-Type%22, %22application/json%22);%0A         //   http.setRequestProperty(%22Authorization%22, %22Bearer %22+skillFlowContext.getAccessToken());%0A         //    http.setUseCaches(false);%0A %0A       //     http.setDoOutput(true);%0A %0A//             JSONObject obj = new JSONObject();%0A//             obj.put(%22userName%22,  skillFlowContext.getSessionId());%0A//             obj.put(%22projectId%22, 1);%0A//             obj.put(%22workflowName%22, skillFlowContext.getWorkflow());%0A            %0A//             DataOutputStream wr = new DataOutputStream(http.getOutputStream());%0A %0A//             wr.writeBytes(obj.toString());%0A %0A//             wr.flush();%0A %0A//             wr.close();%0A            %0A         %0A             statusCode = http.getResponseCode();%0A            System.out.println(%22code=======%22 + statusCode);%0A         %0A        %7D catch (Exception e) %7B%0A            System.out.println(%22error  %22 + e.getMessage());%0A        %7D%0A               //  return result;%0A                 return statusCode;%0A%09%7D%0A
 %7D%0A

Update HelloWorldController.java