You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2007/12/10 21:34:42 UTC
svn commit: r603038 [2/2] - in /webservices/axis2/trunk/java/modules:
jaxws/src/org/apache/axis2/datasource/
jaxws/src/org/apache/axis2/datasource/jaxb/
jaxws/src/org/apache/axis2/jaxws/message/attachments/
jaxws/src/org/apache/axis2/jaxws/message/data...
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java?rev=603038&r1=603037&r2=603038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java Mon Dec 10 12:34:39 2007
@@ -18,33 +18,23 @@
*/
package org.apache.axis2.jaxws.message.databinding.impl;
+import org.apache.axiom.om.OMDataSourceExt;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.OMException;
import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.datasource.jaxb.JAXBDSContext;
+import org.apache.axis2.datasource.jaxb.JAXBDataSource;
import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.message.attachments.JAXBAttachmentMarshaller;
-import org.apache.axis2.jaxws.message.attachments.JAXBAttachmentUnmarshaller;
import org.apache.axis2.jaxws.message.databinding.JAXBBlock;
import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
-import org.apache.axis2.jaxws.message.databinding.JAXBUtils;
-import org.apache.axis2.jaxws.message.databinding.XSDListUtils;
import org.apache.axis2.jaxws.message.factory.BlockFactory;
import org.apache.axis2.jaxws.message.impl.BlockImpl;
import org.apache.axis2.jaxws.message.util.XMLStreamWriterWithOS;
-import org.apache.axis2.jaxws.spi.Constants;
-import org.apache.axis2.jaxws.utility.XMLRootElementUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
-import javax.xml.bind.JAXBIntrospector;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -54,12 +44,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.PrivilegedAction;
-import java.text.ParseException;
/**
* JAXBBlockImpl <p/> A Block containing a JAXB business object (either a JAXBElement or an object
@@ -99,63 +84,24 @@
super(omElement, busContext, qName, factory);
}
- @Override
protected Object _getBOFromReader(XMLStreamReader reader, Object busContext)
throws XMLStreamException, WebServiceException {
// Get the JAXBBlockContext. All of the necessry information is recorded on it
JAXBBlockContext ctx = (JAXBBlockContext) busContext;
- // retrieve the stored classloader if it is present
- MessageContext msgContext = getParent() != null ? getParent().getMessageContext() : null;
- ClassLoader cl = null;
- if(msgContext != null) {
- cl = (ClassLoader) msgContext.getProperty(Constants.CACHE_CLASSLOADER);
- }
try {
- // TODO Re-evaluate Unmarshall construction w/ MTOM
-
- Unmarshaller u = JAXBUtils.getJAXBUnmarshaller(ctx.getJAXBContext(cl));
-
- if (DEBUG_ENABLED) {
- log.debug("Adding JAXBAttachmentUnmarshaller to Unmarshaller");
- }
-
- Message msg = getParent();
-
- JAXBAttachmentUnmarshaller aum = new JAXBAttachmentUnmarshaller(msg);
- u.setAttachmentUnmarshaller(aum);
-
- Object jaxb = null;
-
- // Unmarshal into the business object.
- if (ctx.getProcessType() == null) {
- jaxb = unmarshalByElement(u, reader); // preferred and always used for
- // style=document
- } else {
- jaxb =
- unmarshalByType(u,
- reader,
- ctx.getProcessType(),
- ctx.isxmlList(),
- ctx.getConstructionType());
- }
-
- // Successfully unmarshalled the object
- JAXBUtils.releaseJAXBUnmarshaller(ctx.getJAXBContext(cl), u);
-
- // Don't close the reader. The reader is owned by the caller, and it
- // may contain other xml instance data (other than this JAXB object)
- // reader.close();
- return jaxb;
+ busObject = ctx.unmarshal(reader);
} catch (JAXBException je) {
if (DEBUG_ENABLED) {
try {
- log.debug("JAXBContext for unmarshal failure:" + ctx.getJAXBContext(cl));
+ log.debug("JAXBContext for unmarshal failure:" +
+ ctx.getJAXBContext(ctx.getClassLoader()));
} catch (Exception e) {
}
}
throw ExceptionFactory.makeWebServiceException(je);
}
+ return busObject;
}
/**
@@ -194,47 +140,13 @@
throws XMLStreamException, WebServiceException {
JAXBBlockContext ctx = (JAXBBlockContext) busContext;
- // retrieve the stored classloader if it is present
- MessageContext msgContext = getParent() != null ? getParent().getMessageContext() : null;
- ClassLoader cl = null;
- if(msgContext != null) {
- cl = (ClassLoader) msgContext.getProperty(Constants.CACHE_CLASSLOADER);
- }
try {
- // Very easy, use the Context to get the Marshaller.
- // Use the marshaller to write the object.
- Marshaller m = JAXBUtils.getJAXBMarshaller(ctx.getJAXBContext(cl));
-
-
- if (DEBUG_ENABLED) {
- log.debug("Adding JAXBAttachmentMarshaller to Marshaller");
- }
-
- Message msg = getParent();
-
- // Pool
- JAXBAttachmentMarshaller am = new JAXBAttachmentMarshaller(msg, writer);
- m.setAttachmentMarshaller(am);
-
-
- // Marshal the object
- if (ctx.getProcessType() == null) {
- marshalByElement(busObject, m, writer, !am.isXOPPackage());
- } else {
- marshalByType(busObject,
- m,
- writer,
- ctx.getProcessType(),
- ctx.isxmlList(),
- ctx.getConstructionType());
- }
-
- // Successfully marshalled the data
- JAXBUtils.releaseJAXBMarshaller(ctx.getJAXBContext(cl), m);
+ ctx.marshal(busObject, writer);
} catch (JAXBException je) {
if (DEBUG_ENABLED) {
try {
- log.debug("JAXBContext for marshal failure:" + ctx.getJAXBContext(cl));
+ log.debug("JAXBContext for marshal failure:" +
+ ctx.getJAXBContext(ctx.getClassLoader()));
} catch (Exception e) {
}
}
@@ -242,354 +154,6 @@
}
}
- /**
- * Get the QName from the jaxb object
- *
- * @param jaxb
- * @param jbc
- * @throws WebServiceException
- */
- private static QName getQName(Object jaxb, JAXBBlockContext ctx, Message msg) throws JAXBException {
-
- // retrieve the stored classloader if it is present
- MessageContext msgContext = msg != null ? msg.getMessageContext() : null;
- ClassLoader cl = null;
- if(msgContext != null) {
- cl = (ClassLoader) msgContext.getProperty(Constants.CACHE_CLASSLOADER);
- }
-
- JAXBIntrospector jbi = JAXBUtils.getJAXBIntrospector(ctx.getJAXBContext(cl));
- QName qName = jbi.getElementName(jaxb);
- JAXBUtils.releaseJAXBIntrospector(ctx.getJAXBContext(cl), jbi);
- return qName;
- }
-
- /**
- * Preferred way to marshal objects.
- *
- * @param b Object that can be rendered as an element and the element name is known by the
- * Marshaller
- * @param m Marshaller
- * @param writer XMLStreamWriter
- */
- private static void marshalByElement(final Object b, final Marshaller m,
- final XMLStreamWriter writer,
- final boolean optimize) throws WebServiceException {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- // Marshalling directly to the output stream is faster than marshalling through the
- // XMLStreamWriter.
- // Take advantage of this optimization if there is an output stream.
- try {
- OutputStream os = (optimize) ? getOutputStream(writer) : null;
- if (os != null) {
- if (DEBUG_ENABLED) {
- log.debug("Invoking marshalByElement. " +
- "Marshaling to an OutputStream. " +
- "Object is "
- + getDebugName(b));
- }
- writer.flush();
- m.marshal(b, os);
- } else {
- if (DEBUG_ENABLED) {
- log.debug("Invoking marshalByElement. " +
- "Marshaling to an XMLStreamWriter. " +
- "Object is "
- + getDebugName(b));
- }
- m.marshal(b, writer);
- }
- } catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(e);
- }
- return null;
- }});
- }
-
- /**
- * Preferred way to unmarshal objects
- *
- * @param u Unmarshaller
- * @param reader XMLStreamReader
- * @return Object that represents an element
- * @throws WebServiceException
- */
- private static Object unmarshalByElement(final Unmarshaller u, final XMLStreamReader reader)
- throws WebServiceException {
- try {
- if (DEBUG_ENABLED) {
- log.debug("Invoking unMarshalByElement");
- }
- return AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- try {
- return u.unmarshal(reader);
- } catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(e);
- }
- }
- });
-
- } catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(e);
- }
- }
-
- /**
- * Marshal objects by type
- *
- * @param b Object that can be rendered as an element, but the element name is not known to the
- * schema (i.e. rpc)
- * @param m Marshaller
- * @param writer XMLStreamWriter
- * @param type
- */
- private static void marshalByType(final Object b, final Marshaller m,
- final XMLStreamWriter writer, final Class type,
- final boolean isList, final JAXBUtils.CONSTRUCTION_TYPE ctype)
- throws WebServiceException {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- try {
-
- // NOTE
- // Example:
- // <xsd:simpleType name="LongList">
- // <xsd:list>
- // <xsd:simpleType>
- // <xsd:restriction base="xsd:unsignedInt"/>
- // </xsd:simpleType>
- // </xsd:list>
- // </xsd:simpleType>
- // <element name="myLong" nillable="true" type="impl:LongList"/>
- //
- // LongList will be represented as an int[]
- // On the wire myLong will be represented as a list of integers
- // with intervening whitespace
- // <myLong>1 2 3</myLong>
- //
- // Unfortunately, we are trying to marshal by type. Therefore
- // we want to marshal an element (foo) that is unknown to schema.
- // If we use the normal marshal code, the wire will look like
- // this (which is incorrect):
- // <foo><item>1</item><item>2</item><item>3</item></foo>
- //
- // The solution is to detect this situation and marshal the
- // String instead. Then we get the correct wire format:
- // <foo>1 2 3</foo>
- Object jbo = b;
-
- if (isList || (type != null && type.isArray())) {
- if (DEBUG_ENABLED) {
- log.debug("marshalling type which is a List or Array");
- }
- // We conver to xsdListString only if the type is not known
- // to the context. In case a jaxbcontext is created from package
- // the array types or list are not know to the context.
- if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH) {
- QName qName = XMLRootElementUtil.getXmlRootElementQNameFromObject(b);
- String text = XSDListUtils.toXSDListString(getTypeEnabledObject(b));
- jbo = new JAXBElement(qName, String.class, text);
- } else if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY) {
- // do nothing common array types should be know to the jaxbcontext.
- // so do not use xsdListString conversion.
- }
- }
-
- // When JAXBContext is created using a context path, it will not include Enum
- // classes.
- // These classes have @XmlEnum annotation but not @XmlType/@XmlElement, so the
- // user will see MarshallingEx, class not known to ctxt.
- //
- // This is a jax-b defect, for now this fix is in place to pass CTS. This only
- // fixes the
- // situation where the enum is the top-level object (e.g., message-part in
- // rpc-lit scenario)
- //
- // Sample of what enum looks like:
- // @XmlEnum public enum EnumString {
- // @XmlEnumValue("String1") STRING_1("String1"),
- // @XmlEnumValue("String2") STRING_2("String2");
- // ... }
- if (type.isEnum()) {
- if (b != null) {
- if (DEBUG_ENABLED) {
- log.debug("marshalByType. Marshaling " + type.getName()
- + " as Enum");
- }
- JAXBElement jbe = (JAXBElement) b;
- String value = XMLRootElementUtil.getEnumValue((Enum) jbe.getValue());
-
- jbo = new JAXBElement(jbe.getName(), String.class, value);
- }
- }
-
- if (DEBUG_ENABLED) {
- log.debug("Invoking marshalByType. " +
- "Marshaling to an XMLStreamWriter. Object is "
- + getDebugName(b));
- }
- m.marshal(jbo, writer);
-
- } catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(e);
- }
- return null;
- }
- });
- }
-
- /**
- * The root element being read is defined by schema/JAXB; however its contents are known by
- * schema/JAXB. Therefore we use unmarshal by the declared type (This method is used to
- * unmarshal rpc elements)
- *
- * @param u Unmarshaller
- * @param reader XMLStreamReader
- * @param type Class
- * @return Object
- * @throws WebServiceException
- */
- private static Object unmarshalByType(final Unmarshaller u, final XMLStreamReader reader,
- final Class type, final boolean isList,
- final JAXBUtils.CONSTRUCTION_TYPE ctype)
- throws WebServiceException {
-
- if (DEBUG_ENABLED) {
- log.debug("Invoking unmarshalByType.");
- }
-
- return AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- try {
- // Unfortunately RPC is type based. Thus a
- // declared type must be used to unmarshal the xml.
- Object jaxb;
-
- if (!isList) {
- // case: We are not unmarshalling an xsd:list but an Array.
-
- if (type.isArray()) {
- // If the context is created using package
- // we will not have common arrays or type array in the context
- // so let use a differet way to unmarshal this type
- if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CONTEXT_PATH) {
- jaxb = unmarshalAsListOrArray(reader, u, type);
- }
- // list on client array on server, Can happen only in start from java
- // case.
- else if ((ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY)) {
- // The type could be any Object or primitive
- // I will first unmarshall the xmldata to a String[]
- // Then use the unmarshalled jaxbElement to create
- // proper type Object Array.
- jaxb = u.unmarshal(reader, String[].class);
- Object typeObj = getTypeEnabledObject(jaxb);
- // Now convert String Array in to the required Type Array.
- if (getTypeEnabledObject(typeObj) instanceof String[]) {
- String[] strArray = (String[]) typeObj;
- String strTokens = new String();
- for (String str : strArray) {
- strTokens = strTokens + " " + str;
- }
- QName qName =
- XMLRootElementUtil.
- getXmlRootElementQNameFromObject(jaxb);
- Object obj = XSDListUtils.fromXSDListString(strTokens, type);
- jaxb = new JAXBElement(qName, type, obj);
- }
- } else {
- jaxb = u.unmarshal(reader, type);
- }
-
- } else if (type.isEnum()) {
- // When JAXBContext is created using a context path, it will not
- // include Enum classes.
- // These classes have @XmlEnum annotation but not @XmlType/@XmlElement,
- // so the user will see MarshallingEx, class not known to ctxt.
- //
- // This is a jax-b defect, for now this fix is in place to pass CTS.
- // This only fixes the
- // situation where the enum is the top-level object (e.g., message-part
- // in rpc-lit scenario)
- //
- // Sample of what enum looks like:
- // @XmlEnum public enum EnumString {
- // @XmlEnumValue("String1") STRING_1("String1"),
- // @XmlEnumValue("String2") STRING_2("String2");
- //
- // public static getValue(String){} <-- resolves a "value" to an emum
- // object
- // ... }
- if (DEBUG_ENABLED) {
- log.debug("unmarshalByType. Unmarshalling " + type.getName()
- + " as Enum");
- }
-
- JAXBElement<String> enumValue = u.unmarshal(reader, String.class);
-
- if (enumValue != null) {
- Method m =
- type.getMethod("fromValue", new Class[] { String.class });
- jaxb = m.invoke(null, new Object[] { enumValue.getValue() });
- } else {
- jaxb = null;
- }
- }
- //Normal case: We are not unmarshalling a xsd:list or Array
- else {
- jaxb = u.unmarshal(reader, type);
- }
-
- } else {
- // If this is an xsd:list, we need to return the appropriate
- // list or array (see NOTE above)
- // First unmarshal as a String
- //Second convert the String into a list or array
- jaxb = unmarshalAsListOrArray(reader, u, type);
- }
- return jaxb;
- } catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(e);
- }
- }
- });
- }
-
- /**
- * convert the String into a list or array
- * @param <T>
- * @param jaxb
- * @param type
- * @return
- * @throws IllegalAccessException
- * @throws ParseException
- * @throws NoSuchMethodException
- * @throws InstantiationException
- * @throws DatatypeConfigurationException
- * @throws InvocationTargetException
- */
- private static Object unmarshalAsListOrArray(XMLStreamReader reader, Unmarshaller u,
- Class type)
- throws IllegalAccessException, ParseException,NoSuchMethodException,InstantiationException,
- DatatypeConfigurationException,InvocationTargetException,JAXBException {
- //If this is an xsd:list, we need to return the appropriate
- // list or array (see NOTE above)
- // First unmarshal as a String
- Object jaxb = u.unmarshal(reader, String.class);
- //Second convert the String into a list or array
- if (getTypeEnabledObject(jaxb) instanceof String) {
- QName qName = XMLRootElementUtil.getXmlRootElementQNameFromObject(jaxb);
- Object obj = XSDListUtils.fromXSDListString((String) getTypeEnabledObject(jaxb), type);
- return new JAXBElement(qName, type, obj);
- } else {
- return jaxb;
- }
-
- }
-
-
public boolean isElementData() {
return true;
}
@@ -625,6 +189,15 @@
public boolean isDestructiveWrite() {
return false;
}
+
+ public OMDataSourceExt copy() throws OMException {
+
+ if (DEBUG_ENABLED) {
+ log.debug("Making a copy of the JAXB object");
+ }
+ return new JAXBDataSource(this.getObject(),
+ (JAXBDSContext) this.getBusinessContext());
+ }
public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
try {
@@ -636,38 +209,13 @@
}
}
- /**
- * Return type enabled object
- *
- * @param obj type or element enabled object
- * @return type enabled object
- */
- static Object getTypeEnabledObject(Object obj) {
- if (obj == null) {
- return null;
- }
- if (obj instanceof JAXBElement) {
- return ((JAXBElement) obj).getValue();
+ public void setParent(Message message) {
+ if (busContext != null) {
+ ((JAXBBlockContext) busContext).setMessage(message);
}
- return obj;
+ super.setParent(message);
}
- private static String getDebugName(Object o) {
- return (o == null) ? "null" : o.getClass().getCanonicalName();
- }
+
- /**
- * If the writer is backed by an OutputStream, then return the OutputStream
- * @param writer
- * @return OutputStream or null
- */
- private static OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException {
- if (writer.getClass() == MTOMXMLStreamWriter.class) {
- return ((MTOMXMLStreamWriter) writer).getOutputStream();
- }
- if (writer.getClass() == XMLStreamWriterWithOS.class) {
- return ((XMLStreamWriterWithOS) writer).getOutputStream();
- }
- return null;
- }
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java?rev=603038&r1=603037&r2=603038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java Mon Dec 10 12:34:39 2007
@@ -18,8 +18,11 @@
*/
package org.apache.axis2.jaxws.message.databinding.impl;
+import org.apache.axiom.om.OMDataSourceExt;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.datasource.XMLStringDataSource;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.message.databinding.XMLStringBlock;
import org.apache.axis2.jaxws.message.factory.BlockFactory;
@@ -66,7 +69,6 @@
super(omElement, null, qName, factory);
}
- @Override
protected Object _getBOFromReader(XMLStreamReader reader, Object busContext)
throws XMLStreamException {
// Create a Reader2Writer converter and get the output as a String
@@ -74,7 +76,6 @@
return r2w.getAsString();
}
- @Override
protected XMLStreamReader _getReaderFromBO(Object busObj, Object busContext)
throws XMLStreamException {
// Create an XMLStreamReader from the inputFactory using the String as the sources
@@ -83,7 +84,6 @@
return StAXUtils.createXMLStreamReader(sr);
}
- @Override
protected void _outputFromBO(Object busObject, Object busContext, XMLStreamWriter writer)
throws XMLStreamException {
// There is no fast way to output the String to a writer, so get the reader
@@ -124,6 +124,10 @@
public boolean isDestructiveWrite() {
return false;
+ }
+
+ public OMDataSourceExt copy() throws OMException {
+ return new XMLStringDataSource((String) getObject());
}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessagePersistanceTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessagePersistanceTests.java?rev=603038&r1=603037&r2=603038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessagePersistanceTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessagePersistanceTests.java Mon Dec 10 12:34:39 2007
@@ -24,6 +24,7 @@
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axis2.Constants.Configuration;
+import org.apache.axis2.datasource.jaxb.JAXBDataSource;
import org.apache.axis2.jaxws.core.MessageContext;
import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
import org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockImpl;
@@ -291,7 +292,7 @@
omse = (OMSourcedElement) child;
assertTrue(!omse.isExpanded());
ds = omse.getDataSource();
- assertTrue(ds instanceof ByteArrayDataSource);
+ assertTrue(ds instanceof JAXBDataSource);
// Simulate transport
baos = new ByteArrayOutputStream();
@@ -547,7 +548,7 @@
omse = (OMSourcedElement) child;
assertTrue(!omse.isExpanded());
ds = omse.getDataSource();
- assertTrue(ds instanceof ByteArrayDataSource);
+ assertTrue(ds instanceof JAXBDataSource);
// Simulate transport on the copied message
baos = new ByteArrayOutputStream();
@@ -562,9 +563,9 @@
assertTrue(restoredText.contains("Body"));
assertTrue(restoredText.indexOf("MIMEBoundary_Axis2Rocks") > 0);
- // TODO Currently the attachments are inlined when the JAXBBlock is copied.
- //assertTrue(restoredText.indexOf(sampleText) > 0);
- //assertTrue(restoredText.indexOf("<soapenv:Body><sendImage xmlns=\"urn://mtom.test.org\"><input><imageData><xop:Include") > 0);
+ // Make sure that attachment is not inlined
+ assertTrue(restoredText.indexOf(sampleText) > 0);
+ assertTrue(restoredText.indexOf("<soapenv:Body><sendImage xmlns=\"urn://mtom.test.org\"><input><imageData><xop:Include") > 0);
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java?rev=603038&r1=603037&r2=603038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/ExceptionFactory.java Mon Dec 10 12:34:39 2007
@@ -19,6 +19,7 @@
package org.apache.axis2.jaxws;
+import org.apache.axiom.om.OMException;
import org.apache.axis2.AxisFault;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.commons.logging.Log;
@@ -257,6 +258,7 @@
while (t != null) {
Throwable nextCause = null;
if (t instanceof InvocationTargetException ||
+ t instanceof OMException ||
t instanceof AxisFault) {
// Skip over this cause
nextCause = getCause(t);
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties?rev=603038&r1=603037&r2=603038&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/i18n/resource.properties Mon Dec 10 12:34:39 2007
@@ -281,3 +281,4 @@
pDescrErr=Null Descriptor. PropertyDescriptor not found.
pDescrErr2=No read Method found to read property Value from jaxbObject: {0}
restWithSOAPErr=Expected an XML over HTTP message, but the message appears to be a SOAP message. The namespace is {0}
+noDataHandler=A data handler was not found for content id {0}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org