-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
480 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.greglturnquist</groupId> | ||
<artifactId>learning-spring-ws-client</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>Learning Spring WS - Client</name> | ||
<description>Learning Spring WS</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.1.4.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-ws</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<start-class>com.greglturnquist.learningspringws.Client</start-class> | ||
<java.version>1.7</java.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb2.maven2</groupId> | ||
<artifactId>maven-jaxb2-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<schemaLanguage>WSDL</schemaLanguage> | ||
<generatePackage>com.greglturnquist.wsdl</generatePackage> | ||
<forceRegenerate>true</forceRegenerate> | ||
<schemas> | ||
<schema> | ||
<url>http://localhost:8080/ws/network-events.wsdl</url> | ||
</schema> | ||
</schemas> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
21 changes: 21 additions & 0 deletions
21
learning-spring-ws-client/src/main/java/com/greglturnquist/learningspringws/Client.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.greglturnquist.learningspringws; | ||
|
||
import com.greglturnquist.wsdl.SendNetworkEventResponse; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
public class Client { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(Client.class); | ||
|
||
public static void main(String[] args) { | ||
ApplicationContext ctx = SpringApplication.run(NetworkEventConfiguration.class, args); | ||
|
||
NetworkEventClient networkEventClient = ctx.getBean(NetworkEventClient.class); | ||
SendNetworkEventResponse response = networkEventClient.sendNetworkEvent(); | ||
log.info(response.toString()); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...pring-ws-client/src/main/java/com/greglturnquist/learningspringws/NetworkEventClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.greglturnquist.learningspringws; | ||
|
||
import java.math.BigInteger; | ||
|
||
import com.greglturnquist.wsdl.SendNetworkEventRequest; | ||
import com.greglturnquist.wsdl.SendNetworkEventResponse; | ||
import org.springframework.ws.client.core.support.WebServiceGatewaySupport; | ||
import org.springframework.ws.soap.client.core.SoapActionCallback; | ||
|
||
public class NetworkEventClient extends WebServiceGatewaySupport { | ||
|
||
public SendNetworkEventResponse sendNetworkEvent() { | ||
|
||
SendNetworkEventRequest request = new SendNetworkEventRequest(); | ||
request.setHostname("retina"); | ||
request.setDescription("New event!"); | ||
request.setSeverity(BigInteger.valueOf(5)); | ||
|
||
return (SendNetworkEventResponse) getWebServiceTemplate().marshalSendAndReceive( | ||
request, | ||
new SoapActionCallback("http://localhost:8080/ws")); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...s-client/src/main/java/com/greglturnquist/learningspringws/NetworkEventConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.greglturnquist.learningspringws; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.oxm.jaxb.Jaxb2Marshaller; | ||
|
||
@Configuration | ||
public class NetworkEventConfiguration { | ||
|
||
@Bean | ||
Jaxb2Marshaller marshaller() { | ||
Jaxb2Marshaller marshaller = new Jaxb2Marshaller(); | ||
marshaller.setContextPath("com.greglturnquist.wsdl"); | ||
return marshaller; | ||
} | ||
|
||
@Bean | ||
NetworkEventClient client(Jaxb2Marshaller marshaller) { | ||
NetworkEventClient networkEventClient = new NetworkEventClient(); | ||
networkEventClient.setDefaultUri("http://localhost:8080/ws"); | ||
networkEventClient.setMarshaller(marshaller); | ||
networkEventClient.setUnmarshaller(marshaller); | ||
return networkEventClient; | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
learning-spring-ws-client/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
server.port=9000 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.greglturnquist</groupId> | ||
<artifactId>learning-spring-ws-server</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>Learning Spring WS - Server</name> | ||
<description>Learning Spring WS</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.1.4.RELEASE</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-ws</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>wsdl4j</groupId> | ||
<artifactId>wsdl4j</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<start-class>com.greglturnquist.learningspringws.Server</start-class> | ||
<java.version>1.7</java.version> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>jaxb2-maven-plugin</artifactId> | ||
<version>1.6</version> | ||
<executions> | ||
<execution> | ||
<id>xjc</id> | ||
<goals> | ||
<goal>xjc</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory> | ||
<outputDirectory>${project.basedir}/src/main/java</outputDirectory> | ||
<clearOutputDir>false</clearOutputDir> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
learning-spring-ws-server/src/main/java/com/greglturnquist/test/ObjectFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 | ||
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> | ||
// Any modifications to this file will be lost upon recompilation of the source schema. | ||
// Generated on: 2014.07.14 at 09:51:20 PM CDT | ||
// | ||
|
||
|
||
package com.greglturnquist.test; | ||
|
||
import javax.xml.bind.annotation.XmlRegistry; | ||
|
||
|
||
/** | ||
* This object contains factory methods for each | ||
* Java content interface and Java element interface | ||
* generated in the com.greglturnquist.test package. | ||
* <p>An ObjectFactory allows you to programatically | ||
* construct new instances of the Java representation | ||
* for XML content. The Java representation of XML | ||
* content can consist of schema derived interfaces | ||
* and classes representing the binding of schema | ||
* type definitions, element declarations and model | ||
* groups. Factory methods for each of these are | ||
* provided in this class. | ||
* | ||
*/ | ||
@XmlRegistry | ||
public class ObjectFactory { | ||
|
||
|
||
/** | ||
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.greglturnquist.test | ||
* | ||
*/ | ||
public ObjectFactory() { | ||
} | ||
|
||
/** | ||
* Create an instance of {@link SendNetworkEventRequest } | ||
* | ||
*/ | ||
public SendNetworkEventRequest createSendNetworkEventRequest() { | ||
return new SendNetworkEventRequest(); | ||
} | ||
|
||
/** | ||
* Create an instance of {@link SendNetworkEventResponse } | ||
* | ||
*/ | ||
public SendNetworkEventResponse createSendNetworkEventResponse() { | ||
return new SendNetworkEventResponse(); | ||
} | ||
|
||
} |
Oops, something went wrong.