Restructure: Client uses wsimport instead of MoviesCommon
This commit is contained in:
parent
28a73932ae
commit
997a167c2e
6
.idea/compiler.xml
generated
6
.idea/compiler.xml
generated
@ -13,9 +13,9 @@
|
|||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
<module name="MoviesApp" target="11" />
|
<module name="MoviesApp" target="11" />
|
||||||
<module name="MoviesClient" target="11" />
|
<module name="MoviesClient" target="9" />
|
||||||
<module name="MoviesCommon" target="11" />
|
<module name="MoviesCommon" target="9" />
|
||||||
<module name="MoviesWebApp" target="11" />
|
<module name="MoviesWebApp" target="9" />
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -15,6 +15,7 @@
|
|||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/target/generated" isTestSource="false" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
@ -58,6 +59,5 @@
|
|||||||
<orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.2" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: jakarta.xml.soap:jakarta.xml.soap-api:1.4.1" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.xml.soap:jakarta.xml.soap-api:1.4.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: jakarta.jws:jakarta.jws-api:1.1.1" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.jws:jakarta.jws-api:1.1.1" level="project" />
|
||||||
<orderEntry type="module" module-name="MoviesCommon" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -24,12 +24,6 @@
|
|||||||
<artifactId>jaxws-ri</artifactId>
|
<artifactId>jaxws-ri</artifactId>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>at.technikumwien</groupId>
|
|
||||||
<artifactId>MoviesCommon</artifactId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -68,6 +62,25 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.helger.maven</groupId>
|
||||||
|
<artifactId>jaxws-maven-plugin</artifactId>
|
||||||
|
<version>2.6.2</version>
|
||||||
|
<configuration>
|
||||||
|
<wsdlUrls>
|
||||||
|
<wsdlUrl>http://localhost:8080/movieservice/MoviesWebService?wsdl</wsdlUrl>
|
||||||
|
</wsdlUrls>
|
||||||
|
<packageName>at.technikumwien.movies.generated</packageName>
|
||||||
|
<sourceDestDir>${project.build.directory}/generated</sourceDestDir>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>wsimport</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
@ -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<Movie> movies;
|
||||||
|
|
||||||
|
public MovieList(List<Movie> movies) {
|
||||||
|
this.movies = movies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieList() {
|
||||||
|
this.movies = new ArrayList<Movie>();
|
||||||
|
};
|
||||||
|
}
|
@ -1,17 +1,16 @@
|
|||||||
package at.technikumwien.movies;
|
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 javax.xml.ws.Service;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MoviesWebServiceClient {
|
public class MoviesWebServiceClient {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
URL wsdl = new URL("http://localhost:8080/movieservice/MoviesWebService?wsdl");
|
MoviesWebService_Service service = new MoviesWebService_Service();
|
||||||
QName serviceName = new QName("http://movies.technikumwien.at/", "MoviesWebService");
|
at.technikumwien.movies.generated.MoviesWebService port = service.getMoviesWebServicePort();
|
||||||
|
|
||||||
Service service = Service.create(wsdl, serviceName);
|
|
||||||
MoviesWebService port = service.getPort(MoviesWebService.class);
|
|
||||||
|
|
||||||
// TODO: Move to a better place
|
// TODO: Move to a better place
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class XmlHelper {
|
public class XmlHelper {
|
||||||
public static void moviesToXml(List<Movie> movies, String filename) throws Exception {
|
public static void moviesToXml(List<at.technikumwien.movies.generated.Movie> movies, String filename) throws Exception {
|
||||||
MovieList movieList = new MovieList(movies);
|
MovieList movieList = new MovieList(movies);
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(MovieList.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(MovieList.class);
|
||||||
@ -20,7 +20,7 @@ public class XmlHelper {
|
|||||||
marshaller.marshal(movieList, new File(filename));
|
marshaller.marshal(movieList, new File(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Movie> xmlToMovies(String filename) throws JAXBException {
|
public static List<at.technikumwien.movies.generated.Movie> xmlToMovies(String filename) throws JAXBException {
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(MovieList.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(MovieList.class);
|
||||||
|
|
||||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
package at.technikumwien.movies;
|
package at.technikumwien.movies;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** Wrapper for XML with multiple movies **/
|
/** Wrapper for XML with multiple movies **/
|
||||||
@XmlRootElement(name = "movies")
|
@XmlRootElement(name = "movies")
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class MovieList {
|
public class MovieList {
|
||||||
@XmlElement(name="movie")
|
@XmlElement(name="movie")
|
||||||
public List<Movie> movies;
|
public List<Movie> movies;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<movies>
|
<movies>
|
||||||
<movie title="Test Movie VII" description="Same as Test Movie IV" genre="COMEDY" length="119" releaseyear="2022">
|
<movie title="Test Movie VIII" description="Weird" genre="COMEDY" length="119" releaseyear="2022">
|
||||||
<actors>
|
<actors>
|
||||||
<actor firstname="Test" lastname="Actor" sex="MALE" birthdate="01.01.1888"/>
|
<actor firstname="Test" lastname="Actor" sex="MALE" birthdate="01.01.1888"/>
|
||||||
</actors>
|
</actors>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user