# Error while invoking restful web service

**URL:** <https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306>\
**Category:** Elasticsearch\
**Created:** [December 18, 2014, 5:40am UTC](https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306 "2014-12-18T05:40:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vijayakumari\_B\_N](https://avatars.discourse-cdn.com/v4/letter/v/da6949/32.png) [@Vijayakumari\_B\_N](https://discuss.elastic.co/u/Vijayakumari_B_N)\
**Post date:** [December 18, 2014, 5:40am UTC](https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306/1 "2014-12-18T05:40:32Z")

</div>

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](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 18, 2014, 6:26am UTC](https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306/2 "2014-12-18T06:26:20Z")

</div>

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](mailto: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](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 [elasticsearch+unsubscribe@googlegroups.com](mailto: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](https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com).  
> 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/E0CEAB43-A064-4F4B-BE6E-ADE53431AE51%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/E0CEAB43-A064-4F4B-BE6E-ADE53431AE51%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Vijayakumari\_B\_N](https://avatars.discourse-cdn.com/v4/letter/v/da6949/32.png) [@Vijayakumari\_B\_N](https://discuss.elastic.co/u/Vijayakumari_B_N)\
**Post date:** [December 18, 2014, 7:22am UTC](https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306/3 "2014-12-18T07:22:31Z")

</div>

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](mailto: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](mailto: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)  
> [https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com?utm\_medium=email&utm\_source=footer](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).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 18, 2014, 7:49am UTC](https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306/4 "2014-12-18T07:49:12Z")

</div>

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](http://Elasticsearch.com)  
@dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr [https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr) | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)

> Le 18 déc. 2014 à 08:22, Vijayakumari B N [vijayakumari.bn@gmail.com](mailto: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](mailto: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) [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) [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](mailto: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) [https://groups.google.com/d/msgid/elasticsearch/1005c8e3-3886-4371-b7ca-685a06eb5b48%40googlegroups.com?utm\_medium=email&utm\_source=footer](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) [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) [mailto: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) [https://groups.google.com/d/msgid/elasticsearch/77a6d4a6-56c1-4cbd-af48-1efd4840b3b5%40googlegroups.com?utm\_medium=email&utm\_source=footer](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) [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/39F1B63F-669E-42EC-841D-7FD3AFC35432%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/39F1B63F-669E-42EC-841D-7FD3AFC35432%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:42am UTC](https://discuss.elastic.co/t/error-while-invoking-restful-web-service/21306/5 "2017-07-06T00:42:59Z")

</div>


