cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r826763 - in /cxf/trunk/rt: bindings/soap/src/main/java/org/apache/cxf/binding/soap/ bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/ ws/addr/src/main/java/...
Date Mon, 19 Oct 2009 19:02:57 GMT
Author: dkulp
Date: Mon Oct 19 19:02:56 2009
New Revision: 826763

URL: http://svn.apache.org/viewvc?rev=826763&view=rev
Log:
[CXF-2481] If SOAPMessage or similar already defines a prefix for soap
envelope ns, use it.

Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
    cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java?rev=826763&r1=826762&r2=826763&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java Mon Oct
19 19:02:56 2009
@@ -49,8 +49,6 @@
 
     private final String namespace = SOAP_NAMESPACE;
 
-    private final String prefix = "soap";
-
     private final String noneRole = namespace + "/role/none";
 
     private final String ultimateReceiverRole = namespace + "/role/ultimateReceiver";
@@ -59,13 +57,13 @@
 
     private final String soapEncodingStyle = SOAP_ENCODING_URI;
 
-    private final QName envelope = new QName(namespace, "Envelope", prefix);
+    private final QName envelope = new QName(namespace, "Envelope");
 
-    private final QName header = new QName(namespace, "Header", prefix);
+    private final QName header = new QName(namespace, "Header");
 
-    private final QName body = new QName(namespace, "Body", prefix);
+    private final QName body = new QName(namespace, "Body");
 
-    private final QName fault = new QName(namespace, "Fault", prefix);      
+    private final QName fault = new QName(namespace, "Fault");      
 
     private Soap11() {
         // Singleton 
@@ -88,10 +86,6 @@
         return namespace;
     }
 
-    public String getPrefix() {
-        return prefix;
-    }
-
     public QName getEnvelope() {
         return envelope;
     }
@@ -162,4 +156,9 @@
     public String getContentType() {
         return "text/xml";
     }
+
+
+    public String getPrefix() {
+        return "soap";
+    }
 }

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java?rev=826763&r1=826762&r2=826763&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java Mon Oct
19 19:02:56 2009
@@ -34,8 +34,6 @@
 
     private final String namespace = SOAP_NAMESPACE;
 
-    private final String prefix = "soap";
-
     private final String noneRole = namespace + "/role/none";
 
     private final String ultimateReceiverRole = namespace + "/role/ultimateReceiver";
@@ -44,13 +42,13 @@
 
     private final String soapEncodingStyle = "http://www.w3.org/2003/05/soap-encoding";
 
-    private final QName envelope = new QName(namespace, "Envelope", prefix);
+    private final QName envelope = new QName(namespace, "Envelope");
 
-    private final QName header = new QName(namespace, "Header", prefix);
+    private final QName header = new QName(namespace, "Header");
 
-    private final QName body = new QName(namespace, "Body", prefix);
+    private final QName body = new QName(namespace, "Body");
 
-    private final QName fault = new QName(namespace, "Fault", prefix);
+    private final QName fault = new QName(namespace, "Fault");
 
     private Soap12() {
        // Singleton 
@@ -71,10 +69,6 @@
         return namespace;
     }
 
-    public String getPrefix() {
-        return prefix;
-    }
-
     public QName getEnvelope() {
         return envelope;
     }
@@ -143,4 +137,9 @@
     public String getContentType() {
         return "application/soap+xml";
     }
+    
+    public String getPrefix() {
+        return "soap";
+    }
+
 }

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java?rev=826763&r1=826762&r2=826763&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
Mon Oct 19 19:02:56 2009
@@ -28,6 +28,7 @@
 
     String getNamespace();
 
+    @Deprecated
     String getPrefix();
 
     QName getEnvelope();

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=826763&r1=826762&r2=826763&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
Mon Oct 19 19:02:56 2009
@@ -95,7 +95,10 @@
         final SoapVersion soapVersion = message.getVersion();
         try {            
             XMLStreamWriter xtw = message.getContent(XMLStreamWriter.class);
-            String soapPrefix = soapVersion.getPrefix();
+            String soapPrefix = xtw.getPrefix(soapVersion.getNamespace());
+            if (StringUtils.isEmpty(soapPrefix)) {
+                soapPrefix = "soap";
+            }
             if (message.hasAdditionalEnvNs()) {
                 Map<String, String> nsMap = message.getEnvelopeNs();
                 for (Map.Entry<String, String> entry : nsMap.entrySet()) {
@@ -118,7 +121,12 @@
                 xtw.writeStartElement(soapPrefix, 
                                       soapVersion.getEnvelope().getLocalPart(),
                                       soapVersion.getNamespace());
-                xtw.writeNamespace(soapPrefix, soapVersion.getNamespace());
+                String s2 = xtw.getPrefix(soapVersion.getNamespace());
+                if (StringUtils.isEmpty(s2) || soapPrefix.equals(s2)) {
+                    xtw.writeNamespace(soapPrefix, soapVersion.getNamespace());
+                } else {
+                    soapPrefix = s2;
+                }
             }
             boolean preexistingHeaders = message.hasHeaders();
 

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java?rev=826763&r1=826762&r2=826763&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptorTest.java
Mon Oct 19 19:02:56 2009
@@ -143,11 +143,11 @@
                 try {
                     XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
                     SoapVersion soapVersion = Soap11.getInstance();
-                    writer.setPrefix(soapVersion.getPrefix(), soapVersion.getNamespace());
-                    writer.writeStartElement(soapVersion.getPrefix(), 
+                    writer.setPrefix("soap", soapVersion.getNamespace());
+                    writer.writeStartElement("soap", 
                                           soapVersion.getEnvelope().getLocalPart(),
                                           soapVersion.getNamespace());
-                    writer.writeNamespace(soapVersion.getPrefix(), soapVersion.getNamespace());
+                    writer.writeNamespace("soap", soapVersion.getNamespace());
                     writer.writeEndElement();
                     
                     writer.flush();
@@ -343,11 +343,11 @@
                 try {
                     XMLStreamWriter writer = message.getContent(XMLStreamWriter.class); 
                     SoapVersion soapVersion = Soap11.getInstance();
-                    writer.setPrefix(soapVersion.getPrefix(), soapVersion.getNamespace());
-                    writer.writeStartElement(soapVersion.getPrefix(), 
+                    writer.setPrefix("soap", soapVersion.getNamespace());
+                    writer.writeStartElement("soap", 
                                           soapVersion.getEnvelope().getLocalPart(),
                                           soapVersion.getNamespace());
-                    writer.writeNamespace(soapVersion.getPrefix(), soapVersion.getNamespace());
+                    writer.writeNamespace("soap", soapVersion.getNamespace());
                     
                     Object[] headerInfo = prepareSOAPHeader();
                     StaxUtils.writeElement((Element) headerInfo[1], writer, true, false);

Modified: cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=826763&r1=826762&r2=826763&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Mon
Oct 19 19:02:56 2009
@@ -369,7 +369,10 @@
                                             AddressingPropertiesImpl maps) {
         if (maps.getMustUnderstand().contains(name)) {
             Element lastAdded = (Element)header.getLastChild();
-            String pfx = msg.getVersion().getPrefix();
+            String pfx = lastAdded.lookupPrefix(msg.getVersion().getNamespace());
+            if (StringUtils.isEmpty(pfx)) {
+                pfx = "soap";
+            }
             if (msg.hasAdditionalEnvNs()) {
                 String ns = msg.getVersion().getNamespace();
                 Map<String, String> nsMap = msg.getEnvelopeNs();



Mime
View raw message