Bill Lee
Bill Lee

Reputation: 121

404 when calling post from resttemplate

I am attemtping to call a service using rest template and I am receiving a 404 error.

It's a POST. The signature of method is

String sendScreenAsPostcard(@RequestBody MultiValueMap<String, Object> params)

I am attenpting to call this from the resttemplate with the following code.

restTemplate.exchange(
            "http://localhost:8080/sendScreeenAsPostCard",
            HttpMethod.POST,
            new HttpEntity<MultiValueMap<String, Object>>(parameters, headers),
            String.class
        ).getBody()

Please advice what I am doing wrong. Thanks.

Upvotes: 1

Views: 2387

Answers (1)

Ryan Stewart
Ryan Stewart

Reputation: 128849

404 means the resource isn't found. If everything is fairly straightforward, it means there's an HTTP server running at localhost:8080, but no resource available at /sendScreenAsPostCard.

Upvotes: 1

Related Questions