(I put code tags around your code so it's a bit more readable. Indented code would have been even nicer... anyway have a look at
UseCodeTags for more information about how to do that in future.)
Anyway here's the relevant code which consumes the web service:
You'd start by putting that into the get() method of your servlet, or whatever method is being called when a request is sent to it. But you want your inputs to come from the request, so you would remove the hard-coding of the "param" variable and replace that by something which gets two numbers from the request parameters. Then you'd replace the last line by something which puts the result into the servlet's response.