You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by mm...@apache.org on 2004/09/24 01:47:16 UTC
svn commit: rev 47130 - incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis
Author: mmerz
Date: Thu Sep 23 16:47:15 2004
New Revision: 47130
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/DropInDeploymentHandler.java
Log:
Fixed the serialization and deserialization of complex types by AXIS. Unless a
parameter or return type is either one of the standard simple types or registers
itself for custom serialization it will be serialized as a default java bean.
Added a bit more logging to show errors when a .jws fails to compile properly.
Contributor: Jonathan Colwell
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java Thu Sep 23 16:47:15 2004
@@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.wsdl.OperationType;
@@ -29,10 +30,12 @@
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;
+import org.apache.axis.description.FaultDesc;
import org.apache.axis.description.ServiceDesc;
import org.apache.axis.description.JavaServiceDesc;
import org.apache.axis.description.ParameterDesc;
import org.apache.axis.description.OperationDesc;
+import org.apache.axis.utils.BeanPropertyDescriptor;
import org.apache.beehive.wsm.axis.badtiger.EnumWrapper;
import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;
import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;
@@ -143,6 +146,11 @@
Method javaMethod = serviceClass
.getMethod(meth.getJavaMethodName(),
paramClasses.toArray(new Class[paramClasses.size()]));
+ for (Class thrown : javaMethod.getExceptionTypes()) {
+ FaultDesc fd = new FaultDesc();
+ fd.setClassName(thrown.getName());
+ od.addFault(fd);
+ }
od.setMethod(javaMethod);
@@ -155,19 +163,34 @@
}
private static void configureTypeMapping(ServiceDesc desc, Class type) {
- TypeMapping tm = desc.getTypeMapping();
- QName q = tm.getTypeQName(type);
- if (q == null) {
- String namespace = Namespaces.makeNamespace( type.getName() ) ;
- if (namespace == null || namespace.endsWith("DefaultNamespace")) {
- namespace = desc.getDefaultNamespace();
- }
- q = new QName(namespace,
- Types.getLocalNameFromFullName( type.getName() ) );
- if (! tm.isRegistered(type, q)) {
- tm.register( type, q,
- new BeanSerializerFactory(type, q),
- new BeanDeserializerFactory(type, q));
+
+ if (type.isArray()) {
+ configureTypeMapping(desc, type.getComponentType());
+ }
+ else {
+
+ TypeMapping tm = desc.getTypeMapping();
+ QName q = tm.getTypeQName(type);
+ if (q == null) {
+ String namespace = Namespaces.makeNamespace( type.getName() ) ;
+ if (namespace == null || namespace
+ .endsWith("DefaultNamespace")) {
+ namespace = desc.getDefaultNamespace();
+ }
+ q = new QName(namespace,
+ Types.getLocalNameFromFullName( type.getName() ) );
+ if (! tm.isRegistered(type, q)) {
+ tm.register( type, q,
+ new BeanSerializerFactory(type, q),
+ new BeanDeserializerFactory(type, q));
+ Map serProps = BeanDeserializerFactory
+ .getProperties(type, null);
+ for (BeanPropertyDescriptor beanProps :
+ (Collection<BeanPropertyDescriptor>)serProps
+ .values()) {
+ configureTypeMapping(desc, beanProps.getType());
+ }
+ }
}
}
}
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/DropInDeploymentHandler.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/DropInDeploymentHandler.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/DropInDeploymentHandler.java Thu Sep 23 16:47:15 2004
@@ -83,6 +83,10 @@
*/
public class DropInDeploymentHandler extends BasicHandler {
+ protected static Log log =
+ LogFactory.getLog(DropInDeploymentHandler.class.getName());
+
+
private Map<Class, SOAPService> mSoapServiceMap =
new HashMap<Class, SOAPService>();
@@ -303,7 +307,7 @@
compiler.addFile(jFile);
boolean result = compiler.compile();
-
+
if ( !result ) {
/*
* Delete the *class file - sometimes it gets created
@@ -320,7 +324,7 @@
new StringBuffer("Error compiling ");
message.append(jFile);
message.append(":\n");
-
+
List errors = compiler.getErrors();
int count = errors.size();
for (int i = 0; i < count; i++) {
@@ -336,11 +340,22 @@
}
root.appendChild(doc.createTextNode(message
.toString()));
- throw new AxisFault( "Server.compileError",
- Messages
- .getMessage("badCompile00",
- jFile),
- null, new Element[] { root } );
+ AxisFault af =
+ new AxisFault( "Server.compileError",
+ Messages
+ .getMessage("badCompile00",
+ jFile),
+ null, new Element[] { root } );
+ log.warn("Error compiling JWS.", af);
+ /*
+ * FIXME jcolwell@bea.com 2004-Sep-23 --
+ * logging error to System.out since I have no idea
+ * where log.warn is dumping the error.
+ * Additionally, the error only shows up if a method
+ * is invoked, otherwise, the error is not displayed.
+ */
+ af.printStackTrace();
+ throw af;
}
ClassUtils.removeClassLoader( clsName );