0

i am implementing a ussd service in spring with the following sample code

@RequestMapping(value = "/ussd", method = RequestMethod.GET)
public @ResponseBody String processUSSD(UssdRequest ussdrequest) {
    return "Welcome to our Service.\n1. Test 1\n2. Test 2\n3. Test 3";
}

Everything is working OK, however since the datatype of the response is a string, the service returns a response with braces in the console terminal i.e

[Welcome to our Service.
1. Test 1
2. Test 2
3. Test 3]

as a result, it returns the following on a dialed phone request

<string>Welcome to our Service.
 1. Test 1
 2. Test 2
 3. Test 3</string>

I have tried using object datatype but i get the same output. What should i edit/use to remove <string> and </string> at the beginning and end of the response.

user1351077
  • 107
  • 1
  • 4
  • 14

1 Answers1

0

Change -

@RequestMapping(value = "/ussd", method = RequestMethod.GET)

to -

@RequestMapping(value = "/ussd", method = RequestMethod.GET, produces="text/plain")
farrellmr
  • 1,815
  • 2
  • 15
  • 26