diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 7373944..5a663f3 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -13,9 +13,9 @@ - - - + + + \ No newline at end of file diff --git a/MoviesClient/MoviesClient.iml b/MoviesClient/MoviesClient.iml index 15ff34a..e4f6abb 100644 --- a/MoviesClient/MoviesClient.iml +++ b/MoviesClient/MoviesClient.iml @@ -15,6 +15,7 @@ + @@ -58,6 +59,5 @@ - \ No newline at end of file diff --git a/MoviesClient/pom.xml b/MoviesClient/pom.xml index 1f1a1bc..8bb3b29 100644 --- a/MoviesClient/pom.xml +++ b/MoviesClient/pom.xml @@ -24,12 +24,6 @@ jaxws-ri pom - - - at.technikumwien - MoviesCommon - 1.0.0-SNAPSHOT - @@ -68,6 +62,25 @@ + + com.helger.maven + jaxws-maven-plugin + 2.6.2 + + + http://localhost:8080/movieservice/MoviesWebService?wsdl + + at.technikumwien.movies.generated + ${project.build.directory}/generated + + + + + wsimport + + + + org.apache.maven.plugins maven-compiler-plugin diff --git a/MoviesClient/src/main/java/at.technikumwien.movies/MovieList.java b/MoviesClient/src/main/java/at.technikumwien.movies/MovieList.java new file mode 100644 index 0000000..cdfc8e2 --- /dev/null +++ b/MoviesClient/src/main/java/at.technikumwien.movies/MovieList.java @@ -0,0 +1,23 @@ +package at.technikumwien.movies; + +import at.technikumwien.movies.generated.Movie; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** Wrapper for XML with multiple movies **/ +@XmlRootElement(name = "movies") +public class MovieList { + @XmlElement(name="movie") + public List movies; + + public MovieList(List movies) { + this.movies = movies; + } + + public MovieList() { + this.movies = new ArrayList(); + }; +} diff --git a/MoviesClient/src/main/java/at.technikumwien.movies/MoviesWebServiceClient.java b/MoviesClient/src/main/java/at.technikumwien.movies/MoviesWebServiceClient.java index ca17d60..c998691 100644 --- a/MoviesClient/src/main/java/at.technikumwien.movies/MoviesWebServiceClient.java +++ b/MoviesClient/src/main/java/at.technikumwien.movies/MoviesWebServiceClient.java @@ -1,17 +1,16 @@ package at.technikumwien.movies; -import javax.xml.namespace.QName; + +import at.technikumwien.movies.generated.Movie; +import at.technikumwien.movies.generated.MoviesWebService_Service; + 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/movieservice/MoviesWebService?wsdl"); - QName serviceName = new QName("http://movies.technikumwien.at/", "MoviesWebService"); - - Service service = Service.create(wsdl, serviceName); - MoviesWebService port = service.getPort(MoviesWebService.class); + MoviesWebService_Service service = new MoviesWebService_Service(); + at.technikumwien.movies.generated.MoviesWebService port = service.getMoviesWebServicePort(); // TODO: Move to a better place diff --git a/MoviesClient/src/main/java/at.technikumwien.movies/XmlHelper.java b/MoviesClient/src/main/java/at.technikumwien.movies/XmlHelper.java index a83d27b..7e136c4 100644 --- a/MoviesClient/src/main/java/at.technikumwien.movies/XmlHelper.java +++ b/MoviesClient/src/main/java/at.technikumwien.movies/XmlHelper.java @@ -6,7 +6,7 @@ import java.io.File; import java.util.List; public class XmlHelper { - public static void moviesToXml(List movies, String filename) throws Exception { + public static void moviesToXml(List movies, String filename) throws Exception { MovieList movieList = new MovieList(movies); JAXBContext jaxbContext = JAXBContext.newInstance(MovieList.class); @@ -20,7 +20,7 @@ public class XmlHelper { marshaller.marshal(movieList, new File(filename)); } - public static List xmlToMovies(String filename) throws JAXBException { + public static List xmlToMovies(String filename) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(MovieList.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); diff --git a/MoviesCommon/src/main/java/at.technikumwien.movies/MovieList.java b/MoviesCommon/src/main/java/at.technikumwien.movies/MovieList.java index 2eb4bd6..6f0aac6 100644 --- a/MoviesCommon/src/main/java/at.technikumwien.movies/MovieList.java +++ b/MoviesCommon/src/main/java/at.technikumwien.movies/MovieList.java @@ -1,16 +1,11 @@ package at.technikumwien.movies; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; - import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.util.List; /** Wrapper for XML with multiple movies **/ @XmlRootElement(name = "movies") -@AllArgsConstructor -@NoArgsConstructor public class MovieList { @XmlElement(name="movie") public List movies; diff --git a/movietest.xml b/movietest.xml index 07437b3..38b0c62 100644 --- a/movietest.xml +++ b/movietest.xml @@ -1,6 +1,6 @@ - +