/**
* <p>
- * WSDL Port Types
+ * WSDL 1.1 Port Types
* </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#_porttypes</a>
- *
+ * <p>
+ * WSDL 2.0 is different, so this interface just works with 1.1. Indeed I should
+ * not implement this interface because of the differences between 2.0 and 1.1 but I
+ * am doing it because I want to improve my skills related to Java Generics.
+ * </p>
+ * See: <a
+ * href="http://www.w3.org/TR/wsdl#_porttypes">http://www.w3.org/TR/wsdl#
+ * _porttypes</a>
+ *
*/
public interface PortType<E extends Request, T extends Response> {
* <p>
* Request-response operation
* </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org/TR/wsdl#_request-response</a>
- *
- * @param <T> Describes {@link Response}
- * @param <E> Describes {@link Request}
+ * See: <a
+ * href="http://www.w3.org/TR/wsdl#_request-response">http://www.w3.org
+ * /TR/wsdl#_request-response</a>
+ *
+ * @param <T>
+ * Describes {@link Response}
+ * @param <E>
+ * Describes {@link Request}
*/
public interface RequestResponse<T, E> {
- T requestResponse (E request);
+ T requestResponse(E request);
}
-
+
/**
* <p>
* One-way operation
* </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl#_one-way</a>
- *
- * @param <T> Describes {@link Response}
- * @param <E> Describes {@link Request}
+ * See: <a
+ * href="http://www.w3.org/TR/wsdl#_one-way">http://www.w3.org/TR/wsdl
+ * #_one-way</a>
+ *
+ * @param <T>
+ * Describes {@link Response}
+ * @param <E>
+ * Describes {@link Request}
*/
public interface OneWay<E> {
- void oneWay (E request);
+ void oneWay(E request);
}
-
+
/**
* <p>
* Notification operation
* </p>
- * See: <a href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR/wsdl#_notification</a>
- *
- * @param <T> Describes {@link Response}
- * @param <E> Describes {@link Request}
+ * See: <a
+ * href="http://www.w3.org/TR/wsdl#_notification">http://www.w3.org/TR
+ * /wsdl#_notification</a>
+ *
+ * @param <T>
+ * Describes {@link Response}
+ * @param <E>
+ * Describes {@link Request}
*/
public interface Notification<T> {
- T notification ();
+ T notification();
}
}
package de.spring.webservices.tests;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static org.springframework.ws.test.server.RequestCreators.withPayload;
+import static org.springframework.ws.test.server.ResponseMatchers.payload;
import javax.xml.transform.Source;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.ws.test.server.MockWebServiceClient;
import org.springframework.xml.transform.StringSource;
-import static org.springframework.ws.test.server.RequestCreators.*;
-import static org.springframework.ws.test.server.ResponseMatchers.*;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/spring-configuration.xml")
@Autowired
private ApplicationContext applicationContext;
-
+
private MockWebServiceClient mockClient;
@Before
public void createClient() {
- mockClient = MockWebServiceClient.createClient(applicationContext);
+ mockClient = MockWebServiceClient.createClient(applicationContext);
}
@Test
public void exampleEndpoint() throws Exception {
- Source requestPayload = new StringSource(
- "<ExampleRequest xmlns='http://localhost:8888/spring-ws/example'>" +
- "<data>Houston</data>" +
- "</ExampleRequest>");
- Source responsePayload = new StringSource(
- "<ns2:ExampleResponse xmlns:ns2='http://localhost:8888/spring-ws/example'>" +
- " <ns2:data>SNAKE EYES AND Houston</ns2:data>" +
- "</ns2:ExampleResponse>");
- mockClient.sendRequest(withPayload(requestPayload)).andExpect(payload(responsePayload));
+ final Source requestPayload = new StringSource(
+ "<ExampleRequest xmlns='http://localhost:8888/spring-ws/example'>" +
+ "<data>SCARLETT</data>" +
+ "</ExampleRequest>");
+ final Source responsePayload = new StringSource(
+ "<ns2:ExampleResponse xmlns:ns2='http://localhost:8888/spring-ws/example'>" +
+ "<ns2:data>SNAKE EYES AND SCARLETT</ns2:data>" +
+ "</ns2:ExampleResponse>");
+ mockClient.sendRequest(withPayload(requestPayload)).andExpect(
+ payload(responsePayload));
}
}