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/10/29 21:22:09 UTC
svn commit: rev 55989 - in incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm: axis jsr181/model
Author: mmerz
Date: Fri Oct 29 12:22:08 2004
New Revision: 55989
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java
Log:
Now creating a TypeDesc for classes using the BeanSerializer. This helps the
namespace behavior when using Doc/Literal.
Minor fix to WebServiceTYPEMetadata so the default namespace will be used by
parameters and results even if no annotation is present.
Contributor: Jonathan Colwell with lots of help from Dims and Jongjin Choi
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 Fri Oct 29 12:22:08 2004
@@ -47,6 +47,16 @@
import org.apache.axis.wsdl.fromJava.Types;
import org.apache.axis.constants.Style;
import org.apache.axis.constants.Use;
+import org.apache.axis.description.ElementDesc;
+import org.apache.axis.description.FaultDesc;
+import org.apache.axis.description.FieldDesc;
+import org.apache.axis.description.ServiceDesc;
+import org.apache.axis.description.TypeDesc;
+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.axis.utils.BeanUtils;
import org.apache.beehive.wsm.axis.util.encoding.CollectionSerializerFactory;
import org.apache.beehive.wsm.axis.util.encoding.XmlBeanDeserializerFactory;
import org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
@@ -104,11 +114,10 @@
OperationDesc od = new OperationDesc();
+ String javaMethodName = meth.getJavaMethodName();
od.setElementQName(new QName(operationName));
od.setName(operationName);
allowedMethods.add(operationName);
- od.setUse(sd.getUse());
- od.setStyle(sd.getStyle());
od.setSoapAction(meth.getWmAction());
@@ -320,13 +329,36 @@
*/
&& !File.class.isAssignableFrom(type)) {
- /*
- * NOTE jcolwell@bea.com 2004-Oct-25 --
- * tried adding some typedesc stuff to get the doc/lit
- * namespaces working properly but it didn't help much.
- */
- //TypeDesc td = new TypeDesc(type);
-
+ TypeDesc td = TypeDesc.getTypeDescForClass(type);
+ TypeDesc superTd = null;
+ BeanPropertyDescriptor[] superPd = null;
+ if (null == td) {
+ td = new TypeDesc(type);
+
+ Class supa = type.getSuperclass();
+
+ if ((supa != null)
+ && (supa != java.lang.Object.class)
+ && (supa != java.lang.Exception.class)
+ && (supa != java.lang.Throwable.class)
+ && (supa != java.rmi.RemoteException.class)
+ && (supa != org.apache.axis.AxisFault.class)) {
+ configureTypeMapping(desc, supa);
+ }
+
+ superTd = TypeDesc
+ .getTypeDescForClass(supa);
+
+ if (superTd != null) {
+ superPd = superTd.getPropertyDescriptors();
+ }
+ td.setXmlType(q);
+ TypeDesc.registerTypeDescForClass(type, td);
+
+ }
+ else {
+ td = null;
+ }
tm.register( type, q,
new BeanSerializerFactory(type, q),
/*
@@ -346,20 +378,35 @@
if (!(subType.isPrimitive()
|| subType.getName().startsWith("java.")
|| subType.getName().startsWith("javax."))) {
- /*
+ configureTypeMapping(desc, subType);
+ }
+
+ if (td != null) {
+ String ns = q.getNamespaceURI();
+ if (superTd != null && superPd != null) {
+ for (int j=0; j<superPd.length; j++) {
+ if (beanProps.getName()
+ .equals(superPd[j]
+ .getName())) {
+ ns = superTd.getXmlType()
+ .getNamespaceURI();
+ break;
+ }
+ }
+ }
+
FieldDesc fd = new ElementDesc();
fd.setJavaType(subType);
fd.setFieldName(beanProps.getName());
- fd.setXmlName(new QName("http://fake",
+
+ fd.setXmlName(new QName(ns,
beanProps.getName()));
- fd.setXmlType(*/
- configureTypeMapping(desc, subType);
- /*);
+ // NOTE jcolwell@bea.com 2004-Oct-28 -- might need
+ // to do more to ensure a useful type QName.
+ fd.setXmlType(tm.getTypeQName(subType));
td.addFieldDesc(fd);
- */
}
- }
- //TypeDesc.registerTypeDescForClass(type, td);
+ }
}
else {
throw new InvalidTypeMappingException
Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java (original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/WebServiceTYPEMetadata.java Fri Oct 29 12:22:08 2004
@@ -188,7 +188,7 @@
{
// JSR-181 defaults: fill in default for tergetNamespace from @WebService
String wrTargetNamespace = wsmm.getWrTargetNamespace();
- if ((null != wrTargetNamespace) && (0 == wrTargetNamespace.length()))
+ if ((null == wrTargetNamespace) || (0 == wrTargetNamespace.length()))
{
wsmm.setWrTargetNamespace(getWsTargetNamespace());
}
@@ -197,7 +197,7 @@
for (WebServicePARAMETERMetadata wspm : wsmm.getParams())
{
String wpTargetNamespace = wspm.getWpTargetNamespace();
- if ((null != wpTargetNamespace) && (0 == wpTargetNamespace.length()))
+ if ((null == wpTargetNamespace) || (0 == wpTargetNamespace.length()))
{
wspm.setWpTargetNamespace(getWsTargetNamespace());
}
@@ -795,4 +795,4 @@
return "http://" + targetNamespace;
}
-}
\ No newline at end of file
+}