0

I want to view the response for the below method in SOAP UI. The url would be as below to call the accountDetails(..) method in SOAP UI to check the response.

http://localhost:8080/AccountInfo/rest/account/0003942390

@RequestMapping(value = /accountDetails/{accNum}, method = RequestMethod.GET)
public void accountDetails(@PathVariable final String accNum)
{
    final boolean accountValue = service.isAccountExists(accNum);

    if (!accountValue )
    {
        throw new Exception();
    }
}

The method is executed correctly but the response i'm getting in SOAP UI is 404. accountDetails(..) method return type is void, so do i need to set any extra parameters when i have to check the response for the method in SOAP UI with void return type to show success message.

Below is the message shown in SOAP UI:

HTTP/1.1 404 /AccountInfo/WEB-INF/jsp/account/0003942390/accountInfo.jsp
Server: Apache-Coyote/1.1
Rij
  • 99
  • 2
  • 4
  • 12

1 Answers1

1

Is the exception thrown? If yes, how does the framework handle the exception?

Your method doesn't return anything - see here. Based on the RESTful nature of the URL it seems the method should return something like an AccountDetail. However, if you really just want to see the 200 then just return something like a non-null String.

Community
  • 1
  • 1
Andrew S
  • 2,509
  • 1
  • 12
  • 14
  • Yes i just want to see 200 code, now its showing me HTTP/1.1 404 /AccountInfo/WEB-INF/jsp/account/0003942390/accountInfo.jsp . But when i debug the code , the method is returning true value, that means no errors in the method. So in SOAP UI if we want to see 200 or success as response the method should have some return type? – Rij Jul 29 '16 at 19:48
  • Andrew S - Please clarify, can we set some request variables in SOAP UI to get 200/success message when the method returns void as discussed above and the method execution is success? – Rij Jul 29 '16 at 20:11
  • Try changing your method to `return new String("Hello World!")`. – Andrew S Aug 01 '16 at 12:31
  • 1
    To keep it void you'll need to map all URLs in that pattern to a resource like the jsp indicated in the 404. – Andrew S Aug 01 '16 at 12:40