26 lines
No EOL
927 B
Java
26 lines
No EOL
927 B
Java
package com.soapsoapsoap;
|
|
|
|
import javax.jws.WebService;
|
|
import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
@WebService(endpointInterface = "com.soapsoapsoap.MyFirstSOAPInterface")
|
|
public class MyFirstWS implements MyFirstSOAPInterface{
|
|
public String getHelloWorldAsString(String nazwa) {
|
|
String message = "Witaj " + nazwa + "!";
|
|
return message;
|
|
}
|
|
public long getDaysBetweenDates(String date1, String date2) {
|
|
long numberOfDays = 0;
|
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd MM yyyy");
|
|
try {
|
|
LocalDate tempdate1 = LocalDate.parse(date1, dtf);
|
|
LocalDate tempdate2 = LocalDate.parse(date2, dtf);
|
|
numberOfDays = ChronoUnit.DAYS.between(tempdate1, tempdate2);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return numberOfDays;
|
|
}
|
|
} |