ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1603084 - in /webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap: AxiomSoapMessageFactory.java SoapEnvelopeImpl.java SoapMessageImpl.java
Date Tue, 17 Jun 2014 07:54:34 GMT
Author: veithen
Date: Tue Jun 17 07:54:34 2014
New Revision: 1603084

URL: http://svn.apache.org/r1603084
Log:
AXIOM-447: Only create SOAP Header when necessary.

Modified:
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java
    webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java?rev=1603084&r1=1603083&r2=1603084&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
(original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/AxiomSoapMessageFactory.java
Tue Jun 17 07:54:34 2014
@@ -73,9 +73,7 @@ public final class AxiomSoapMessageFacto
     }
 
     public SoapMessage createWebServiceMessage() {
-        SOAPMessage axiomMessage = soapFactory.createSOAPMessage();
-        axiomMessage.setSOAPEnvelope(soapFactory.getDefaultEnvelope());
-        return new SoapMessageImpl(axiomMessage);
+        return new SoapMessageImpl(soapFactory.createDefaultSOAPMessage(), true);
     }
 
     public SoapMessage createWebServiceMessage(InputStream inputStream) throws IOException
{
@@ -100,6 +98,6 @@ public final class AxiomSoapMessageFacto
         SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory,
inputStream, charset);
         // TODO: should SOAPModelBuilder have a getSOAPMessage() method?
         // TODO: need to check that the SOAP version matches the content type
-        return new SoapMessageImpl((SOAPMessage)builder.getDocument());
+        return new SoapMessageImpl((SOAPMessage)builder.getDocument(), false);
     }
 }

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java?rev=1603084&r1=1603083&r2=1603084&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapEnvelopeImpl.java
Tue Jun 17 07:54:34 2014
@@ -33,15 +33,17 @@ import org.springframework.ws.soap.SoapH
 import org.springframework.ws.soap.SoapHeaderException;
 
 final class SoapEnvelopeImpl extends SoapElementImpl<SOAPEnvelope> implements SoapEnvelope
{
+    private final boolean autoCreateHeader;
     private SoapHeaderImpl header;
     private SoapBodyImpl body;
     
-    SoapEnvelopeImpl(SoapMessageImpl message, SOAPEnvelope axiomNode) {
+    SoapEnvelopeImpl(SoapMessageImpl message, SOAPEnvelope axiomNode, boolean autoCreateHeader)
{
         super(message, axiomNode);
+        this.autoCreateHeader = autoCreateHeader;
     }
 
     public SoapHeader getHeader() throws SoapHeaderException {
-        SOAPHeader axiomHeader = axiomNode.getHeader();
+        SOAPHeader axiomHeader = autoCreateHeader ? axiomNode.getOrCreateHeader() : axiomNode.getHeader();
         if (header == null || header.axiomNode != axiomHeader) {
             if (axiomHeader == null) {
                 header = null;

Modified: webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java?rev=1603084&r1=1603083&r2=1603084&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
(original)
+++ webservices/axiom/trunk/axiom-spring-ws/src/main/java/org/apache/axiom/spring/ws/soap/SoapMessageImpl.java
Tue Jun 17 07:54:34 2014
@@ -55,14 +55,17 @@ final class SoapMessageImpl extends Abst
     private final SourceExtractionStrategyStack extractionStrategyStack = new SourceExtractionStrategyStack();
     private SoapEnvelopeImpl envelope;
     
-    SoapMessageImpl(SOAPMessage axiomMessage) {
+    SoapMessageImpl(SOAPMessage axiomMessage, boolean autoCreateHeader) {
         this.axiomMessage = axiomMessage;
+        if (autoCreateHeader) {
+            envelope = new SoapEnvelopeImpl(this, axiomMessage.getSOAPEnvelope(), true);
+        }
     }
 
     public SoapEnvelope getEnvelope() throws SoapEnvelopeException {
         SOAPEnvelope axiomEnvelope = axiomMessage.getSOAPEnvelope();
         if (envelope == null || envelope.axiomNode != axiomEnvelope) {
-            envelope = new SoapEnvelopeImpl(this, axiomEnvelope);
+            envelope = new SoapEnvelopeImpl(this, axiomEnvelope, false);
         }
         return envelope;
     }



Mime
View raw message