# Extendng Web Service

**URL:** <https://community.siren.io/t/extendng-web-service/392>\
**Category:** Siren Platform/Investigate Tech Support Community\
**Created:** [July 9, 2021, 7:42pm UTC](https://community.siren.io/t/extendng-web-service/392 "2021-07-09T19:42:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bogolese](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@bogolese](https://community.siren.io/u/bogolese)\
**Post date:** [July 9, 2021, 7:42pm UTC](https://community.siren.io/t/extendng-web-service/392/1 "2021-07-09T19:42:21Z")

</div>

Working through the Extending Web Services / Web services tutorials, Siren platform 11.1.3, invoking the “beginner” string reverse service and I get an internal server error:

“message”:“The service example-web-service-group-stringreverser returned an array, but should only be returning either single object (if storing results in the invocation index) or an object of the structure { indexSuffix: [result1, result2] } result in the invocation index, but it returned an array of objects; it must return only one result.”

Any/all help is greatly appreciated! The idea of consuming REST service results is VERY POWERFUL! 🙂

---

<div class="post-metadata">

**Author:** ![Manu\_Agarwal](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.siren.io/manu_agarwal/32/120_2.png) [@Manu\_Agarwal](https://community.siren.io/u/Manu_Agarwal)\
**Post date:** [July 12, 2021, 2:31pm UTC](https://community.siren.io/t/extendng-web-service/392/2 "2021-07-12T14:31:41Z")

</div>

Hi Richard,

The output of the invoke function should not be an array, but just an object.

Please use this

```auto
return {
  reversed_message: reversed_input
}

```

instead of

```auto
return [{
  reversed_message: reversed_input
}]

```

This should resolve the issue.

We will correct this in our [documentation](https://docs.siren.io/siren-platform-user-guide/11.1/web-service-development/moderate_tutorial.html) of webservice.

Regards  
Manu

---

<div class="post-metadata">

**Author:** ![bogolese](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@bogolese](https://community.siren.io/u/bogolese)\
**Post date:** [July 12, 2021, 2:52pm UTC](https://community.siren.io/t/extendng-web-service/392/3 "2021-07-12T14:52:47Z")

</div>

Thank you! I actually made that change. But I didn’t restart Investigate. Rookie mistake. ☹ Now it works. Thank you again!!!

---

<div class="post-metadata">

**Author:** ![bogolese](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@bogolese](https://community.siren.io/u/bogolese)\
**Post date:** [July 13, 2021, 3:42pm UTC](https://community.siren.io/t/extendng-web-service/392/4 "2021-07-13T15:42:12Z")

</div>

Okay, since we are modifying the Beginner Tutorial documentation, you also need to fix the Intermediate Tutorial documentation!!! 🙂

You need to change, in index.js:

import { MyWeatherService } from ‘./MyWeatherService’;

to

import { MyWeatherService } from ‘./src/MyWeatherService’;

G’day!

---

<div class="post-metadata">

**Author:** ![bogolese](https://avatars.discourse-cdn.com/v4/letter/b/f05b48/32.png) [@bogolese](https://community.siren.io/u/bogolese)\
**Post date:** [July 14, 2021, 5:50pm UTC](https://community.siren.io/t/extendng-web-service/392/5 "2021-07-14T17:50:09Z")

</div>

Finally, there is an issue with the Advanced Tutorial. ☹ I followed the tutorial and registered my [OpenWeatherMap.org](http://OpenWeatherMap.org) app ID in config/investigate.yml, but I get an invalid app id message when running in Siren (node invoke works fine). If I change the code to hard-code the app ID the service works in Siren. So there appears to be a problem extracting the app ID via this.config.auth\_token in MyGeneratedService.ts.

Any help would be greatly appreciated!

Thanks.
