From 13dbad0ffc6b2882934d0c44fdfd3d9a910ae6ea Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Mon, 25 Jun 2007 09:06:32 +0000 Subject: [PATCH] Using TransportConstants --- .../ws/soap/axiom/AxiomSoapMessage.java | 5 +++-- .../MessageDispatcherServletIntegrationTest.java | 15 +++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapMessage.java b/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapMessage.java index 970d23ce..06f8e731 100644 --- a/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapMessage.java +++ b/core/src/main/java/org/springframework/ws/soap/axiom/AxiomSoapMessage.java @@ -38,6 +38,7 @@ import org.springframework.ws.soap.AbstractSoapMessage; import org.springframework.ws.soap.SoapEnvelope; import org.springframework.ws.soap.SoapMessage; import org.springframework.ws.soap.SoapVersion; +import org.springframework.ws.transport.TransportConstants; import org.springframework.ws.transport.TransportOutputStream; /** @@ -185,8 +186,8 @@ public class AxiomSoapMessage extends AbstractSoapMessage { TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream; String contentType = format.getContentType(); contentType += "; charset=\"" + charsetEncoding + "\""; - transportOutputStream.addHeader("Content-Type", contentType); - transportOutputStream.addHeader("SOAPAction", soapAction); + transportOutputStream.addHeader(TransportConstants.HEADER_CONTENT_TYPE, contentType); + transportOutputStream.addHeader(TransportConstants.HEADER_SOAP_ACTION, soapAction); } axiomMessage.serializeAndConsume(outputStream, format); outputStream.flush(); diff --git a/core/src/test/java/org/springframework/ws/transport/http/MessageDispatcherServletIntegrationTest.java b/core/src/test/java/org/springframework/ws/transport/http/MessageDispatcherServletIntegrationTest.java index 876f82f0..2dffc31b 100644 --- a/core/src/test/java/org/springframework/ws/transport/http/MessageDispatcherServletIntegrationTest.java +++ b/core/src/test/java/org/springframework/ws/transport/http/MessageDispatcherServletIntegrationTest.java @@ -29,6 +29,7 @@ import org.mortbay.jetty.servlet.Context; import org.mortbay.jetty.servlet.ServletHolder; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; +import org.springframework.ws.transport.TransportConstants; public class MessageDispatcherServletIntegrationTest extends TestCase { @@ -36,8 +37,6 @@ public class MessageDispatcherServletIntegrationTest extends TestCase { private HttpClient client; - private static final String SOAP_ACTION = "SOAPAction"; - private static final String CONTENT_TYPE = "Content-Type"; protected final void setUp() throws Exception { @@ -59,7 +58,8 @@ public class MessageDispatcherServletIntegrationTest extends TestCase { public void testNoResponse() throws IOException { PostMethod postMethod = new PostMethod("http://localhost:8888/service"); postMethod.addRequestHeader(CONTENT_TYPE, "text/xml"); - postMethod.addRequestHeader(SOAP_ACTION, "http://springframework.org/spring-ws/NoResponse"); + postMethod.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION, + "http://springframework.org/spring-ws/NoResponse"); Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class); postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream())); client.executeMethod(postMethod); @@ -70,7 +70,8 @@ public class MessageDispatcherServletIntegrationTest extends TestCase { public void testResponse() throws IOException { PostMethod postMethod = new PostMethod("http://localhost:8888/service"); postMethod.addRequestHeader(CONTENT_TYPE, "text/xml"); - postMethod.addRequestHeader(SOAP_ACTION, "http://springframework.org/spring-ws/Response"); + postMethod.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION, + "http://springframework.org/spring-ws/Response"); Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class); postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream())); client.executeMethod(postMethod); @@ -81,7 +82,8 @@ public class MessageDispatcherServletIntegrationTest extends TestCase { public void testNoEndpoint() throws IOException { PostMethod postMethod = new PostMethod("http://localhost:8888/service"); postMethod.addRequestHeader(CONTENT_TYPE, "text/xml"); - postMethod.addRequestHeader(SOAP_ACTION, "http://springframework.org/spring-ws/NoEndpoint"); + postMethod.addRequestHeader(TransportConstants.HEADER_SOAP_ACTION, + "http://springframework.org/spring-ws/NoEndpoint"); Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class); postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream())); client.executeMethod(postMethod); @@ -92,7 +94,8 @@ public class MessageDispatcherServletIntegrationTest extends TestCase { public void testFault() throws IOException { PostMethod postMethod = new PostMethod("http://localhost:8888/service"); postMethod.addRequestHeader(CONTENT_TYPE, "text/xml"); - postMethod.addRequestHeader(SOAP_ACTION, "http://springframework.org/spring-ws/Fault"); + postMethod + .addRequestHeader(TransportConstants.HEADER_SOAP_ACTION, "http://springframework.org/spring-ws/Fault"); Resource soapRequest = new ClassPathResource("soapRequest.xml", MessageDispatcherServletIntegrationTest.class); postMethod.setRequestEntity(new InputStreamRequestEntity(soapRequest.getInputStream())); client.executeMethod(postMethod);