Commit 891d6511 by Patryk Czarnik

@Adnotacje JWS

parent f04bdbb5
...@@ -2,6 +2,8 @@ package hello; ...@@ -2,6 +2,8 @@ package hello;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import jakarta.jws.WebParam;
import jakarta.jws.WebResult;
import jakarta.jws.WebService; import jakarta.jws.WebService;
@WebService @WebService
...@@ -11,15 +13,21 @@ public class Usluga { ...@@ -11,15 +13,21 @@ public class Usluga {
return "Hello world"; return "Hello world";
} }
public String witaj(String imie) { @WebResult(name="powitanie")
public String witaj(@WebParam(name="imie") String imie) {
return "Witaj " + imie; return "Witaj " + imie;
} }
@WebResult(name="data-i-czas")
public String ktoraGodzina() { public String ktoraGodzina() {
return LocalDateTime.now().toString(); return LocalDateTime.now().toString();
} }
public int oblicz(int x, int y, String operacja) { @WebResult(name="wynik")
public int oblicz(
@WebParam(name="liczba1") int x,
@WebParam(name="liczba2") int y,
@WebParam(name="operacja") String operacja) {
return switch (operacja) { return switch (operacja) {
case "+" -> x + y; case "+" -> x + y;
case "-" -> x - y; case "-" -> x - y;
......
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