cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r648401 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/attachment/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/core/src/test...
Date Tue, 15 Apr 2008 20:14:01 GMT
Author: dkulp
Date: Tue Apr 15 13:13:52 2008
New Revision: 648401

URL: http://svn.apache.org/viewvc?rev=648401&view=rev
Log:
Merged revisions 648400 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r648400 | dkulp | 2008-04-15 16:01:14 -0400 (Tue, 15 Apr 2008) | 3 lines
  
  [CXF-1496] Patch for mtom attachement headers from   Gianfranco Boccalon applied
  Update a bunch of places to set fault codes to :Client instead of :Server if appropriate
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java?rev=648401&r1=648400&r2=648401&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
Tue Apr 15 13:13:52 2008
@@ -130,7 +130,14 @@
                                                                            LOG,
                                                                            qn));
                 }
-                parameters.put(part, dr.read(part, xmlReader));
+                try {
+                    parameters.put(part, dr.read(part, xmlReader));
+                } catch (Fault f) {
+                    if (!isRequestor(message)) {
+                        f.setFaultCode(Fault.FAULT_CODE_CLIENT);
+                    }
+                    throw f;
+                }
             }
         }
 

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java?rev=648401&r1=648400&r2=648401&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentSerializer.java
Tue Apr 15 13:13:52 2008
@@ -51,6 +51,25 @@
         
         String bodyCt = (String) message.get(Message.CONTENT_TYPE);
         bodyCt = bodyCt.replaceAll("\"", "\\\"");
+        
+        // The bodyCt string is used enclosed within "", so if it contains the character
", it
+        // should be adjusted, like in the following case:
+        //   application/soap+xml; action="urn:ihe:iti:2007:RetrieveDocumentSet"
+        // The attribute action is added in SoapActionOutInterceptor, when SOAP 1.2 is used
+        // The string has to be changed in:
+        //   application/soap+xml"; action="urn:ihe:iti:2007:RetrieveDocumentSet
+        // so when it is enclosed within "", the result must be:
+        //   "application/soap+xml"; action="urn:ihe:iti:2007:RetrieveDocumentSet"
+        // instead of 
+        //   "application/soap+xml; action="urn:ihe:iti:2007:RetrieveDocumentSet""
+        // that is wrong because when used it produces:
+        //   type="application/soap+xml; action="urn:ihe:iti:2007:RetrieveDocumentSet""
+        if ((bodyCt.indexOf('"') != -1) && (bodyCt.indexOf(';') != -1)) {
+            int pos = bodyCt.indexOf(';');
+            StringBuffer st = new StringBuffer(bodyCt.substring(0 , pos));
+            st.append("\"").append(bodyCt.substring(pos, bodyCt.length() - 1));
+            bodyCt = st.toString();
+        }        
         String enc = (String) message.get(Message.ENCODING);
         if (enc == null) {
             enc = "UTF-8";
@@ -91,9 +110,7 @@
             .append(enc)
             .append("; type=\"")
             .append(bodyCt)
-            .append("; charset=")
-            .append(enc)
-            .append("\"");
+            .append("\";");
         
         writeHeaders(mimeBodyCt.toString(), BODY_ATTACHMENT_ID, writer);
         out.write(writer.getBuffer().toString().getBytes(encoding));

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java?rev=648401&r1=648400&r2=648401&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
Tue Apr 15 13:13:52 2008
@@ -134,7 +134,14 @@
                                 Fault.FAULT_CODE_CLIENT);
             }
 
-            o = dr.read(p, xmlReader);
+            try {
+                o = dr.read(p, xmlReader);                
+            } catch (Fault fault) {
+                if (!isRequestor(message)) {
+                    fault.setFaultCode(Fault.FAULT_CODE_CLIENT);
+                }
+                throw fault;
+            }
 
             if (o != null) {
                 parameters.put(p, o);

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=648401&r1=648400&r2=648401&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
Tue Apr 15 13:13:52 2008
@@ -91,104 +91,111 @@
             bop = getBindingOperationInfo(exchange, startQName, client);
         }
 
-        if (bop != null && bop.isUnwrappedCapable()) {
-            ServiceInfo si = bop.getBinding().getService();
-            // Wrapped case
-            MessageInfo msgInfo = setMessage(message, bop, client, si);
-
-            // Determine if there is a wrapper class
-            if (msgInfo.getMessageParts().get(0).getTypeClass() != null) {
-                Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), xmlReader);
-                parameters.put(msgInfo.getMessageParts().get(0), wrappedObject);
-            } else {
-                // Unwrap each part individually if we don't have a wrapper
-
-                bop = bop.getUnwrappedOperation();
-
-                msgInfo = setMessage(message, bop, client, si);
-                List<MessagePartInfo> messageParts = msgInfo.getMessageParts();
-                Iterator<MessagePartInfo> itr = messageParts.iterator();
-
-                // advance just past the wrapped element so we don't get
-                // stuck
-                if (xmlReader.getEventType() == XMLStreamConstants.START_ELEMENT) {
-                    StaxUtils.nextEvent(xmlReader);
-                }
-
-                // loop through each child element
-                getPara(xmlReader, dr, parameters, itr, message);
-            }
-
-        } else {
-            //Bare style
-            BindingMessageInfo msgInfo = null;
-
-            if (bop != null) { //for xml binding or client side
-                getMessageInfo(message, bop);
-                if (client) {
-                    msgInfo = bop.getOutput();
+        try {
+            if (bop != null && bop.isUnwrappedCapable()) {
+                ServiceInfo si = bop.getBinding().getService();
+                // Wrapped case
+                MessageInfo msgInfo = setMessage(message, bop, client, si);
+    
+                // Determine if there is a wrapper class
+                if (msgInfo.getMessageParts().get(0).getTypeClass() != null) {
+                    Object wrappedObject = dr.read(msgInfo.getMessageParts().get(0), xmlReader);
+                    parameters.put(msgInfo.getMessageParts().get(0), wrappedObject);
                 } else {
-                    msgInfo = bop.getInput();
+                    // Unwrap each part individually if we don't have a wrapper
+    
+                    bop = bop.getUnwrappedOperation();
+    
+                    msgInfo = setMessage(message, bop, client, si);
+                    List<MessagePartInfo> messageParts = msgInfo.getMessageParts();
+                    Iterator<MessagePartInfo> itr = messageParts.iterator();
+    
+                    // advance just past the wrapped element so we don't get
+                    // stuck
+                    if (xmlReader.getEventType() == XMLStreamConstants.START_ELEMENT) {
+                        StaxUtils.nextEvent(xmlReader);
+                    }
+    
+                    // loop through each child element
+                    getPara(xmlReader, dr, parameters, itr, message);
                 }
-            }
-
-            Collection<OperationInfo> operations = null;
-            operations = new ArrayList<OperationInfo>();
-            Endpoint ep = exchange.get(Endpoint.class);
-            ServiceInfo si = ep.getEndpointInfo().getService();
-            operations.addAll(si.getInterface().getOperations());
-
-            if (!StaxUtils.toNextElement(xmlReader)) {
-                // empty input
-
-                // TO DO : check duplicate operation with no input
-                for (OperationInfo op : operations) {
-                    MessageInfo bmsg = op.getInput();
-                    if (bmsg.getMessageParts().size() == 0) {
-                        BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op);
-                        exchange.put(BindingOperationInfo.class, boi);
-                        exchange.put(OperationInfo.class, op);
-                        exchange.setOneWay(op.isOneWay());
+    
+            } else {
+                //Bare style
+                BindingMessageInfo msgInfo = null;
+    
+                if (bop != null) { //for xml binding or client side
+                    getMessageInfo(message, bop);
+                    if (client) {
+                        msgInfo = bop.getOutput();
+                    } else {
+                        msgInfo = bop.getInput();
                     }
                 }
-                return;
-            }
-
-            int paramNum = 0;
-
-            do {
-                QName elName = xmlReader.getName();
-                Object o = null;
-
-                MessagePartInfo p;
-                if (!client && msgInfo != null && msgInfo.getMessageParts()
!= null 
-                    && msgInfo.getMessageParts().size() == 0) {
-                    //no input messagePartInfo
+    
+                Collection<OperationInfo> operations = null;
+                operations = new ArrayList<OperationInfo>();
+                Endpoint ep = exchange.get(Endpoint.class);
+                ServiceInfo si = ep.getEndpointInfo().getService();
+                operations.addAll(si.getInterface().getOperations());
+    
+                if (!StaxUtils.toNextElement(xmlReader)) {
+                    // empty input
+    
+                    // TO DO : check duplicate operation with no input
+                    for (OperationInfo op : operations) {
+                        MessageInfo bmsg = op.getInput();
+                        if (bmsg.getMessageParts().size() == 0) {
+                            BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op);
+                            exchange.put(BindingOperationInfo.class, boi);
+                            exchange.put(OperationInfo.class, op);
+                            exchange.setOneWay(op.isOneWay());
+                        }
+                    }
                     return;
                 }
-                if (msgInfo != null && msgInfo.getMessageParts() != null 
-                    && msgInfo.getMessageParts().size() > 0) {
-                    assert msgInfo.getMessageParts().size() > paramNum;
-                    p = msgInfo.getMessageParts().get(paramNum);
-                } else {
-                    p = findMessagePart(exchange, operations, elName, client, paramNum);
-                }
-
-                if (p == null) {
-                    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND",
LOG, elName),
-                                    Fault.FAULT_CODE_CLIENT);
-                }
-
-                o = dr.read(p, xmlReader);
-                parameters.put(p, o);
-                
-                paramNum++;
-            } while (StaxUtils.toNextElement(xmlReader));
-
-        }
-
-        if (parameters.size() > 0) {
-            message.setContent(List.class, parameters);
+    
+                int paramNum = 0;
+    
+                do {
+                    QName elName = xmlReader.getName();
+                    Object o = null;
+    
+                    MessagePartInfo p;
+                    if (!client && msgInfo != null && msgInfo.getMessageParts()
!= null 
+                        && msgInfo.getMessageParts().size() == 0) {
+                        //no input messagePartInfo
+                        return;
+                    }
+                    if (msgInfo != null && msgInfo.getMessageParts() != null 
+                        && msgInfo.getMessageParts().size() > 0) {
+                        assert msgInfo.getMessageParts().size() > paramNum;
+                        p = msgInfo.getMessageParts().get(paramNum);
+                    } else {
+                        p = findMessagePart(exchange, operations, elName, client, paramNum);
+                    }
+    
+                    if (p == null) {
+                        throw new Fault(new org.apache.cxf.common.i18n.Message("NO_PART_FOUND",
LOG, elName),
+                                        Fault.FAULT_CODE_CLIENT);
+                    }
+    
+                    o = dr.read(p, xmlReader);
+                    parameters.put(p, o);
+                    
+                    paramNum++;
+                } while (StaxUtils.toNextElement(xmlReader));
+    
+            }
+    
+            if (parameters.size() > 0) {
+                message.setContent(List.class, parameters);
+            }
+        } catch (Fault f) {
+            if (!isRequestor(message)) {
+                f.setFaultCode(Fault.FAULT_CODE_CLIENT);
+            }
+            throw f;
         }
     }
     

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java?rev=648401&r1=648400&r2=648401&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/test/java/org/apache/cxf/attachment/AttachmentSerializerTest.java
Tue Apr 15 13:13:52 2008
@@ -84,7 +84,7 @@
         MimeMultipart multipart = (MimeMultipart) inMsg.getContent();
         
         MimeBodyPart part = (MimeBodyPart) multipart.getBodyPart(0);
-        assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml; charset=UTF-8\"",

+        assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";",

                      part.getHeader("Content-Type")[0]);
         assertEquals("binary", part.getHeader("Content-Transfer-Encoding")[0]);
         assertEquals("<root.message@cxf.apache.org>", part.getHeader("Content-ID")[0]);
@@ -147,7 +147,7 @@
         MimeMultipart multipart = (MimeMultipart) inMsg.getContent();
         
         MimeBodyPart part = (MimeBodyPart) multipart.getBodyPart(0);
-        assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml; charset=UTF-8\"",

+        assertEquals("application/xop+xml; charset=UTF-8; type=\"application/soap+xml\";",

                      part.getHeader("Content-Type")[0]);
         assertEquals("binary", part.getHeader("Content-Transfer-Encoding")[0]);
         assertEquals("<root.message@cxf.apache.org>", part.getHeader("Content-ID")[0]);

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java?rev=648401&r1=648400&r2=648401&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JAXWSMethodInvoker.java
Tue Apr 15 13:13:52 2008
@@ -61,12 +61,22 @@
         super(factory, scope);
     }
 
+    protected SOAPFaultException findSoapFaultException(Throwable ex) {
+        if (ex instanceof SOAPFaultException) {
+            return (SOAPFaultException)ex;
+        }
+        if (ex.getCause() != null) {
+            return findSoapFaultException(ex.getCause());
+        }
+        return null;
+    }
+
     protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean
checked) {
         //map the JAX-WS faults
-        if (ex instanceof SOAPFaultException) {
-            SOAPFaultException sfe = (SOAPFaultException)ex;
+        SOAPFaultException sfe = findSoapFaultException(ex);
+        if (sfe != null) {
             SoapFault fault = new SoapFault(sfe.getFault().getFaultString(),
-                                            sfe,
+                                            ex,
                                             sfe.getFault().getFaultCodeAsQName());
             fault.setRole(sfe.getFault().getFaultActor());
             fault.setDetail(sfe.getFault().getDetail());



Mime
View raw message