Commit c262efe5 by Patryk Czarnik

adnotacje do customizacji webserwisu

parent 7f6863d8
package hello;
import jakarta.jws.WebParam;
import jakarta.jws.WebResult;
import jakarta.jws.WebService;
import jakarta.xml.ws.RequestWrapper;
import jakarta.xml.ws.ResponseWrapper;
import java.time.LocalTime;
// JAX-WS - usługi typu SOAP w Javie (obecnie element Jakarta EE)
@WebService
public class PierwszaUsluga {
public String hello() {
......@@ -14,11 +19,17 @@ public class PierwszaUsluga {
return "Witaj " + imie;
}
@WebResult(name="biezacy-czas")
public String ktoraGodzina() {
return LocalTime.now().toString();
}
public long oblicz(long liczba1, long liczba2, String operacja) {
@RequestWrapper(localName="kalkulator")
@ResponseWrapper(localName="kalkulatorResponse")
@WebResult(name="wynik")
public long oblicz(@WebParam(name="x") long liczba1,
@WebParam(name="y") long liczba2,
@WebParam(name="operacja") String operacja) {
return switch(operacja) {
case "+" -> liczba1 + liczba2;
case "-" -> liczba1 - liczba2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment