You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2008/04/17 02:14:40 UTC
svn commit: r648902 [1/2] - in /webservices/axis2/branches/java/1_4/modules:
adb-codegen/src/org/apache/axis2/schema/writer/
adb-codegen/test/org/apache/axis2/schema/populate/
adb-codegen/test/org/apache/axis2/schema/populate/derived/
adb-codegen/test/...
Author: dims
Date: Wed Apr 16 17:14:31 2008
New Revision: 648902
URL: http://svn.apache.org/viewvc?rev=648902&view=rev
Log:
Bulk Sync with trunk (from trunk svn revision 648860)
Added:
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java
webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/mtom/MtomSampleMTOMThresholdService.java
webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/
webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigBody.java
webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ConfigHeader.java
webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/ObjectFactory.java
webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/headers/package-info.java
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/handler/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/handler/LoggingSOAPHandler.java
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/echo/
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/webapp/WEB-INF/classes/org/apache/axis2/jaxws/samples/echo/loghandler.xml
Modified:
webservices/axis2/branches/java/1_4/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java
webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/references/ElementReferenceTest.java
webservices/axis2/branches/java/1_4/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl
webservices/axis2/branches/java/1_4/modules/jaxws-integration/test-resources/wsdl/swamtomservice.wsdl
webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleTests.java
webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java
webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/META-INF/swamtomservice.wsdl
webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/SWAMTOMPortTypeImpl.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/Message.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/ClassFinderImpl.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/MessageImpl.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java
webservices/axis2/branches/java/1_4/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageRPCTests.java
webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
webservices/axis2/branches/java/1_4/modules/kernel/src/org/apache/axis2/util/Utils.java
webservices/axis2/branches/java/1_4/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java
webservices/axis2/branches/java/1_4/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
webservices/axis2/branches/java/1_4/modules/mex/pom.xml
webservices/axis2/branches/java/1_4/modules/samples/jaxws-samples/src/main/org/apache/axis2/jaxws/samples/echo/EchoServicePortImpl.java
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java Wed Apr 16 17:14:31 2008
@@ -91,6 +91,7 @@
public static final String DEFAULT_ATTRIB_CLASS_NAME = "axiom_attribute_t*";
public static final String DEFAULT_ATTRIB_ARRAY_CLASS_NAME = "axiom_attribute_t*";
+ public static final String DEFAULT_TYPE_NS = "http://www.w3.org/2001/XMLSchema";
/**
@@ -653,8 +654,13 @@
}
}
- if (typeMap.containsKey(metainf.getSchemaQNameForQName(name))) {
+ if (typeMap.containsKey(metainf.getSchemaQNameForQName(name)) ||
+ (metainf.getSchemaQNameForQName(name) == null ||
+ !metainf.getSchemaQNameForQName(name).getNamespaceURI().equals(DEFAULT_TYPE_NS))
+ && !CClassNameForElement.equals(DEFAULT_C_CLASS_NAME)
+ && !CClassNameForElement.equals(DEFAULT_ATTRIB_CLASS_NAME)) {
XSLTUtils.addAttribute(model, "ours", "yes", property);
+
}
if (metainf.getAttributeStatusForQName(name)) {
@@ -753,14 +759,18 @@
Element property,
Map typeMap,
Map groupTypeMap,
- String javaClassNameForElement) {
+ String CClassNameForElement) {
// add an attribute that says the type is default
if (metainf.getDefaultStatusForQName(name)) {
XSLTUtils.addAttribute(model, "default", "yes", property);
}
if (typeMap.containsKey(metainf.getSchemaQNameForQName(name)) ||
- groupTypeMap.containsKey(metainf.getSchemaQNameForQName(name))) {
+ groupTypeMap.containsKey(metainf.getSchemaQNameForQName(name)) ||
+ (metainf.getSchemaQNameForQName(name) == null ||
+ !metainf.getSchemaQNameForQName(name).getNamespaceURI().equals(DEFAULT_TYPE_NS))
+ && !CClassNameForElement.equals(DEFAULT_C_CLASS_NAME)
+ && !CClassNameForElement.equals(DEFAULT_ATTRIB_CLASS_NAME)) {
XSLTUtils.addAttribute(model, "ours", "yes", property);
}
@@ -782,10 +792,10 @@
if (baseTypeMap.containsKey(metainf.getSchemaQNameForQName(name))) {
shortTypeName = metainf.getSchemaQNameForQName(name).getLocalPart();
} else {
- shortTypeName = getShortTypeName(javaClassNameForElement);
+ shortTypeName = getShortTypeName(CClassNameForElement);
}
} else {
- shortTypeName = getShortTypeName(javaClassNameForElement);
+ shortTypeName = getShortTypeName(CClassNameForElement);
}
XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, property);
@@ -812,13 +822,13 @@
XSLTUtils.addAttribute(model, "array", "yes", property);
- int endIndex = javaClassNameForElement.indexOf("[");
+ int endIndex = CClassNameForElement.indexOf("[");
if (endIndex >= 0) {
XSLTUtils.addAttribute(model, "arrayBaseType",
- javaClassNameForElement.substring(0, endIndex), property);
+ CClassNameForElement.substring(0, endIndex), property);
} else {
XSLTUtils.addAttribute(model, "arrayBaseType",
- javaClassNameForElement, property);
+ CClassNameForElement, property);
}
long maxOccurs = metainf.getMaxOccurs(name);
@@ -956,12 +966,12 @@
/**
* Test whether the given class name matches the default
*
- * @param javaClassNameForElement
+ * @param CClassNameForElement
* @return bool
*/
- private boolean isDefault(String javaClassNameForElement) {
- return getDefaultClassName().equals(javaClassNameForElement) ||
- getDefaultClassArrayName().equals(javaClassNameForElement);
+ private boolean isDefault(String CClassNameForElement) {
+ return getDefaultClassName().equals(CClassNameForElement) ||
+ getDefaultClassArrayName().equals(CClassNameForElement);
}
Added: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java (added)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/Util.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,14 @@
+package org.apache.axis2.schema.populate;
+
+public class Util {
+ public static Class getFactory(Class clazz) {
+ Class[] declaredClasse = clazz.getDeclaredClasses();
+ for (int i = 0; i < declaredClasse.length; i++) {
+ Class aClass = declaredClasse[i];
+ if(aClass != null && aClass.getName().endsWith("Factory")){
+ return aClass;
+ }
+ }
+ throw new RuntimeException("Factory inner class not found");
+ }
+}
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/derived/AbstractDerivedPopulater.java Wed Apr 16 17:14:31 2008
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import org.custommonkey.xmlunit.XMLTestCase;
import javax.xml.stream.XMLOutputFactory;
@@ -45,9 +46,7 @@
protected Object process(String testString,String className) throws Exception{
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(testString.getBytes()));
Class clazz = Class.forName(className);
- Class[] declaredClasse = clazz.getDeclaredClasses();
- //ideally this should be 1
- Class innerClazz = declaredClasse[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
assertNotNull(obj);
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnonComplexTypeTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -40,7 +41,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org1.soapinterop.types.TempElt");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateAnyTypeTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.io.ByteArrayInputStream;
@@ -36,7 +37,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.xsd2.MyObject");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayInArrayTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -53,7 +54,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.xsd.Myobject");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateArrayTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -43,7 +44,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org2.soapinterop.xsd.Myobject");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateChoiceTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -38,7 +39,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.types.MyElement");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateComplexMinOccurs0Test.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -103,7 +104,7 @@
boolean personPresent) throws XMLStreamException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IntrospectionException {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.test1.Root");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMinOccurs0Test.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -87,7 +88,7 @@
XMLStreamReader reader =
StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.test.Root");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateMixedMinoccurs0Test.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -80,7 +81,7 @@
private void populateAndAssert(String s,int count) throws XMLStreamException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IntrospectionException {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.recursion1.StringListResponseElement");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateParticleAllTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamReader;
import java.beans.BeanInfo;
@@ -39,7 +40,7 @@
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
Class clazz = Class.forName("org.soapinterop.types.MyParticleAllElement");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/other/PopulateRecursiveTest.java Wed Apr 16 17:14:31 2008
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -51,7 +52,7 @@
) throws XMLStreamException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IntrospectionException {
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(s.getBytes()));
Class clazz = Class.forName("org.recursion.E");
- Class innerClazz = clazz.getDeclaredClasses()[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse", new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null, new Object[]{reader});
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/AbstractSimplePopulater.java Wed Apr 16 17:14:31 2008
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.schema.populate.Util;
import org.custommonkey.xmlunit.XMLTestCase;
import javax.xml.stream.XMLOutputFactory;
@@ -53,9 +54,7 @@
protected Object process(String testString,String className) throws Exception{
XMLStreamReader reader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(testString.getBytes()));
Class clazz = Class.forName(className);
- Class[] declaredClasse = clazz.getDeclaredClasses();
- //ideally this should be 1
- Class innerClazz = declaredClasse[0];
+ Class innerClazz = Util.getFactory(clazz);
Method parseMethod = innerClazz.getMethod("parse",new Class[]{XMLStreamReader.class});
Object obj = parseMethod.invoke(null,new Object[]{reader});
assertNotNull(obj);
Modified: webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/references/ElementReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/references/ElementReferenceTest.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/references/ElementReferenceTest.java (original)
+++ webservices/axis2/branches/java/1_4/modules/adb-codegen/test/org/apache/axis2/schema/references/ElementReferenceTest.java Wed Apr 16 17:14:31 2008
@@ -181,9 +181,10 @@
public void testSimpleReference() {
TestSimpleReference testSimpleReference = new TestSimpleReference();
Discard_transferToken discard_transferToken = new Discard_transferToken();
- AuthInfo_type1 authInfo_type1 = new AuthInfo_type1();
- authInfo_type1.setAuthInfo_type1("Simple param");
- discard_transferToken.setAuthInfo(authInfo_type1);
+// FIXME: Breaks in IBM JDK 1.5 - the generated code there is looking for AuthInfo_type0 instead of AuthInfo_type1
+// AuthInfo_type1 authInfo_type1 = new AuthInfo_type1();
+// authInfo_type1.setAuthInfo_type1("Simple param");
+// discard_transferToken.setAuthInfo(authInfo_type1);
discard_transferToken.setParam1("New parm");
testSimpleReference.setTestSimpleReference(discard_transferToken);
@@ -195,7 +196,8 @@
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElmentString.getBytes()));
TestSimpleReference result = TestSimpleReference.Factory.parse(xmlReader);
assertEquals(result.getTestSimpleReference().getParam1(),"New parm");
- assertEquals(result.getTestSimpleReference().getAuthInfo().getAuthInfo_type1(),"Simple param");
+// See FIXME above:
+// assertEquals(result.getTestSimpleReference().getAuthInfo().getAuthInfo_type1(),"Simple param");
} catch (ADBException e) {
fail();
} catch (XMLStreamException e) {
Modified: webservices/axis2/branches/java/1_4/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl (original)
+++ webservices/axis2/branches/java/1_4/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl Wed Apr 16 17:14:31 2008
@@ -27,12 +27,15 @@
</xsl:template>
<xsl:template match="interface">
+ <xsl:variable name="servicename">
+ <xsl:value-of select="translate(@servicename,':.-','___')"/>
+ </xsl:variable>
<service>
- <xsl:attribute name="name"><xsl:value-of select="@servicename"/></xsl:attribute>
+ <xsl:attribute name="name"><xsl:value-of select="$servicename"/></xsl:attribute>
<parameter name="ServiceClass">
- <xsl:value-of select="@servicename"/>
+ <xsl:value-of select="$servicename"/>
</parameter>
<description>
<xsl:value-of select="@servicename"/> Service
Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test-resources/wsdl/swamtomservice.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test-resources/wsdl/swamtomservice.wsdl?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test-resources/wsdl/swamtomservice.wsdl (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test-resources/wsdl/swamtomservice.wsdl Wed Apr 16 17:14:31 2008
@@ -55,11 +55,21 @@
<wsdl:message name="swaAttachmentRequest">
<part name="jpegImageRequest" type="xsd:hexBinary"/>
</wsdl:message>
- <wsdl:message name="swAattachmentResponse">
+ <wsdl:message name="swaAttachmentResponse">
<part name="jpegImageResponse" type="xsd:hexBinary"/>
</wsdl:message>
+ <!-- two attachments...and no body part -->
+ <wsdl:message name="swaAttachment2Request">
+ <part name="jpegImage1Request" type="xsd:hexBinary"/>
+ <part name="jpegImage2Request" type="xsd:hexBinary"/>
+ </wsdl:message>
+ <wsdl:message name="swaAttachment2Response">
+ <part name="jpegImage1Response" type="xsd:hexBinary"/>
+ <part name="jpegImage2Response" type="xsd:hexBinary"/>
+ </wsdl:message>
+
<!-- mtom -->
@@ -77,6 +87,11 @@
<wsdl:output message="tns:swaAttachmentResponse" />
</wsdl:operation>
+ <wsdl:operation name="swaAttachment2">
+ <wsdl:input message="tns:swaAttachment2Request" />
+ <wsdl:output message="tns:swaAttachment2Response" />
+ </wsdl:operation>
+
<wsdl:operation name="mtomAttachment">
<wsdl:input message="tns:mtomAttachmentRequest" />
@@ -107,6 +122,37 @@
</mime:part>
<mime:part>
<mime:content part="jpegImageResponse" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="swaAttachment2">
+ <wsdlsoap:operation soapAction="swaAttachment2"/>
+ <wsdl:input >
+ <mime:multipartRelated>
+ <mime:part>
+ <wsdlsoap:body parts="" use="literal"/>
+ </mime:part>
+
+ <mime:part>
+ <mime:content part="jpegImage1Request" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="jpegImage2Request" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </wsdl:input>
+ <wsdl:output >
+ <mime:multipartRelated>
+ <mime:part>
+ <wsdlsoap:body parts="" use="literal"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="jpegImage1Response" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="jpegImage2Response" type="text/plain"/>
</mime:part>
</mime:multipartRelated>
</wsdl:output>
Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleTests.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleTests.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/MtomSampleTests.java Wed Apr 16 17:14:31 2008
@@ -27,6 +27,7 @@
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.provider.DataSourceImpl;
+import org.apache.axis2.util.Utils;
import org.test.mtom.ImageDepot;
import org.test.mtom.ObjectFactory;
import org.test.mtom.SendImage;
@@ -66,6 +67,8 @@
"http://localhost:6060/axis2/services/MtomSampleService.MtomSampleMTOMEnableServicePort";
private static final String URL_ENDPOINT_MTOMDEFAULT =
"http://localhost:6060/axis2/services/MtomSampleService.MtomSampleMTOMDefaultServicePort";
+ private static final String URL_ENDPOINT_MTOMTHRESHOLD =
+ "http://localhost:6060/axis2/services/MtomSampleService.MtomSampleMTOMThresholdServicePort";
private static final String IMAGE_DIR = System.getProperty("basedir",".")+"/"+"test-resources"+File.separator+"image";
@@ -631,6 +634,63 @@
assertNotNull(response);
assertNotNull(response.getOutput().getImageData());
*/
+ }
+ /*
+ * Enable attachment Optimization but call an endpoint with @MTOM(enable=true, Threshold = 99000)
+ */
+
+ public void testSendImage_setMTOMThreshold() throws Exception {
+ TestLogger.logger.debug("----------------------------------");
+ TestLogger.logger.debug("test: " + getName());
+ System.out.println("testSendImage_setMTOMThreshold()");
+ String imageResourceDir = IMAGE_DIR;
+
+ //Create a DataSource from an image
+ File file = new File(imageResourceDir+File.separator+"test.jpg");
+ ImageInputStream fiis = new FileImageInputStream(file);
+ Image image = ImageIO.read(fiis);
+ DataSource imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
+
+ //Create a DataHandler with the String DataSource object
+ DataHandler dataHandler = new DataHandler(imageDS);
+
+ //Store the data handler in ImageDepot bean
+ ImageDepot imageDepot = new ObjectFactory().createImageDepot();
+ imageDepot.setImageData(dataHandler);
+
+ SendImage request = new ObjectFactory().createSendImage();
+ request.setInput(imageDepot);
+
+ //Create the necessary JAXBContext
+ JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
+ //Setting Threshold to send request Inline
+ int threshold = 100000;
+ MTOMFeature mtom21 = new MTOMFeature(true, threshold);
+ // Create the JAX-WS client needed to send the request
+ Service service = Service.create(QNAME_SERVICE);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, URL_ENDPOINT_MTOMTHRESHOLD);
+ Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc, Mode.PAYLOAD, mtom21);
+
+ List cids = null;
+ SendImageResponse response = null;
+ try {
+ JAXBAttachmentUnmarshallerMonitor.setMonitoring(true);
+ response = (SendImageResponse) dispatch.invoke(request);
+
+ // The cids are collected in the monitor. We will check
+ // this to make sure the response mtom is not inlined
+ cids = JAXBAttachmentUnmarshallerMonitor.getBlobCIDs();
+ } finally {
+ JAXBAttachmentUnmarshallerMonitor.setMonitoring(false);
+ }
+
+
+ assertNotNull(response);
+ assertNotNull(response.getOutput().getImageData());
+
+ //There shold be no cid as attachment should be inlined.
+ int numCIDs = (cids == null) ? 0 : cids.size();
+ assertTrue("Expected one attachment inlined:" + numCIDs, numCIDs == 0);
}
}
Added: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/mtom/MtomSampleMTOMThresholdService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/mtom/MtomSampleMTOMThresholdService.java?rev=648902&view=auto
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/mtom/MtomSampleMTOMThresholdService.java (added)
+++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/mtom/MtomSampleMTOMThresholdService.java Wed Apr 16 17:14:31 2008
@@ -0,0 +1,64 @@
+package org.apache.axis2.jaxws.sample.mtom;
+
+import java.awt.Image;
+import java.io.InputStream;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.MTOM;
+
+import org.apache.axis2.datasource.jaxb.JAXBAttachmentUnmarshallerMonitor;
+import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.jaxws.provider.DataSourceImpl;
+import org.test.mtom.ImageDepot;
+import org.test.mtom.ObjectFactory;
+/**
+ * Endpoint with MTOM enabled and Threshold set to size bigger than the attachment size.
+ * The response from Server should have attachments inlined.
+ */
+@WebService(serviceName="MtomSampleService",
+ endpointInterface="org.apache.axis2.jaxws.sample.mtom.MtomSample")
+@MTOM(enabled=true, threshold=99000)
+public class MtomSampleMTOMThresholdService implements MtomSample {
+
+ public ImageDepot sendImage(ImageDepot input) {
+ TestLogger.logger.debug("MtomSampleMTOMEnableService [new sendImage request received]");
+ DataHandler data = input.getImageData();
+
+ TestLogger.logger.debug("[contentType] " + data.getContentType());
+ ImageDepot output = (new ObjectFactory()).createImageDepot();
+ Image image = null;
+
+ resetAttachmentUnmarshallingMonitor();
+ try {
+ InputStream stream = (InputStream) data.getContent();
+ image = ImageIO.read(stream);
+
+ DataSource imageDS = new DataSourceImpl("image/jpeg", "test.jpg", image);
+ DataHandler handler = new DataHandler(imageDS);
+ output.setImageData(handler);
+ }
+ catch (Exception e) {
+ throw new WebServiceException(e);
+ }
+ return output;
+ }
+
+ public ImageDepot sendText(byte[] input) {
+ TestLogger.logger.debug("[new sendText request received]");
+ return null;
+ }
+
+ /**
+ * Reset the monitor so that we can determine if an
+ * attachment is unmarshalled on the response.
+ */
+ private void resetAttachmentUnmarshallingMonitor() {
+ if (JAXBAttachmentUnmarshallerMonitor.isMonitoring()) {
+ JAXBAttachmentUnmarshallerMonitor.clear();
+ }
+ }
+}
Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java Wed Apr 16 17:14:31 2008
@@ -80,9 +80,11 @@
* to SWA attachments.
* - ensures that the marshalling code can handle the case of an
* empty soap body and all communication via SWA attachments.
+ *
+ * This test ensures that the toleration of the attachments with legacy (pre WS-I 1.0) content ids.
* @throws Exception
*/
- public void testSWAAttachments() throws Exception {
+ public void testSWAAttachments_LegacyContentID() throws Exception {
String soapAction = "swaAttachment";
Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
@@ -103,6 +105,8 @@
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
AttachmentPart attachment = request.createAttachmentPart();
+ // Per WSI Spect, the swa content id must start with the part name
+ //http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html#Value-space_of_Content-Id_Header
attachment.setContentId("SWAMTOMTestSOAPMessage");
attachment.addMimeHeader("FVT-source", "STR_BODY_ELEMENT_1");
attachment.setRawContent(bais, "text/plain");
@@ -119,6 +123,7 @@
if ((ap = (AttachmentPart) it.next()) == null){
fail("Attachment is null");
}
+
// verify that the attachment is not null or empty
if (it.hasNext()){
@@ -141,5 +146,276 @@
}
}
+ /**
+ * Tests calling an endpoint that understands SOAP 1.1 MTOM
+ * However we are calling an operation on the endpoint that
+ * pass a single SWA attachment as a request and expects a
+ * single SWA attachment as a response. (The body contents are empty.)
+ *
+ * This test accomplishes the following:
+ * - ensures that a SWA attachment (not an MTOM attachment) is sent.
+ * - ensures that a SWA attachment can be sent and returned from
+ * an endpoint that has MTOM enabled.
+ * - ensures that the DBC correctly marks the operation and parameters
+ * such that all of the parameters to this operation are mapped
+ * to SWA attachments.
+ * - ensures that the marshalling code can handle the case of an
+ * empty soap body and all communication via SWA attachments.
+ *
+ * This test ensures that the endpoint can receive and return compliant (pre WS-I 1.0) content ids.
+ * @throws Exception
+ */
+ public void testSWAAttachments_WSI() throws Exception {
+ String soapAction = "swaAttachment";
+ Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
+
+ // Obtain a preconfigured SAAJ MessageFactory
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage request = factory.createMessage();
+
+ // soap:body should be empty
+ SOAPBody body = request.getSOAPBody();
+
+ // add attachment
+ int attachmentSize = 100;
+ byte[] bytes = new byte[attachmentSize];
+
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i] = (byte) ('a' + ('z' - 'a') * Math.random());
+ }
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ AttachmentPart attachment = request.createAttachmentPart();
+ // Per WSI Spect, the swa content id must start with the part name
+ //http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html#Value-space_of_Content-Id_Header
+ attachment.setContentId("jpegImageRequest=SWAMTOMTestSOAPMessage");
+ attachment.addMimeHeader("FVT-source", "STR_BODY_ELEMENT_1");
+ attachment.setRawContent(bais, "text/plain");
+ request.addAttachmentPart(attachment);
+
+ // invoke
+ SOAPMessage reply = dispatch.invoke(request);
+
+ // iterate over the attachments, there should only be one
+ Iterator it = reply.getAttachments();
+ AttachmentPart ap = null;
+
+ // verify that the attachment is not null or empty
+ if ((ap = (AttachmentPart) it.next()) == null){
+ fail("Attachment is null");
+ }
+
+ // Make sure the content id starts with the appropriate SWA name
+ if (!ap.getContentId().startsWith("jpegImageResponse=")) {
+ fail("Expected content id to start with jpegImageResponse");
+ }
+
+ // verify that the attachment is not null or empty
+ if (it.hasNext()){
+ fail("Detected more then 1 attachment");
+ }
+
+ SOAPBody sb = reply.getSOAPBody();
+ if (sb.getChildElements().hasNext()) {
+ fail("Message contains soap:body payload");
+ }
+
+ bytes = ap.getRawContentBytes();
+ if (bytes.length == 0) {
+ fail("Attachment is empty");
+ }
+
+ // verify that endpoint has been able to modify the attachment
+ if (bytes[0] != 'S' || bytes[1] != 'W' || bytes[2] != 'A') {
+ fail("Did not receive a modified attachment");
+ }
+ }
+
+ /**
+ * Now invoke the message the a receives and returns 2 attachments
+ *
+ * @throws Exception
+ */
+ public void testSWAAttachments2_WSI() throws Exception {
+ String soapAction = "swaAttachment2";
+ Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
+
+ // Obtain a preconfigured SAAJ MessageFactory
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage request = factory.createMessage();
+
+ // soap:body should be empty
+ SOAPBody body = request.getSOAPBody();
+
+ // create attachments 1 and 2
+ byte[] bytes1 = new byte[1];
+ bytes1[0] = '1';
+ byte[] bytes2 = new byte[1];
+ bytes2[0] = '2';
+
+ // The attachments are sent out of order.
+ // The receiver should be smart enough to use the content id
+ // to establish the correct order
+ ByteArrayInputStream bais2 = new ByteArrayInputStream(bytes2);
+ AttachmentPart attachment2 = request.createAttachmentPart();
+ attachment2.setContentId("jpegImage2Request=SWAMTOMTestSOAPMessage");
+ attachment2.addMimeHeader("FVT-source", "STR_BODY_ELEMENT_1");
+ attachment2.setRawContent(bais2, "text/plain");
+ request.addAttachmentPart(attachment2);
+
+ ByteArrayInputStream bais1 = new ByteArrayInputStream(bytes1);
+ AttachmentPart attachment1 = request.createAttachmentPart();
+ attachment1.setContentId("jpegImage1Request=SWAMTOMTestSOAPMessage");
+ attachment1.addMimeHeader("FVT-source", "STR_BODY_ELEMENT_1");
+ attachment1.setRawContent(bais1, "text/plain");
+ request.addAttachmentPart(attachment1);
+
+ // invoke
+ SOAPMessage reply = dispatch.invoke(request);
+
+ // iterate over the attachments, there should only be one
+ Iterator it = reply.getAttachments();
+ AttachmentPart ap3 = null;
+
+ // verify that the attachment is not null or empty
+ if ((ap3 = (AttachmentPart) it.next()) == null){
+ fail("Attachment is null");
+ }
+
+ // Make sure the content id starts with the appropriate SWA name
+ if (!ap3.getContentId().startsWith("jpegImage1Response=")) {
+ fail("Expected content id to start with jpegImage1Response");
+ }
+
+ AttachmentPart ap4 = null;
+ // verify that the second attachment is not null or empty
+ if ((ap4 = (AttachmentPart) it.next()) == null){
+ fail("Attachment is null");
+ }
+
+ // Make sure the content id starts with the appropriate SWA name
+ if (!ap4.getContentId().startsWith("jpegImage2Response=")) {
+ fail("Expected content id to start with jpegImage2Response");
+ }
+
+ if (it.hasNext()){
+ fail("Detected more then 2 attachment");
+ }
+
+ SOAPBody sb = reply.getSOAPBody();
+ if (sb.getChildElements().hasNext()) {
+ fail("Message contains soap:body payload");
+ }
+
+ byte[] bytes3 = ap3.getRawContentBytes();
+ if (bytes3.length == 0) {
+ fail("Attachment is empty");
+ }
+ if (bytes3[0] != '3') {
+ fail("The response attachment is not correct");
+ }
+
+ byte[] bytes4 = ap4.getRawContentBytes();
+ if (bytes4.length == 0) {
+ fail("Attachment is empty");
+ }
+ if (bytes4[0] != '4') {
+ fail("The response attachment is not correct");
+ }
+ }
+
+ /**
+ * Now invoke the message the a receives and returns 2 attachments,
+ * but the request attachments don't comply with wsi
+ *
+ * @throws Exception
+ */
+ public void testSWAAttachments2_Legacy() throws Exception {
+ String soapAction = "swaAttachment2";
+ Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
+
+ // Obtain a preconfigured SAAJ MessageFactory
+ MessageFactory factory = MessageFactory.newInstance();
+ SOAPMessage request = factory.createMessage();
+
+ // soap:body should be empty
+ SOAPBody body = request.getSOAPBody();
+
+ // create attachments 1 and 2
+ byte[] bytes1 = new byte[1];
+ bytes1[0] = '1';
+ byte[] bytes2 = new byte[1];
+ bytes2[0] = '2';
+
+
+
+
+ ByteArrayInputStream bais1 = new ByteArrayInputStream(bytes1);
+ AttachmentPart attachment1 = request.createAttachmentPart();
+ attachment1.setContentId("notCompliant1SWAMTOMTestSOAPMessage");
+ attachment1.addMimeHeader("FVT-source", "STR_BODY_ELEMENT_1");
+ attachment1.setRawContent(bais1, "text/plain");
+ request.addAttachmentPart(attachment1);
+
+ ByteArrayInputStream bais2 = new ByteArrayInputStream(bytes2);
+ AttachmentPart attachment2 = request.createAttachmentPart();
+ attachment2.setContentId("notCompliant2SWAMTOMTestSOAPMessage");
+ attachment2.addMimeHeader("FVT-source", "STR_BODY_ELEMENT_1");
+ attachment2.setRawContent(bais2, "text/plain");
+ request.addAttachmentPart(attachment2);
+
+ // invoke
+ SOAPMessage reply = dispatch.invoke(request);
+
+ // iterate over the attachments, there should only be one
+ Iterator it = reply.getAttachments();
+ AttachmentPart ap3 = null;
+
+ // verify that the attachment is not null or empty
+ if ((ap3 = (AttachmentPart) it.next()) == null){
+ fail("Attachment is null");
+ }
+
+ // Make sure the content id starts with the appropriate SWA name
+ if (!ap3.getContentId().startsWith("jpegImage1Response=")) {
+ fail("Expected content id to start with jpegImage1Response");
+ }
+
+ AttachmentPart ap4 = null;
+ // verify that the second attachment is not null or empty
+ if ((ap4 = (AttachmentPart) it.next()) == null){
+ fail("Attachment is null");
+ }
+
+ // Make sure the content id starts with the appropriate SWA name
+ if (!ap4.getContentId().startsWith("jpegImage2Response=")) {
+ fail("Expected content id to start with jpegImage2Response");
+ }
+
+ if (it.hasNext()){
+ fail("Detected more then 2 attachment");
+ }
+
+ SOAPBody sb = reply.getSOAPBody();
+ if (sb.getChildElements().hasNext()) {
+ fail("Message contains soap:body payload");
+ }
+
+ byte[] bytes3 = ap3.getRawContentBytes();
+ if (bytes3.length == 0) {
+ fail("Attachment is empty");
+ }
+ if (bytes3[0] != '3') {
+ fail("The response attachment is not correct");
+ }
+
+ byte[] bytes4 = ap4.getRawContentBytes();
+ if (bytes4.length == 0) {
+ fail("Attachment is empty");
+ }
+ if (bytes4[0] != '4') {
+ fail("The response attachment is not correct");
+ }
+ }
// TODO: Add similar code to invoke the mtom enabled operation
}
Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/META-INF/swamtomservice.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/META-INF/swamtomservice.wsdl?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/META-INF/swamtomservice.wsdl (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/META-INF/swamtomservice.wsdl Wed Apr 16 17:14:31 2008
@@ -55,11 +55,21 @@
<wsdl:message name="swaAttachmentRequest">
<part name="jpegImageRequest" type="xsd:hexBinary"/>
</wsdl:message>
- <wsdl:message name="swAattachmentResponse">
+ <wsdl:message name="swaAttachmentResponse">
<part name="jpegImageResponse" type="xsd:hexBinary"/>
</wsdl:message>
+ <!-- two attachments...and no body part -->
+ <wsdl:message name="swaAttachment2Request">
+ <part name="jpegImage1Request" type="xsd:hexBinary"/>
+ <part name="jpegImage2Request" type="xsd:hexBinary"/>
+ </wsdl:message>
+ <wsdl:message name="swaAttachment2Response">
+ <part name="jpegImage1Response" type="xsd:hexBinary"/>
+ <part name="jpegImage2Response" type="xsd:hexBinary"/>
+ </wsdl:message>
+
<!-- mtom -->
@@ -77,6 +87,11 @@
<wsdl:output message="tns:swaAttachmentResponse" />
</wsdl:operation>
+ <wsdl:operation name="swaAttachment2">
+ <wsdl:input message="tns:swaAttachment2Request" />
+ <wsdl:output message="tns:swaAttachment2Response" />
+ </wsdl:operation>
+
<wsdl:operation name="mtomAttachment">
<wsdl:input message="tns:mtomAttachmentRequest" />
@@ -107,6 +122,37 @@
</mime:part>
<mime:part>
<mime:content part="jpegImageResponse" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="swaAttachment2">
+ <wsdlsoap:operation soapAction="swaAttachment2"/>
+ <wsdl:input >
+ <mime:multipartRelated>
+ <mime:part>
+ <wsdlsoap:body parts="" use="literal"/>
+ </mime:part>
+
+ <mime:part>
+ <mime:content part="jpegImage1Request" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="jpegImage2Request" type="text/plain"/>
+ </mime:part>
+ </mime:multipartRelated>
+ </wsdl:input>
+ <wsdl:output >
+ <mime:multipartRelated>
+ <mime:part>
+ <wsdlsoap:body parts="" use="literal"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="jpegImage1Response" type="text/plain"/>
+ </mime:part>
+ <mime:part>
+ <mime:content part="jpegImage2Response" type="text/plain"/>
</mime:part>
</mime:multipartRelated>
</wsdl:output>
Modified: webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/SWAMTOMPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/SWAMTOMPortTypeImpl.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/SWAMTOMPortTypeImpl.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws-integration/test/org/apache/axis2/jaxws/swamtom/server/SWAMTOMPortTypeImpl.java Wed Apr 16 17:14:31 2008
@@ -26,6 +26,7 @@
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.ws.BindingType;
import javax.xml.ws.Holder;
+import javax.jws.WebParam.Mode;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
@@ -67,6 +68,56 @@
attachment[2] = 'A';
}
return attachment;
+ }
+
+ /**
+ * This method passes two SWA attachments as a request
+ * and expects two SWA attachments as a response.
+ * Note that the body content in both cases is empty.
+ * (See the wsdl)
+ * @param attachment (swa)
+ * @return attachment (swa)
+ */
+ @WebMethod(operationName="swaAttachment2", action="swaAttachment2")
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+ public void swaAttachment2(
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @WebParam(name = "jpegImage1Request", targetNamespace = "", partName = "jpegImage1Request")
+ byte[] attachment,
+
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @WebParam(name = "jpegImage2Request", targetNamespace = "", partName = "jpegImage2Request")
+ byte[] attachment2,
+
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @WebParam(name = "jpegImage1Response",
+ targetNamespace = "",
+ partName = "jpegImage1Response",
+ mode= Mode.OUT)
+ Holder<byte[]> attachmentOut1,
+
+ @XmlJavaTypeAdapter(HexBinaryAdapter.class)
+ @WebParam(name = "jpegImage2Response",
+ targetNamespace = "",
+ partName = "jpegImage2Response",
+ mode= Mode.OUT)
+ Holder<byte[]> attachmentOut2) {
+
+ if (attachment == null || attachment.length == 0){
+ throw new RuntimeException("Received empty first attachment");
+ } else if (attachment2 == null || attachment2.length == 0){
+ throw new RuntimeException("Received empty second attachment");
+ } else if (attachment[0] != '1') {
+ throw new RuntimeException("First attachment is not '1'");
+ } else if (attachment2[0] != '2') {
+ throw new RuntimeException("Second attachment is not '2'");
+ } else {
+ attachmentOut1.value = new byte[1];
+ attachmentOut1.value[0] = '3';
+ attachmentOut2.value = new byte[1];
+ attachmentOut2.value[0] = '4';
+ }
+
}
@WebMethod(operationName="mtomAttachment", action="mtomAttachment")
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java Wed Apr 16 17:14:31 2008
@@ -23,6 +23,7 @@
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
import org.apache.axiom.om.impl.llom.OMTextImpl;
+import org.apache.axis2.Constants;
import org.apache.axis2.Constants.Configuration;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
@@ -109,7 +110,7 @@
"{" + namespace + "}" + localPart);
}
- String cid;
+ String cid = null;
try {
// Create MIME Body Part
@@ -119,9 +120,17 @@
//Create a data source for the MIME Body Part
MimePartDataSource mpds = new MimePartDataSource(mbp);
+ long dataLength =data.length;
+ Integer value = null;
+ if (msgContext != null) {
+ value = (Integer) msgContext.getProperty(Constants.Configuration.MTOM_THRESHOLD);
+ }
+ int optimizedThreshold = (value != null) ? value.intValue() : 0;
+ if(optimizedThreshold==0 || dataLength > optimizedThreshold){
DataHandler dataHandler = new DataHandler(mpds);
cid = addDataHandler(dataHandler);
+ }
// Add the content id to the mime body part
mbp.setHeader(HTTPConstants.HEADER_CONTENT_ID, cid);
@@ -173,10 +182,12 @@
// even if the attachment is SWAREF ?)
if (writer instanceof MTOMXMLStreamWriter) {
textNode = new OMTextImpl(dh, null);
+ if(((MTOMXMLStreamWriter) writer).isOptimizedThreshold(textNode)){
cid = textNode.getContentID();
((MTOMXMLStreamWriter) writer).writeOptimized(textNode);
// Remember the attachment on the message.
addDataHandler(dh, cid);
+ }
}
if (log.isDebugEnabled()){
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java Wed Apr 16 17:14:31 2008
@@ -92,13 +92,13 @@
}
protected void onError(Throwable flt, MessageContext mc, ClassLoader cl) {
- setThreadClassLoader(cl);
- onError(flt, mc);
ClassLoader origClassLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return Thread.currentThread().getContextClassLoader();
}
});
+ setThreadClassLoader(cl);
+ onError(flt, mc);
setThreadClassLoader(origClassLoader);
}
@@ -151,13 +151,13 @@
}
protected void onComplete(MessageContext mc, ClassLoader cl) {
- setThreadClassLoader(cl);
- onComplete(mc);
ClassLoader origClassLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return Thread.currentThread().getContextClassLoader();
}
});
+ setThreadClassLoader(cl);
+ onComplete(mc);
setThreadClassLoader(origClassLoader);
}
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/client/config/MTOMConfigurator.java Wed Apr 16 17:14:31 2008
@@ -19,6 +19,8 @@
package org.apache.axis2.jaxws.client.config;
+import org.apache.axis2.Constants;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.binding.SOAPBinding;
import org.apache.axis2.jaxws.core.MessageContext;
@@ -68,49 +70,22 @@
// Enable MTOM
requestMsg.setMTOMEnabled(true);
-
if (threshold <= 0) {
if (log.isDebugEnabled()) {
log.debug("Enabling MTOM with no threshold.");
}
+ }else{
+ if(log.isDebugEnabled()){
+ log.debug("MTOM Threshold Value ="+threshold);
}
- else if (attachmentIDs != null) {
- // REVIEW This processing will be moved to axiom.
- // DISABLING FOR NOW
- /*
- long size = 0L;
-
- for (String attachmentID : attachmentIDs) {
- DataHandler dh = requestMsg.getDataHandler(attachmentID);
-
- if (dh != null) {
- DataSource ds = dh.getDataSource();
- InputStream is = null;
-
- try {
- is = ds.getInputStream();
- size += is.available();
- }
- catch (Exception e) {
- throw ExceptionFactory.
- makeWebServiceException(Messages.getMessage("mtomAttachErr"), e);
- }
- finally {
- try {
- if (is != null)
- is.close();
- }
- catch (Exception e) {
- //Nothing to do.
- }
- }
- }
- }
- if (size > threshold) {
- requestMsg.setMTOMEnabled(true);
- }
- */
+ //set MTOM threshold value on message context.
+ //Once MTOM threshold is set on message context it will be
+ //read by SOAPMessageFormatter.writeTo() while writing the attachment
+ //SOAPMessageFormatter will further propogate the threshold value to
+ //Axiom.OMOutputFormat. JAXBAttachmentUnmarshaller will then make
+ //decision if the attachment should be inlined or optimized.
+ messageContext.setProperty(Constants.Configuration.MTOM_THRESHOLD, new Integer(threshold));
}
}
else {
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/Attachment.java Wed Apr 16 17:14:31 2008
@@ -62,6 +62,7 @@
AttachmentDescription aDesc = null;
Object sigValue = null;
Class sigClass = null;
+ String partName = null;
/**
* Constructor used to set Attachment from wire unmarshalling
@@ -81,10 +82,11 @@
* @param sigValue
* @param sigClass
*/
- public Attachment(Object sigValue, Class sigClass, AttachmentDescription aDesc) {
+ public Attachment(Object sigValue, Class sigClass, AttachmentDescription aDesc, String partName) {
this.sigValue = sigValue;
this.sigClass = sigClass;
this.aDesc = aDesc;
+ this.partName = partName;
}
@@ -104,6 +106,11 @@
public String getContentID() {
if (cid == null) {
cid = UUIDGenerator.getUUID();
+ // Per spec, use the partName in the content-id
+ // http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html#Value-space_of_Content-Id_Header
+ if (partName != null) {
+ cid = partName + "=" + cid;
+ }
}
return cid;
}
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java Wed Apr 16 17:14:31 2008
@@ -231,7 +231,8 @@
// Create an Attachment object with the signature value
Attachment attachment = new Attachment(returnObject,
returnType,
- attachmentDesc);
+ attachmentDesc,
+ operationDesc.getResultPartName());
m.addDataHandler(attachment.getDataHandler(),
attachment.getContentID());
m.setDoingSWA(true);
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java Wed Apr 16 17:14:31 2008
@@ -265,7 +265,8 @@
// Create an Attachment object with the signature value
Attachment attachment = new Attachment(returnObject,
returnType,
- attachmentDesc);
+ attachmentDesc,
+ operationDesc.getResultPartName());
m.addDataHandler(attachment.getDataHandler(),
attachment.getContentID());
m.setDoingSWA(true);
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java Wed Apr 16 17:14:31 2008
@@ -363,7 +363,12 @@
// Now create the single JAXB element
String wrapperName = marshalDesc.getResponseWrapperClassName(operationDesc);
- Class cls = MethodMarshallerUtils.loadClass(wrapperName);
+ Class cls;
+ try {
+ cls = MethodMarshallerUtils.loadClass(wrapperName);
+ } catch (ClassNotFoundException e){
+ cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
+ }
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -458,7 +463,12 @@
// Now create the single JAXB element
String wrapperName = marshalDesc.getRequestWrapperClassName(operationDesc);
- Class cls = MethodMarshallerUtils.loadClass(wrapperName);
+ Class cls;
+ try {
+ cls = MethodMarshallerUtils.loadClass(wrapperName);
+ } catch (ClassNotFoundException e){
+ cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
+ }
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java Wed Apr 16 17:14:31 2008
@@ -524,7 +524,12 @@
// Now create the single JAXB element
String wrapperName = marshalDesc.getResponseWrapperClassName(operationDesc);
- Class cls = MethodMarshallerUtils.loadClass(wrapperName);
+ Class cls;
+ try {
+ cls = MethodMarshallerUtils.loadClass(wrapperName);
+ } catch (ClassNotFoundException e){
+ cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
+ }
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -647,7 +652,12 @@
// Now create the single JAXB element
String wrapperName = marshalDesc.getRequestWrapperClassName(operationDesc);
- Class cls = MethodMarshallerUtils.loadClass(wrapperName);
+ Class cls;
+ try {
+ cls = MethodMarshallerUtils.loadClass(wrapperName);
+ } catch (ClassNotFoundException e){
+ cls = MethodMarshallerUtils.loadClass(wrapperName, endpointDesc.getAxisService().getClassLoader());
+ }
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
Modified: webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java?rev=648902&r1=648901&r2=648902&view=diff
==============================================================================
--- webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java (original)
+++ webservices/axis2/branches/java/1_4/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/LegacyExceptionUtil.java Wed Apr 16 17:14:31 2008
@@ -113,7 +113,11 @@
Class faultBeanClass = null;
if (faultBeanName != null && faultBeanName.length() > 0) {
try {
+ try {
faultBeanClass = MethodMarshallerUtils.loadClass(faultBeanName);
+ } catch (ClassNotFoundException e){
+ faultBeanClass = MethodMarshallerUtils.loadClass(faultBeanName, fd.getOperationDescription().getEndpointInterfaceDescription().getEndpointDescription().getAxisService().getClassLoader());
+ }
} catch (Throwable throwable) {
if (log.isDebugEnabled()) {
log.debug("Cannot load fault bean class = " + faultBeanName +
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org