Error while invoking restful web service

Hi,

i wanted elasticsearch functionality exposed as restfull webservice. I
tried the restful example from below branch.

My controller class is below
import com.fasterxml.jackson.databind.ObjectMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
/**

  • @author vnarayanaswamy

*/
@Controller
@RequestMapping("/api")
public class SearchRestApi {
final Logger logger = LoggerFactory.getLogger(SearchRestApi.class);

IncidentService incidentService;
@RequestMapping(value = "/find/{id}", method = RequestMethod.GET)
public @ResponseBody Incident findByIrId(@PathVariable long id) throws 

Exception {
return incidentService.findByIrId(id);
}

//@Transactional(propagation = Propagation.NOT_SUPPORTED)
@RequestMapping(value = "/search", method = RequestMethod.GET)
public @ResponseBody String search1(@RequestParam Integer from, 

@RequestParam Integer size) throws Exception {
incidentService = new IncidentService();
return incidentService.search("new", from, size);
}

I tried to debug the controller class but its not invoking the search1
method.
I get below error when i tried to invoke using url -
https://localhost:8443/api/search

Status
0 NO RESPONSE Loading time: 506
Request headers
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-Type: text/plain; charset=utf-8
Accept: /
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: JSESSIONID=246ED813F970B1BAB3AFBED0752E9ACE

Thanks in advance,
Vijaya

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Well. There is no elasticsearch code here.
What is your incident service is doing here?

David

Le 18 déc. 2014 à 06:40, Vijayakumari B N vijayakumari.bn@gmail.com a écrit :

Hi,

i wanted elasticsearch functionality exposed as restfull webservice. I tried the restful example from below branch.

https://github.com/dadoonet/legacy-search/blob/01-direct/src/main/java/fr/pilato/demo/legacysearch/service/PersonService.java#L40

My controller class is below
import com.fasterxml.jackson.databind.ObjectMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
/**

  • @author vnarayanaswamy

*/
@Controller
@RequestMapping("/api")
public class SearchRestApi {
final Logger logger = LoggerFactory.getLogger(SearchRestApi.class);

  IncidentService incidentService;
  @RequestMapping(value = "/find/{id}", method = RequestMethod.GET)
  public @ResponseBody Incident findByIrId(@PathVariable long id) throws Exception {
      return incidentService.findByIrId(id);
  }
  
  
  //@Transactional(propagation = Propagation.NOT_SUPPORTED)
  @RequestMapping(value = "/search", method = RequestMethod.GET)
  public @ResponseBody String search1(@RequestParam Integer from, @RequestParam Integer size) throws Exception {
  	incidentService = new IncidentService();
      return incidentService.search("new", from, size);
  }

I tried to debug the controller class but its not invoking the search1 method.
I get below error when i tried to invoke using url - https://localhost:8443/api/search

Status
0 NO RESPONSE Loading time: 506
Request headers
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-Type: text/plain; charset=utf-8
Accept: /
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: JSESSIONID=246ED813F970B1BAB3AFBED0752E9ACE

Thanks in advance,
Vijaya

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/E0CEAB43-A064-4F4B-BE6E-ADE53431AE51%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Hi David,

My IncidentService invokes the elastic server to populate data. The below
POC is returning valid JSON response

public String search(String inputText, Integer from, Integer size)
throws Exception {
QueryBuilder query =
QueryBuilders.multiMatchQuery(inputText,"keywords", "symptom");
SearchResponse response = elasticsearchDao.search(query, from, size);
return response.toString();
}

Thanks,
Vijaya

On Thursday, December 18, 2014 11:56:31 AM UTC+5:30, David Pilato wrote:

Well. There is no elasticsearch code here.
What is your incident service is doing here?

David

Le 18 déc. 2014 à 06:40, Vijayakumari B N <vijayak...@gmail.com
<javascript:>> a écrit :

Hi,

i wanted elasticsearch functionality exposed as restfull webservice. I
tried the restful example from below branch.

https://github.com/dadoonet/legacy-search/blob/01-direct/src/main/java/fr/pilato/demo/legacysearch/service/PersonService.java#L40

My controller class is below
import com.fasterxml.jackson.databind.ObjectMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
/**

  • @author vnarayanaswamy

*/
@Controller
@RequestMapping("/api")
public class SearchRestApi {
final Logger logger = LoggerFactory.getLogger(SearchRestApi.class);

IncidentService incidentService;
@RequestMapping(value = "/find/{id}", method = RequestMethod.GET)
public @ResponseBody Incident findByIrId(@PathVariable long id) throws 

Exception {
return incidentService.findByIrId(id);
}

//@Transactional(propagation = Propagation.NOT_SUPPORTED)
@RequestMapping(value = "/search", method = RequestMethod.GET)
public @ResponseBody String search1(@RequestParam Integer from, 

@RequestParam Integer size) throws Exception {
incidentService = new IncidentService();
return incidentService.search("new", from, size);
}

I tried to debug the controller class but its not invoking the search1
method.
I get below error when i tried to invoke using url -
https://localhost:8443/api/search

Status
0 NO RESPONSE Loading time: 506
Request headers
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-Type: text/plain; charset=utf-8
Accept: /
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: JSESSIONID=246ED813F970B1BAB3AFBED0752E9ACE

Thanks in advance,
Vijaya

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/77a6d4a6-56c1-4cbd-af48-1efd4840b3b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hard to say without seeing the whole code.
May be you could share what you are doing on github?

Strange thing:

    	incidentService = new IncidentService();

You are using Spring here so I guess you should better inject IncidentService.

But, I’m pretty much blind so I can’t really say more.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 18 déc. 2014 à 08:22, Vijayakumari B N vijayakumari.bn@gmail.com a écrit :

Hi David,

My IncidentService invokes the elastic server to populate data. The below POC is returning valid JSON response

public String search(String inputText, Integer from, Integer size) throws Exception {
QueryBuilder query = QueryBuilders.multiMatchQuery(inputText,"keywords", "symptom");
SearchResponse response = elasticsearchDao.search(query, from, size);
return response.toString();
}

Thanks,
Vijaya

On Thursday, December 18, 2014 11:56:31 AM UTC+5:30, David Pilato wrote:
Well. There is no elasticsearch code here.
What is your incident service is doing here?

David

Le 18 déc. 2014 à 06:40, Vijayakumari B N <vijayak...@gmail.com <javascript:>> a écrit :

Hi,

i wanted elasticsearch functionality exposed as restfull webservice. I tried the restful example from below branch.

https://github.com/dadoonet/legacy-search/blob/01-direct/src/main/java/fr/pilato/demo/legacysearch/service/PersonService.java#L40 https://github.com/dadoonet/legacy-search/blob/01-direct/src/main/java/fr/pilato/demo/legacysearch/service/PersonService.java#L40

My controller class is below
import com.fasterxml.jackson.databind.ObjectMapper;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
/**

  • @author vnarayanaswamy

*/
@Controller
@RequestMapping("/api")
public class SearchRestApi {
final Logger logger = LoggerFactory.getLogger(SearchRestApi.class);

  IncidentService incidentService;
  @RequestMapping(value = "/find/{id}", method = RequestMethod.GET)
  public @ResponseBody Incident findByIrId(@PathVariable long id) throws Exception {
      return incidentService.findByIrId(id);
  }
  
  
  //@Transactional(propagation = Propagation.NOT_SUPPORTED)
  @RequestMapping(value = "/search", method = RequestMethod.GET)
  public @ResponseBody String search1(@RequestParam Integer from, @RequestParam Integer size) throws Exception {
  	incidentService = new IncidentService();
      return incidentService.search("new", from, size);
  }

I tried to debug the controller class but its not invoking the search1 method.
I get below error when i tried to invoke using url - https://localhost:8443/api/search https://localhost:8443/api/search

Status
0 NO RESPONSE Loading time: 506
Request headers <>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
Content-Type: text/plain; charset=utf-8 <>
Accept: /
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: JSESSIONID=246ED813F970B1BAB3AFBED0752E9ACE

Thanks in advance,
Vijaya

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com mailto:elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/77a6d4a6-56c1-4cbd-af48-1efd4840b3b5%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/77a6d4a6-56c1-4cbd-af48-1efd4840b3b5%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/39F1B63F-669E-42EC-841D-7FD3AFC35432%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.