Allow importing movies from XML via MoviesClient

This commit is contained in:
karl 2019-12-01 18:50:59 +01:00
parent 03320279b9
commit 340441ff2b
4 changed files with 9 additions and 2 deletions

View File

@ -4,15 +4,22 @@ import javax.sound.sampled.Port;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;
import java.util.List;
public class MoviesWebServiceClient {
public static void main(String[] args) throws Exception {
URL wsdl = new URL("http://localhost:8080/movies/MoviesWebService?wsdl");
URL wsdl = new URL("http://localhost:8080/movieservice/MoviesWebService?wsdl");
QName serviceName = new QName("http://movies.technikumwien.at/", "MoviesWebService");
Service service = Service.create(wsdl, serviceName);
MoviesWebService port = service.getPort(MoviesWebService.class);
port.getAllMovies().forEach(System.out::println);
// TODO: Move to a better place
// Import movies
List<Movies> movies = XmlHelper.xmlToMovies("movietest.xml");
port.importMovies(movies);
// Export all existing movies
XmlHelper.moviesToXml(new MovieList(port.getAllMovies()), "movies_in_db.xml");
}
}