axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r738113 - in /webservices/axis2/trunk/java/modules/saaj: src/org/apache/axis2/saaj/SOAPConnectionImpl.java test/org/apache/axis2/saaj/integration/IntegrationTest.java
Date Tue, 27 Jan 2009 15:50:26 GMT
Author: veithen
Date: Tue Jan 27 15:50:26 2009
New Revision: 738113

URL: http://svn.apache.org/viewvc?rev=738113&view=rev
Log:
AXIS2-4202: Fixed SOAPConnectionImpl#toSAAJElement:
* The existing code didn't generate an xop:Include element, but just an href attribute.
* AttachmentPart#setContentId sets the value of the Content-ID header and the value should
therefore be enclosed in angle brackets.

Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=738113&r1=738112&r2=738113&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
Tue Jan 27 15:50:26 2009
@@ -25,6 +25,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.MTOMConstants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
@@ -308,11 +309,13 @@
                         final DataHandler datahandler = (DataHandler)omText.getDataHandler();
                         AttachmentPart attachment = saajSOAPMsg.createAttachmentPart(datahandler);
                         final String id = IDGenerator.generateID();
-                        attachment.setContentId(id);
+                        attachment.setContentId("<" + id + ">");
                         attachment.setContentType(datahandler.getContentType());
                         saajSOAPMsg.addAttachmentPart(attachment);
 
-                        saajEle.addAttribute(
+                        SOAPElement xopInclude = saajEle.addChildElement(MTOMConstants.XOP_INCLUDE,
+                                "xop", MTOMConstants.XOP_NAMESPACE_URI);
+                        xopInclude.addAttribute(
                                 saajSOAPMsg.getSOAPPart().getEnvelope().createName("href"),
                                 "cid:" + id);
                     } else {

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java?rev=738113&r1=738112&r2=738113&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java
Tue Jan 27 15:50:26 2009
@@ -427,11 +427,10 @@
         SOAPMessage response = sCon.call(request, getAddress());
         sCon.close();
         
-//        response.writeTo(System.out);
-//        SOAPPart soapPart = response.getSOAPPart();
-//        SOAPElement textElement =
-//                (SOAPElement)soapPart.getEnvelope().getElementsByTagName("text").item(0);
-//        AttachmentPart ap = response.getAttachment((SOAPElement)textElement.getChildNodes().item(0));
-//        assertNotNull(ap);
+        SOAPPart soapPart = response.getSOAPPart();
+        SOAPElement textElement =
+                (SOAPElement)soapPart.getEnvelope().getElementsByTagName("text").item(0);
+        AttachmentPart ap = response.getAttachment((SOAPElement)textElement.getChildNodes().item(0));
+        assertNotNull(ap);
     }
 }



Mime
View raw message