tomj 02/02/26 16:12:40
Modified: java/samples/transport/tcp Tag: TomAndGlen TCPSender.java
java/src Tag: TomAndGlen log4j.properties
java/src/org/apache/axis Tag: TomAndGlen MessageContext.java
java/src/org/apache/axis/client Tag: TomAndGlen Call.java
java/src/org/apache/axis/encoding Tag: TomAndGlen
TypeMappingRegistryImpl.java
java/src/org/apache/axis/encoding/ser Tag: TomAndGlen
BeanSerializer.java SimpleDeserializer.java
SimpleSerializer.java
java/src/org/apache/axis/message Tag: TomAndGlen
RPCElement.java RPCParam.java
java/src/org/apache/axis/utils Tag: TomAndGlen
JavaUtils.java
java/src/org/apache/axis/wsdl/toJava Tag: TomAndGlen
JavaComplexTypeWriter.java JavaImplWriter.java
JavaSkelWriter.java JavaStubWriter.java
JavaWriterFactory.java Parameter.java
SchemaUtils.java SymbolTable.java TypeEntry.java
Utils.java
java/test/wsdl Tag: TomAndGlen Wsdl2javaTestSuite.xml
java/test/wsdl/types Tag: TomAndGlen VerifyTestCase.java
Log:
Not-ready-for-prime-time document literal work.
Creating a branch so Tom and I can get this working at the interop event
and check it in later.
Revision Changes Path
No revision
No revision
1.14.2.1 +1 -1 xml-axis/java/samples/transport/tcp/TCPSender.java
Index: TCPSender.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/TCPSender.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- TCPSender.java 19 Feb 2002 17:38:18 -0000 1.14
+++ TCPSender.java 27 Feb 2002 00:12:39 -0000 1.14.2.1
@@ -114,7 +114,7 @@
log.debug( "---------------------------------------------------");
log.debug( reqEnv );
- if ( log.isDebugEnabled() ) {
+ if ( false ) {
// Special case - if the debug level is this high then something
// really bad must be going on - so just dump the input stream
// to stdout.
No revision
No revision
1.4.2.1 +1 -1 xml-axis/java/src/log4j.properties
Index: log4j.properties
===================================================================
RCS file: /home/cvs/xml-axis/java/src/log4j.properties,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- log4j.properties 22 Feb 2002 15:07:33 -0000 1.4
+++ log4j.properties 27 Feb 2002 00:12:39 -0000 1.4.2.1
@@ -1,5 +1,5 @@
# Set root category priority to ERROR and its only appender to A1.
-log4j.rootCategory=INFO, CONSOLE
+log4j.rootCategory=ERROR, CONSOLE
#log4j.rootCategory=INFO, CONSOLE, LOGFILE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
No revision
No revision
1.78.2.1 +39 -22 xml-axis/java/src/org/apache/axis/MessageContext.java
Index: MessageContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
retrieving revision 1.78
retrieving revision 1.78.2.1
diff -u -r1.78 -r1.78.2.1
--- MessageContext.java 25 Feb 2002 10:53:40 -0000 1.78
+++ MessageContext.java 27 Feb 2002 00:12:39 -0000 1.78.2.1
@@ -167,7 +167,7 @@
*/
private String username = null;
private String password = null;
- private String operationStyle = null;
+ private int operationStyle = SOAPService.STYLE_RPC;
private boolean useSOAPAction = false;
private String SOAPActionURI = null;
private String encodingStyle = Constants.URI_CURRENT_SOAP_ENC;
@@ -273,11 +273,7 @@
* Encoding
*/
public boolean isEncoded() {
- return isEncoded;
- }
-
- public void setEncoded(boolean encoded) {
- isEncoded = encoded;
+ return Constants.URI_CURRENT_SOAP_ENC.equals(encodingStyle);
}
/**
@@ -455,8 +451,8 @@
TypeMappingRegistry tmr = service.getTypeMappingRegistry();
setTypeMappingRegistry(tmr);
setProperty(ISRPC, new Boolean(service.isRPC()));
- setEncoded(service.getStyle() == SOAPService.STYLE_RPC);
- setEncodingStyle(isEncoded() ? Constants.URI_CURRENT_SOAP_ENC:"");
+ setEncodingStyle((service.getStyle() == SOAPService.STYLE_RPC) ?
+ Constants.URI_CURRENT_SOAP_ENC : "");
}
}
@@ -611,7 +607,7 @@
JavaUtils.getMessage("badProp00", new String[] {
name, "java.lang.String", value.getClass().getName()}));
}
- setOperationStyle((String) value);
+ setOperationStyle(getStyleFromString((String)value));
}
else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) {
if (!(value instanceof Boolean)) {
@@ -669,7 +665,7 @@
return new Boolean(getMaintainSession());
}
else if (name.equals(Call.OPERATION_STYLE_PROPERTY)) {
- return getOperationStyle();
+ return getStyleFromInt(getOperationStyle());
}
else if (name.equals(Call.SOAPACTION_USE_PROPERTY)) {
return new Boolean(useSOAPAction());
@@ -731,23 +727,14 @@
*
* @exception IllegalArgumentException if operationStyle is not "rpc" or
"document".
*/
- public void setOperationStyle(String operationStyle) {
- if ("rpc".equalsIgnoreCase(operationStyle)
- || "document".equalsIgnoreCase(operationStyle)) {
- this.operationStyle = operationStyle;
- }
- else {
- throw new IllegalArgumentException(JavaUtils.getMessage(
- "badProp01",
- new String[] {Call.OPERATION_STYLE_PROPERTY,
- "\"rpc\", \"document\"", operationStyle}));
- }
+ public void setOperationStyle(int operationStyle) {
+ this.operationStyle = operationStyle;
} // setOperationStyle
/**
* Get the operation style.
*/
- public String getOperationStyle() {
+ public int getOperationStyle() {
return operationStyle;
} // getOperationStyle
@@ -816,5 +803,35 @@
}
serviceHandler = null;
havePassedPivot = false;
+ }
+
+ /**
+ * Utility function to convert string to operation style constants
+ *
+ * @param operationStyle "rpc" or "document"
+ * @return either SOAPService.STYLE_RPC or SOAPService.STYLE_DOCUMENT
+ * @throws IllegalArgumentException
+ */
+ public static int getStyleFromString(String operationStyle)
+ {
+ if ("rpc".equalsIgnoreCase(operationStyle))
+ return SOAPService.STYLE_RPC;
+ if ("document".equalsIgnoreCase(operationStyle))
+ return SOAPService.STYLE_DOCUMENT;
+
+ throw new IllegalArgumentException(JavaUtils.getMessage(
+ "badProp01",
+ new String[] {Call.OPERATION_STYLE_PROPERTY,
+ "\"rpc\", \"document\"", operationStyle}));
+ }
+
+ public static String getStyleFromInt(int style)
+ {
+ if (style == SOAPService.STYLE_RPC)
+ return "rpc";
+ if (style == SOAPService.STYLE_DOCUMENT)
+ return "document";
+
+ return null;
}
};
No revision
No revision
1.81.2.1 +54 -9 xml-axis/java/src/org/apache/axis/client/Call.java
Index: Call.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
retrieving revision 1.81
retrieving revision 1.81.2.1
diff -u -r1.81 -r1.81.2.1
--- Call.java 25 Feb 2002 17:38:14 -0000 1.81
+++ Call.java 27 Feb 2002 00:12:39 -0000 1.81.2.1
@@ -488,6 +488,9 @@
* @param namespaceURI URI of the encoding to use.
*/
public void setEncodingStyle(String namespaceURI) {
+ if (namespaceURI == null)
+ namespaceURI = "";
+
encodingStyle = namespaceURI;
}
@@ -627,6 +630,34 @@
paramModes = new Vector();
}
+ paramNames.add( new QName("", paramName) );
+ paramTypes.add( paramType );
+ paramModes.add( parameterMode );
+
+ }
+ else {
+ throw new JAXRPCException();
+ }
+ }
+ /**
+ * Adds the specified parameter to the list of parameters for the
+ * operation associated with this Call object.
+ *
+ * @param paramName Name that will be used for the parameter in the XML
+ * @param paramType XMLType of the parameter
+ * @param parameterMode one of PARAM_MODE_IN, PARAM_MODE_OUT
+ * or PARAM_MODE_INOUT
+ */
+ public void addParameter(QName paramName, QName paramType,
+ ParameterMode parameterMode) {
+ if (parmAndRetReq) {
+
+ if ( paramNames == null ) {
+ paramNames = new Vector();
+ paramTypes = new Vector();
+ paramModes = new Vector();
+ }
+
paramNames.add( paramName );
paramTypes.add( paramType );
paramModes.add( parameterMode );
@@ -640,18 +671,30 @@
/**
* Return the QName of the type of the parameters with the given name.
*
- * Note: Not part of JAX-RPC specification.
- *
* @param paramName name of the parameter to return
* @return XMLType XMLType of paramName, or null if not found.
*/
public QName getParameterTypeByName(String paramName) {
int i ;
+ QName paramQName = new QName("", paramName);
+ return getParameterTypeByQName(paramQName);
+ }
+
+ /**
+ * Return the QName of the type of the parameters with the given name.
+ *
+ * Note: Not part of JAX-RPC specification.
+ *
+ * @param paramQName QName of the parameter to return
+ * @return XMLType XMLType of paramQName, or null if not found.
+ */
+ public QName getParameterTypeByQName(QName paramQName) {
+ int i;
if ( paramNames == null ) return( null );
for (i = 0 ; i< paramNames.size() ; i++ )
- if ( ((String)paramNames.get(i)).equals(paramName) ) {
+ if ( ((QName)paramNames.get(i)).equals(paramQName) ) {
return (QName) paramTypes.get(i);
}
return( null );
@@ -1171,8 +1214,10 @@
for ( i = 0 ; i < paramNames.size() ; i++ ) {
if (paramModes.get(i) == ParameterMode.PARAM_MODE_OUT)
continue ;
- RPCParam p = new RPCParam( (String) paramNames.get(i),
- params[j++] );
+ QName paramQName = (QName)paramNames.get(i);
+ RPCParam p = new RPCParam(paramQName.getNamespaceURI(),
+ paramQName.getLocalPart(),
+ params[j++] );
result.add( p );
}
@@ -1316,13 +1361,13 @@
TypeMappingRegistry tmr = msgContext.getTypeMappingRegistry();
// If a TypeMapping is not available, add one.
- TypeMapping tm = (TypeMapping)
tmr.getTypeMapping(Constants.URI_CURRENT_SOAP_ENC);
+ TypeMapping tm = (TypeMapping) tmr.getTypeMapping(encodingStyle);
TypeMapping defaultTM = (TypeMapping) tmr.getDefaultTypeMapping();
try {
if (tm == null || tm == defaultTM ) {
tm = (TypeMapping) tmr.createTypeMapping();
- tm.setSupportedNamespaces(new String[]
{Constants.URI_CURRENT_SOAP_ENC});
- tmr.register(Constants.URI_CURRENT_SOAP_ENC, tm);
+ tm.setSupportedNamespaces(new String[] {encodingStyle});
+ tmr.register(msgContext.getEncodingStyle(), tm);
}
if (!force && tm.isRegistered(javaType, xmlType))
return;
@@ -1567,7 +1612,7 @@
}
msgContext.setMaintainSession(maintainSession);
if (operationStyle != null) {
- msgContext.setOperationStyle(operationStyle);
+
msgContext.setOperationStyle(MessageContext.getStyleFromString(operationStyle));
}
if (useSOAPAction) {
msgContext.setUseSOAPAction(true);
No revision
No revision
1.5.2.1 +3 -0
xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java
Index: TypeMappingRegistryImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistryImpl.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- TypeMappingRegistryImpl.java 1 Feb 2002 22:08:26 -0000 1.5
+++ TypeMappingRegistryImpl.java 27 Feb 2002 00:12:39 -0000 1.5.2.1
@@ -194,6 +194,7 @@
return;
}
String[] keys = secondaryTMR.getRegisteredNamespaces();
+// String[] keys = null;
if (keys != null) {
for(int i=0; i < keys.length; i++) {
try {
@@ -245,6 +246,7 @@
public void register(String namespaceURI,
javax.xml.rpc.encoding.TypeMapping mapping)
throws JAXRPCException {
+// namespaceURI = "";
if (mapping == null ||
!(mapping instanceof TypeMapping)) {
throw new IllegalArgumentException();
@@ -295,6 +297,7 @@
*/
public javax.xml.rpc.encoding.TypeMapping
getTypeMapping(String namespaceURI) {
+// namespaceURI = "";
TypeMapping del = (TypeMapping) mapTM.get(namespaceURI);
TypeMapping tm = null;
if (del != null) {
No revision
No revision
1.11.2.1 +6 -3
xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
Index: BeanSerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- BeanSerializer.java 25 Feb 2002 17:38:15 -0000 1.11
+++ BeanSerializer.java 27 Feb 2002 00:12:39 -0000 1.11.2.1
@@ -76,6 +76,7 @@
import org.apache.axis.wsdl.fromJava.ClassRep;
import org.apache.axis.wsdl.fromJava.FieldRep;
import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.axis.wsdl.toJava.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -171,7 +172,7 @@
if (propName.equals("class"))
continue;
//if (!isSOAP_ENC && beanAttributeNames.contains(propName))
- if (beanAttributeNames.contains(propName))
+ if (beanAttributeNames.contains(Utils.xmlNameToJava(propName)))
continue;
propName = format(propName, elementPropertyFormat);
@@ -427,9 +428,11 @@
// and add it to our attribute list
for (int i=0; i<propertyDescriptor.length; i++) {
String propName = propertyDescriptor[i].getName();
+ if (propName.equals("class"))
+ continue;
// skip it if its not in the list
- if (!beanAttributeNames.contains(propName)) continue;
- if (propName.equals("class")) continue;
+ if (!beanAttributeNames.contains(Utils.xmlNameToJava(propName)))
+ continue;
propName = format(propName, elementPropertyFormat);
Method readMethod = propertyDescriptor[i].getReadMethod();
1.2.2.1 +105 -0
xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java
Index: SimpleDeserializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- SimpleDeserializer.java 31 Jan 2002 03:26:09 -0000 1.2
+++ SimpleDeserializer.java 27 Feb 2002 00:12:39 -0000 1.2.2.1
@@ -59,6 +59,8 @@
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.util.Vector;
+import java.util.HashMap;
import org.apache.axis.InternalException;
import org.apache.axis.message.SOAPHandler;
@@ -76,6 +78,8 @@
import org.apache.axis.encoding.DeserializerFactory;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.axis.encoding.TypeMapping;
+import org.apache.axis.encoding.SimpleType;
/**
* A deserializer for any simple type with a (String) constructor. Note:
@@ -90,6 +94,8 @@
StringBuffer val = new StringBuffer();
private Constructor constructor = null;
+ private BeanPropertyDescriptor[] pd = null;
+ private HashMap propertyMap = new HashMap();
public QName xmlType;
public Class javaType;
@@ -101,6 +107,17 @@
public SimpleDeserializer(Class javaType, QName xmlType) {
this.xmlType = xmlType;
this.javaType = javaType;
+
+ // if this type is a SimpleType bean, get bean properties
+ if (SimpleType.class.isAssignableFrom(javaType)) {
+ this.pd = BeanSerializer.getPd(javaType);
+ // loop through properties and grab the names for later
+ for (int i = 0; i < pd.length; i++) {
+ BeanPropertyDescriptor descriptor = pd[i];
+ propertyMap.put(descriptor.getName(), descriptor);
+ }
+ }
+
}
/**
@@ -210,4 +227,92 @@
}
return constructor.newInstance(new Object [] { source });
}
+
+ /**
+ * Set the bean properties that correspond to element attributes.
+ *
+ * This method is invoked after startElement when the element requires
+ * deserialization (i.e. the element is not an href and the value is not nil.)
+ * @param namespace is the namespace of the element
+ * @param localName is the name of the element
+ * @param qName is the prefixed qName of the element
+ * @param attributes are the attributes on the element...used to get the type
+ * @param context is the DeserializationContext
+ */
+ public void onStartElement(String namespace, String localName,
+ String qName, Attributes attributes,
+ DeserializationContext context)
+ throws SAXException
+ {
+
+ // if this isn't a simpleType bean, wont have attributes
+ if (! SimpleType.class.isAssignableFrom(javaType))
+ return;
+
+ // get list of properties that are really attributes
+ Vector beanAttributeNames = BeanSerializer.getBeanAttributes(javaType);
+
+ // loop through the attributes and set bean properties that
+ // correspond to attributes
+ if (beanAttributeNames != null &&
+ beanAttributeNames.size() > 0) {
+ for (int i=0; i < attributes.getLength(); i++) {
+ String attrName = attributes.getLocalName(i);
+ String attrNameUp = BeanSerializer.format(attrName,
BeanSerializer.FORCE_UPPER);
+ String attrNameLo = BeanSerializer.format(attrName,
BeanSerializer.FORCE_LOWER);
+ String mangledName = JavaUtils.xmlNameToJava(attrName);
+
+ // See if the attribute is a beanAttribute name
+ if (!beanAttributeNames.contains(attrName) &&
+ !beanAttributeNames.contains(attrNameUp) &&
+ !beanAttributeNames.contains(attrNameLo))
+ continue;
+
+ // look for the attribute property
+ BeanPropertyDescriptor bpd =
+ (BeanPropertyDescriptor) propertyMap.get(attrNameUp);
+ if (bpd == null)
+ bpd = (BeanPropertyDescriptor) propertyMap.get(attrNameLo);
+ if (bpd == null)
+ bpd = (BeanPropertyDescriptor) propertyMap.get(mangledName);
+ if (bpd != null) {
+ if (bpd.getWriteMethod() == null ) continue ;
+
+ // determine the QName for this child element
+ TypeMapping tm = context.getTypeMapping();
+ Class type = bpd.getType();
+ QName qn = tm.getTypeQName(type);
+ if (qn == null)
+ throw new SAXException(
+ JavaUtils.getMessage("unregistered00",
type.toString()));
+
+ // get the deserializer
+ Deserializer dSer = context.getDeserializerForType(qn);
+ if (dSer == null)
+ throw new SAXException(
+ JavaUtils.getMessage("noDeser00", type.toString()));
+ if (! (dSer instanceof SimpleDeserializer))
+ throw new SAXException(
+ JavaUtils.getMessage("AttrNotSimpleType00",
+ bpd.getName(),
+ type.toString()));
+
+ if (bpd.getWriteMethod().getParameterTypes().length == 1) {
+ // Success! Create an object from the string and set
+ // it in the bean
+ try {
+ Object val = ((SimpleDeserializer)dSer).
+ makeValue(attributes.getValue(i));
+ bpd.getWriteMethod().invoke(value, new Object[] {val} );
+ } catch (Exception e) {
+ throw new SAXException(e);
+ }
+ }
+
+ } // if bpd != null
+ } // attribute loop
+ } // if attributes exist
+ } // onStartElement
+
+
}
1.2.2.1 +62 -0
xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java
Index: SimpleSerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- SimpleSerializer.java 2 Feb 2002 18:06:18 -0000 1.2
+++ SimpleSerializer.java 27 Feb 2002 00:12:39 -0000 1.2.2.1
@@ -57,12 +57,16 @@
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
import javax.xml.rpc.namespace.QName;
import java.io.IOException;
+import java.util.Vector;
+import java.lang.reflect.Method;
import org.apache.axis.Constants;
import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.axis.wsdl.toJava.Utils;
import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.XMLUtils;
import org.apache.axis.encoding.Serializer;
@@ -72,6 +76,7 @@
import org.apache.axis.encoding.DeserializerFactory;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.axis.encoding.SimpleType;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
/**
@@ -101,6 +106,11 @@
if (value != null && value.getClass() == java.lang.Object.class) {
throw new IOException(JavaUtils.getMessage("cantSerialize02"));
}
+
+ // get any attributes
+ if (value instanceof SimpleType)
+ attributes = getObjectAttributes(value, attributes);
+
context.startElement(name, attributes);
if (value != null) {
// We could have separate serializers/deserializers to take
@@ -126,6 +136,8 @@
} else if (value instanceof String) {
context.writeString(
XMLUtils.xmlEncodeString(value.toString()));
+ } else if (value instanceof SimpleType) {
+ context.writeString(value.toString());
} else {
context.writeString(value.toString());
}
@@ -133,6 +145,56 @@
context.endElement();
}
+ private Attributes getObjectAttributes(Object value, Attributes attributes) {
+
+ // get the list of attributes from the bean
+ Vector beanAttributeNames =
+ BeanSerializer.getBeanAttributes(value.getClass());
+
+ // if nothing, return
+ if (beanAttributeNames.isEmpty())
+ return attributes;
+
+ AttributesImpl attrs;
+ if (attributes != null)
+ attrs = new AttributesImpl(attributes);
+ else
+ attrs = new AttributesImpl();
+
+ BeanPropertyDescriptor propertyDescriptor[] =
+ BeanSerializer.getPd(value.getClass());
+
+ try {
+ // Find each property that is an attribute
+ // and add it to our attribute list
+ for (int i=0; i<propertyDescriptor.length; i++) {
+ String propName = propertyDescriptor[i].getName();
+ if (propName.equals("class"))
+ continue;
+ // skip it if its not in the list
+ if (!beanAttributeNames.contains(Utils.xmlNameToJava(propName)))
+ continue;
+
+ Method readMethod = propertyDescriptor[i].getReadMethod();
+ if (readMethod != null &&
+ readMethod.getParameterTypes().length == 0) {
+ // add to our attributes
+ Object propValue = propertyDescriptor[i].
+ getReadMethod().invoke(value, new Object[]{});
+ // NOTE: we will always set the attribute here to something,
+ // which we may not want (i.e. if null, omit it)
+ String propString = propValue != null ? propValue.toString() :
"";
+ attrs.addAttribute("", propName, propName, "CDATA", propString);
+ }
+ }
+ } catch (Exception e) {
+ // no attributes
+ return attrs;
+ }
+
+ return attrs;
+ }
+
public String getMechanismType() { return Constants.AXIS_SAX; }
/**
No revision
No revision
1.35.2.1 +16 -2 xml-axis/java/src/org/apache/axis/message/RPCElement.java
Index: RPCElement.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -r1.35 -r1.35.2.1
--- RPCElement.java 22 Feb 2002 16:15:55 -0000 1.35
+++ RPCElement.java 27 Feb 2002 00:12:39 -0000 1.35.2.1
@@ -60,6 +60,7 @@
import org.apache.axis.Constants;
import org.apache.axis.MessageContext;
import org.apache.axis.Handler;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.utils.cache.ClassCache;
import org.apache.axis.utils.cache.JavaClass;
import org.apache.axis.utils.JavaUtils;
@@ -219,11 +220,24 @@
if (encodingStyle.equals("")) {
context.registerPrefixForURI("", getNamespaceURI());
}
+ MessageContext msgContext = context.getMessageContext();
+ boolean isRPC = true;
+ if (msgContext != null) {
+ if ((msgContext.getOperationStyle() != SOAPService.STYLE_RPC) &&
+ ! msgContext.isPropertyTrue("wrapit"))
+ isRPC = false;
+ }
+
+ if (isRPC) {
+ context.startElement(new QName(namespaceURI,name), attributes);
+ }
- context.startElement(new QName(namespaceURI,name), attributes);
for (int i = 0; i < params.size(); i++) {
((RPCParam)params.elementAt(i)).serialize(context);
}
- context.endElement();
+
+ if (isRPC) {
+ context.endElement();
+ }
}
}
1.32.2.1 +11 -8 xml-axis/java/src/org/apache/axis/message/RPCParam.java
Index: RPCParam.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCParam.java,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -r1.32 -r1.32.2.1
--- RPCParam.java 22 Feb 2002 23:39:46 -0000 1.32
+++ RPCParam.java 27 Feb 2002 00:12:39 -0000 1.32.2.1
@@ -77,8 +77,7 @@
// Who's your daddy?
RPCElement myCall;
- private String namespaceURI;
- private String name;
+ private QName qname;
public Object value;
private static Field valueField;
@@ -96,14 +95,13 @@
*/
public RPCParam(String name, Object value)
{
- this.name = name;
+ this.qname = new QName("", name);
this.value = value;
}
public RPCParam(String namespace, String name, Object value)
{
- this.namespaceURI = namespace;
- this.name = name;
+ this.qname = new QName(namespace, name);
this.value = value;
}
@@ -124,7 +122,12 @@
public String getName()
{
- return this.name;
+ return this.qname.getLocalPart();
+ }
+
+ public QName getQName()
+ {
+ return this.qname;
}
public static Field getValueField()
@@ -136,9 +139,9 @@
throws IOException
{
if (value != null) {
- context.serialize(new QName(namespaceURI,name), null, value,
value.getClass());
+ context.serialize(qname, null, value, value.getClass());
} else {
- context.serialize(new QName(namespaceURI,name), null, value, null);
+ context.serialize(qname, null, value, null);
}
}
}
No revision
No revision
1.32.2.1 +6 -5 xml-axis/java/src/org/apache/axis/utils/JavaUtils.java
Index: JavaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -r1.32 -r1.32.2.1
--- JavaUtils.java 22 Feb 2002 23:39:47 -0000 1.32
+++ JavaUtils.java 27 Feb 2002 00:12:39 -0000 1.32.2.1
@@ -110,13 +110,14 @@
*/
public static Object convert(Object arg, Class destClass)
{
- if (log.isDebugEnabled()) {
- log.debug( getMessage("convert00",
- arg.getClass().getName(), destClass.getName()));
- }
-
if (destClass == null) {
return arg;
+ }
+
+ if (log.isDebugEnabled()) {
+ String clsName = "null";
+ if (arg != null) clsName = arg.getClass().getName();
+ log.debug( getMessage("convert00", clsName, destClass.getName()));
}
// See if a previously converted value is stored in the argument.
No revision
No revision
1.10.2.1 +71 -53
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaComplexTypeWriter.java
Index: JavaComplexTypeWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaComplexTypeWriter.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- JavaComplexTypeWriter.java 23 Feb 2002 00:48:27 -0000 1.10
+++ JavaComplexTypeWriter.java 27 Feb 2002 00:12:39 -0000 1.10.2.1
@@ -54,24 +54,20 @@
*/
package org.apache.axis.wsdl.toJava;
-import java.io.IOException;
-
-import java.util.Vector;
-
-import javax.wsdl.QName;
-
import org.apache.axis.utils.JavaUtils;
-
import org.w3c.dom.Node;
+import java.io.IOException;
+import java.util.Vector;
+
/**
-* This is Wsdl2java's Complex Type Writer. It writes the <typeName>.java file.
-*/
+ * This is Wsdl2java's Complex Type Writer. It writes the <typeName>.java file.
+ */
public class JavaComplexTypeWriter extends JavaWriter {
private TypeEntry type;
private Vector elements;
private Vector attributes;
- private TypeEntry extendType;
+ private TypeEntry extendType;
/**
* Constructor.
@@ -82,25 +78,25 @@
*/
protected JavaComplexTypeWriter(
Emitter emitter,
- TypeEntry type,
- Vector elements,
+ TypeEntry type,
+ Vector elements,
TypeEntry extendType,
- Vector attributes)
- {
+ Vector attributes) {
super(emitter, type, "", "java",
- JavaUtils.getMessage("genType00"), "complexType");
+ JavaUtils.getMessage("genType00"), "complexType");
this.type = type;
this.elements = elements;
this.attributes = attributes;
this.extendType = extendType;
} // ctor
- /**
+ /**
* Generate the binding for the given complex type.
* The elements vector contains the Types (even indices) and
* element names (odd indices) of the contained elements
*/
protected void writeFileBody() throws IOException {
+ String valueType = null;
Node node = type.getNode();
// See if this class extends another class
@@ -111,23 +107,29 @@
// We are only interested in the java names of the types, so create a names
list
Vector names = new Vector();
- for (int i=0; i < elements.size(); i+=2) {
+ for (int i = 0; i < elements.size(); i += 2) {
names.add(((TypeEntry) elements.get(i)).getName());
- names.add( Utils.xmlNameToJava((String) elements.get(i + 1)));
+ names.add(Utils.xmlNameToJava((String) elements.get(i + 1)));
}
- // add the attributes to the names list (which will be bean elements too)
- if (attributes != null) {
- for (int i=0; i < attributes.size(); i+=2) {
- names.add(((TypeEntry) attributes.get(i)).getName());
- names.add( Utils.xmlNameToJava((String) attributes.get(i + 1)));
- }
- }
-
+ // add the attributes to the names list (which will be bean elements too)
+ if (attributes != null) {
+ for (int i = 0; i < attributes.size(); i += 2) {
+ names.add(((TypeEntry) attributes.get(i)).getName());
+ names.add(Utils.xmlNameToJava((String) attributes.get(i + 1)));
+ }
+ }
+
+ String implementsText = "";
+ if (type.isSimpleType())
+ implementsText = ", org.apache.axis.encoding.SimpleType";
- pw.println("public class " + className + extendsText + " implements
java.io.Serializable {");
+ pw.println("public class " + className + extendsText +
+ " implements java.io.Serializable" + implementsText + " {");
for (int i = 0; i < names.size(); i += 2) {
String variable = (String) names.get(i + 1);
+ if (variable.equals("value"))
+ valueType = (String) names.get(i);
pw.print(" private " + names.get(i) + " " + variable + ";");
// label the attribute fields.
if (i >= elements.size())
@@ -190,26 +192,26 @@
// (It may be more efficient to handle this with an ArrayList...but
// for the initial support it was easier to use an actual array.)
if (i < elements.size() &&
-
((TypeEntry)elements.elementAt(i)).getQName().getLocalPart().indexOf("[")>0) {
+ ((TypeEntry)
elements.elementAt(i)).getQName().getLocalPart().indexOf("[") > 0) {
String compName = typeName.substring(0, typeName.lastIndexOf("["));
int bracketIndex = typeName.indexOf("[");
String newingName = typeName.substring(0, bracketIndex + 1);
String newingSuffix = typeName.substring(bracketIndex + 1);
-
+
pw.println(" public " + compName + " " + get + capName + "(int
i) {");
pw.println(" return " + name + "[i];");
pw.println(" }");
pw.println();
- pw.println(" public void set"+capName+"(int i, "+compName+"
value) {");
+ pw.println(" public void set" + capName + "(int i, " + compName
+ " value) {");
pw.println(" if (" + name + " == null ||");
pw.println(" " + name + ".length <= i) {");
pw.println(" " + typeName + " a = new " +
- newingName + "i + 1" + newingSuffix + ";");
+ newingName + "i + 1" + newingSuffix + ";");
pw.println(" if (" + name + " != null) {");
- pw.println(" for(int j=0; j<"+name+".length; j++)");
- pw.println(" a[j] = "+name+"[j];");
+ pw.println(" for(int j=0; j<" + name + ".length;
j++)");
+ pw.println(" a[j] = " + name + "[j];");
pw.println(" }");
pw.println(" " + name + " = a;");
pw.println(" }");
@@ -219,26 +221,42 @@
}
}
- // if we have attributes, create metadata function which returns the
- // list of properties that are attributes instead of elements
- if (attributes != null) {
- pw.println(" // List of fields that are XML attributes");
- pw.println(" private static java.lang.String[] _attrs = new String[]
{");
- for (int i=0; i < attributes.size(); i+=2) {
- pw.println(" \"" + Utils.xmlNameToJava((String)
attributes.get(i + 1)) + "\", ");
- }
- pw.println(" };");
- pw.println();
-
- pw.println(" /**");
- pw.println(" * Return list of bean field names that are attributes");
- pw.println(" */");
- pw.println(" public static java.lang.String[] getAttributeElements()
{");
- pw.println(" return _attrs;");
- pw.println(" }");
- pw.println();
- }
-
+ // if we have attributes, create metadata function which returns the
+ // list of properties that are attributes instead of elements
+ if (attributes != null) {
+ pw.println(" // List of fields that are XML attributes");
+ pw.println(" private static java.lang.String[] _attrs = new String[]
{");
+ for (int i = 0; i < attributes.size(); i += 2) {
+ pw.println(" \"" + Utils.xmlNameToJava((String)
attributes.get(i + 1)) + "\", ");
+ }
+ pw.println(" };");
+ pw.println();
+
+ pw.println(" /**");
+ pw.println(" * Return list of bean field names that are
attributes");
+ pw.println(" */");
+ pw.println(" public static java.lang.String[] getAttributeElements()
{");
+ pw.println(" return _attrs;");
+ pw.println(" }");
+ pw.println();
+ }
+
+ // if this is a simple type, we need to emit a toString and a string
+ // constructor
+ if (type.isSimpleType() && valueType != null) {
+ // emit contructors and toString().
+ pw.println(" // Simple Types must have a string constructor");
+ pw.println(" public " + className + "(java.lang.String value) {");
+ pw.println(" this.value = new " + valueType + "(value);");
+ pw.println(" }");
+ pw.println();
+ pw.println(" // Simple Types must have a toString for serializing
the value");
+ pw.println(" public String toString() {");
+ pw.println(" return value.toString();");
+ pw.println(" }");
+ pw.println();
+ }
+
pw.println("}");
pw.close();
} // writeOperation
1.11.2.1 +1 -1
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java
Index: JavaImplWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- JavaImplWriter.java 14 Feb 2002 14:59:31 -0000 1.11
+++ JavaImplWriter.java 27 Feb 2002 00:12:40 -0000 1.11.2.1
@@ -154,7 +154,7 @@
// Note that similar code is in JavaTestCaseWriter.
// So please check both places if changes are made.
if (param.mode == Parameter.OUT) {
- pw.print(" " + Utils.xmlNameToJava(param.name)
+ pw.print(" " + Utils.xmlNameToJava(param.getName())
+ ".value = ");
if ( isPrimitiveType(param.type) ) {
if ( "boolean".equals(paramType) ) {
1.13.2.1 +2 -2
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java
Index: JavaSkelWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -r1.13 -r1.13.2.1
--- JavaSkelWriter.java 19 Feb 2002 15:06:52 -0000 1.13
+++ JavaSkelWriter.java 27 Feb 2002 00:12:40 -0000 1.13.2.1
@@ -177,7 +177,7 @@
}
for (int j=0; j < parameters.list.size(); j++) {
Parameter p = (Parameter) parameters.list.get(j);
- pw.println(" \"" + p.name + "\",");
+ pw.println(" \"" + p.getName() + "\",");
}
pw.println(" },");
pw.println(" new javax.xml.rpc.ParameterMode[] {");
@@ -302,7 +302,7 @@
needComma = true;
Parameter p = (Parameter) parms.list.get(i);
- call = call + Utils.xmlNameToJava(p.name);
+ call = call + Utils.xmlNameToJava(p.getName());
}
call = call + ")";
pw.println(call + ";");
1.33.2.1 +30 -12
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
Index: JavaStubWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -r1.33 -r1.33.2.1
--- JavaStubWriter.java 20 Feb 2002 16:49:53 -0000 1.33
+++ JavaStubWriter.java 27 Feb 2002 00:12:40 -0000 1.33.2.1
@@ -391,6 +391,11 @@
type instanceof CollectionType) {
return;
}
+
+ if (type instanceof Element) {
+ return;
+ }
+
if ( firstSer ) {
pw.println(" Class cls;" );
pw.println(" javax.xml.rpc.namespace.QName qName;" );
@@ -400,6 +405,8 @@
pw.println(" Class enumdf =
org.apache.axis.encoding.ser.EnumDeserializerFactory.class;");
pw.println(" Class arraysf =
org.apache.axis.encoding.ser.ArraySerializerFactory.class;");
pw.println(" Class arraydf =
org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;");
+ pw.println(" Class simplesf =
org.apache.axis.encoding.ser.SimpleNonPrimitiveSerializerFactory.class;");
+ pw.println(" Class simpledf =
org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;");
}
firstSer = false ;
@@ -418,6 +425,9 @@
type.getNode(), emitter.getSymbolTable()) != null) {
pw.println(" cachedSerFactories.add(enumsf);");
pw.println(" cachedDeserFactories.add(enumdf);");
+ } else if (type.isSimpleType()) {
+ pw.println(" cachedSerFactories.add(simplesf);");
+ pw.println(" cachedDeserFactories.add(simpledf);");
} else {
pw.println(" cachedSerFactories.add(beansf);");
pw.println(" cachedDeserFactories.add(beandf);");
@@ -451,14 +461,22 @@
String typeString = "new javax.xml.rpc.namespace.QName(\"" +
qn.getNamespaceURI() + "\", \"" +
qn.getLocalPart() + "\")";
+ QName paramQName = p.getQName();
+ String qnName = "p" + i + "QName";
+ pw.println(" javax.xml.rpc.namespace.QName " + qnName + " = new
javax.xml.rpc.namespace.QName(\"" +
+ paramQName.getNamespaceURI() + "\", \"" +
+ paramQName.getLocalPart() + "\");");
if (p.mode == Parameter.IN) {
- pw.println(" call.addParameter(\"" + p.name + "\", " +
typeString + ", javax.xml.rpc.ParameterMode.PARAM_MODE_IN);");
+ pw.println(" call.addParameter(" + qnName + ", "
+ + typeString + ",
javax.xml.rpc.ParameterMode.PARAM_MODE_IN);");
}
else if (p.mode == Parameter.INOUT) {
- pw.println(" call.addParameter(\"" + p.name + "\", " +
typeString + ", javax.xml.rpc.ParameterMode.PARAM_MODE_INOUT);");
+ pw.println(" call.addParameter(" + qnName + ", "
+ + typeString + ",
javax.xml.rpc.ParameterMode.PARAM_MODE_INOUT);");
}
else { // p.mode == Parameter.OUT
- pw.println(" call.addParameter(\"" + p.name + "\", " +
typeString + ", javax.xml.rpc.ParameterMode.PARAM_MODE_OUT);");
+ pw.println(" call.addParameter(" + qnName + ", "
+ + typeString + ",
javax.xml.rpc.ParameterMode.PARAM_MODE_OUT);");
}
}
// set output type
@@ -512,7 +530,7 @@
for (int i = 0; i < parms.list.size(); ++i) {
Parameter p = (Parameter) parms.list.get(i);
- String javifiedName = Utils.xmlNameToJava(p.name);
+ String javifiedName = Utils.xmlNameToJava(p.getName());
if (p.mode != Parameter.OUT) {
if (needComma) {
pw.print(", ");
@@ -547,7 +565,7 @@
while (p.mode != Parameter.INOUT) {
p = (Parameter) parms.list.get(++i);
}
- String javifiedName = Utils.xmlNameToJava(p.name);
+ String javifiedName = Utils.xmlNameToJava(p.getName());
pw.println(" java.util.Map output;");
pw.println(" output = call.getOutputParams();");
// If expecting an array, need to call convert(..) because
@@ -560,13 +578,13 @@
pw.println(" " + javifiedName
+ ".value = (" + p.type.getName()
+ ")
org.apache.axis.utils.JavaUtils.convert(output.get(\""
- + p.name + "\"), " + p.type.getName()
+ + p.getName() + "\"), " + p.type.getName()
+ ".class);");
}
else {
pw.println(" " + javifiedName + ".value = "
+ getResponseString(p.type,
- "output.get(\"" + p.name + "\")"));
+ "output.get(\"" + p.getName() + "\")"));
}
}
else {
@@ -598,7 +616,7 @@
boolean firstInoutIsResp = (parms.outputs == 0);
for (int i = 0; i < parms.list.size (); ++i) {
Parameter p = (Parameter) parms.list.get (i);
- String javifiedName = Utils.xmlNameToJava(p.name);
+ String javifiedName = Utils.xmlNameToJava(p.getName());
if (p.mode != Parameter.IN) {
if (firstInoutIsResp) {
firstInoutIsResp = false;
@@ -609,13 +627,13 @@
pw.println(" // REVISIT THIS!");
pw.println (" " + javifiedName
+ ".value = (" + p.type.getName()
- + ")
org.apache.axis.utils.JavaUtils.convert(output.get(\"" + p.name + "\"), "
+ + ")
org.apache.axis.utils.JavaUtils.convert(output.get(\"" + p.getName() + "\"), "
+ p.type.getName() + ".class);");
}
else {
pw.println (" " + javifiedName +
".value = " +
- getResponseString(p.type,
"output.get(\"" + p.name + "\")"));
+ getResponseString(p.type,
"output.get(\"" + p.getName() + "\")"));
}
}
else {
@@ -627,13 +645,13 @@
pw.println (" " + javifiedName
+ ".value = (" + p.type.getName()
+ ")
org.apache.axis.utils.JavaUtils.convert("
- + "output.get(\"" + p.name + "\"), "
+ + "output.get(\"" + p.getName() + "\"),
"
+ p.type.getName() + ".class);");
}
else {
pw.println (" " + javifiedName
+ ".value = " +
getResponseString(p.type,
- "output.get(\"" + p.name + "\")"));
+ "output.get(\"" + p.getName() + "\")"));
}
}
}
1.15.2.1 +1 -1
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java
Index: JavaWriterFactory.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- JavaWriterFactory.java 20 Feb 2002 17:17:36 -0000 1.15
+++ JavaWriterFactory.java 27 Feb 2002 00:12:40 -0000 1.15.2.1
@@ -463,7 +463,7 @@
needComma = true;
}
- String javifiedName = Utils.xmlNameToJava(p.name);
+ String javifiedName = Utils.xmlNameToJava(p.getName());
if (p.mode == Parameter.IN) {
signature = signature + p.type.getName() + " " + javifiedName;
}
1.2.4.1 +19 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/Parameter.java
Index: Parameter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Parameter.java,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -r1.2 -r1.2.4.1
--- Parameter.java 13 Dec 2001 17:33:17 -0000 1.2
+++ Parameter.java 27 Feb 2002 00:12:40 -0000 1.2.4.1
@@ -54,6 +54,7 @@
*/
package org.apache.axis.wsdl.toJava;
+import javax.wsdl.QName;
import java.util.Vector;
/**
@@ -66,12 +67,28 @@
public static final byte OUT = 2;
public static final byte INOUT = 3;
- public String name;
+ private QName name;
public TypeEntry type;
public byte mode = IN;
public String toString() {
- return "(" + type + ", " + name + ", "
+ return "(" + type + ", " + getName() + ", "
+ (mode == IN ? "IN)" : mode == INOUT ? "INOUT)" : "OUT)");
} // toString
+
+ public QName getQName() {
+ return name;
+ }
+
+ public String getName() {
+ return name.getLocalPart();
+ }
+
+ public void setName(String name) {
+ this.name = new QName("", name);
+ }
+
+ public void setQName(QName name) {
+ this.name = name;
+ }
} // class Parameter
1.10.2.1 +120 -33 xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java
Index: SchemaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- SchemaUtils.java 21 Feb 2002 18:51:23 -0000 1.10
+++ SchemaUtils.java 27 Feb 2002 00:12:40 -0000 1.10.2.1
@@ -118,17 +118,21 @@
nodeKind.getLocalPart().equals("complexType") &&
Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
- // Under the complexType there could be complexContent &
- // extension elements if this is a derived type. Skip over these.
+ // Under the complexType there could be complexContent/simpleContent
+ // and extension elements if this is a derived type. Skip over these.
NodeList children = node.getChildNodes();
Node complexContent = null;
+ Node simpleContent = null;
Node extension = null;
for (int j = 0; j < children.getLength() && complexContent == null;
j++) {
QName complexContentKind = Utils.getNodeQName(children.item(j));
if (complexContentKind != null &&
- complexContentKind.getLocalPart().equals("complexContent") &&
- Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
- complexContent = children.item(j);
+ Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
+ if (complexContentKind.getLocalPart().equals("complexContent") )
+ complexContent = children.item(j);
+ else if
(complexContentKind.getLocalPart().equals("simpleContent"))
+ simpleContent = children.item(j);
+ }
}
if (complexContent != null) {
children = complexContent.getChildNodes();
@@ -140,11 +144,33 @@
extension = children.item(j);
}
}
+ if (simpleContent != null) {
+ children = simpleContent.getChildNodes();
+ for (int j = 0; j < children.getLength() && extension == null; j++)
{
+ QName extensionKind = Utils.getNodeQName(children.item(j));
+ if (extensionKind != null &&
+ extensionKind.getLocalPart().equals("extension") &&
+ Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
+
+ // get the type of the extension
+ QName extendsType =
+ Utils.getNodeTypeRefQName(children.item(j),
+ "base");
+ Vector v = new Vector();
+ v.add(symbolTable.getTypeEntry(extendsType, false));
+ v.add("value"); // A fixed, implementation specific name
+
+ // done
+ return v;
+ }
+
+ }
+
+ }
if (extension != null) {
node = extension; // Skip over complexContent and extension
}
-
// Under the complexType (or extension) there should be a sequence or
all group node.
// (There may be other #text nodes, which we will ignore).
children = node.getChildNodes();
@@ -159,6 +185,7 @@
}
if (groupNode == null) {
+ // didn't find anything
return new Vector();
}
if (groupNode != null) {
@@ -568,7 +595,8 @@
QName kind2 = Utils.getNodeQName(children.item(j));
if (kind2 != null &&
(kind2.getLocalPart().equals("simpleType") ||
- kind2.getLocalPart().equals("complexType")) &&
+ kind2.getLocalPart().equals("complexType") ||
+ kind2.getLocalPart().equals("simpleContent")) &&
Constants.isSchemaXSD(kind2.getNamespaceURI())) {
node2 = children.item(j);
node = node2;
@@ -590,7 +618,8 @@
for (int j = 0; j < children.getLength() && complexContent == null;
j++) {
QName complexContentKind = Utils.getNodeQName(children.item(j));
if (complexContentKind != null &&
- complexContentKind.getLocalPart().equals("complexContent")
&&
+ (complexContentKind.getLocalPart().equals("complexContent")
||
+
complexContentKind.getLocalPart().equals("simpleContent"))&&
Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
complexContent = children.item(j);
}
@@ -726,7 +755,8 @@
for (int j = 0; j < children.getLength() && complexContentNode == null;
j++) {
QName complexContentKind = Utils.getNodeQName(children.item(j));
if (complexContentKind != null &&
- complexContentKind.getLocalPart().equals("complexContent") &&
+ (complexContentKind.getLocalPart().equals("complexContent") ||
+ complexContentKind.getLocalPart().equals("simpleContent")) &&
Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
complexContentNode = children.item(j);
}
@@ -876,33 +906,90 @@
if (node == null) {
return null;
}
-
- // examine children of the node for <attribute> elements
- NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- QName nodeKind = Utils.getNodeQName(child);
- if (nodeKind == null ||
- ! nodeKind.getLocalPart().equals("attribute"))
- continue;
+ // Check for SimpleContent
+ // If the node kind is an element, dive into it.
+ QName nodeKind = Utils.getNodeQName(node);
+ if (nodeKind != null &&
+ nodeKind.getLocalPart().equals("element") &&
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
+ NodeList children = node.getChildNodes();
+ Node complexNode = null;
+ for (int j = 0; j < children.getLength() && complexNode == null; j++) {
+ QName complexKind = Utils.getNodeQName(children.item(j));
+ if (complexKind != null &&
+ complexKind.getLocalPart().equals("complexType") &&
+ Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
+ complexNode = children.item(j);
+ node = complexNode;
+ }
+ }
+ }
+
+ // Expecting a schema complexType
+ nodeKind = Utils.getNodeQName(node);
+ if (nodeKind != null &&
+ nodeKind.getLocalPart().equals("complexType") &&
+ Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
+
+ // Under the complexType there could be complexContent/simpleContent
+ // and extension elements if this is a derived type. Skip over these.
+ NodeList children = node.getChildNodes();
+ Node content = null;
+ Node extension = null;
+ for (int j = 0; j < children.getLength() && content == null; j++) {
+ QName complexContentKind = Utils.getNodeQName(children.item(j));
+ if (complexContentKind != null &&
+ Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
+ if (complexContentKind.getLocalPart().equals("complexContent")
||
+ complexContentKind.getLocalPart().equals("simpleContent")) {
+ content = children.item(j);
+ }
+ }
+ }
+ // Check for extensions
+ if (content != null) {
+ children = content.getChildNodes();
+ for (int j = 0; j < children.getLength(); j++) {
+ QName extensionKind = Utils.getNodeQName(children.item(j));
+ if (extensionKind != null &&
+ extensionKind.getLocalPart().equals("extension") &&
+ Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
{
+ extension = children.item(j);
+ break;
+ }
+ }
+ }
- // we have an attribute node
- if (v == null)
- v = new Vector();
+ if (extension != null) {
+ node = extension;
+ }
- // type
- QName typeAttr = Utils.getNodeTypeRefQName(child, "type");
- TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
- // name
- QName name = Utils.getNodeNameQName(child);
- // add type and name to vector, skip it if we couldn't parse it
- // XXX - this may need to be revisited.
- if (type != null && name != null) {
- v.add(type);
- v.add(name.getLocalPart());
+ // examine children of the node for <attribute> elements
+ children = node.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ nodeKind = Utils.getNodeQName(child);
+ if (nodeKind == null ||
+ ! nodeKind.getLocalPart().equals("attribute"))
+ continue;
+
+ // we have an attribute node
+ if (v == null)
+ v = new Vector();
+
+ // type
+ QName typeAttr = Utils.getNodeTypeRefQName(child, "type");
+ TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
+ // name
+ QName name = Utils.getNodeNameQName(child);
+ // add type and name to vector, skip it if we couldn't parse it
+ // XXX - this may need to be revisited.
+ if (type != null && name != null) {
+ v.add(type);
+ v.add(name.getLocalPart());
+ }
}
- }
-
+ }
return v;
}
1.35.2.1 +28 -14 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java
Index: SymbolTable.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -r1.35 -r1.35.2.1
--- SymbolTable.java 21 Feb 2002 20:02:20 -0000 1.35
+++ SymbolTable.java 27 Feb 2002 00:12:40 -0000 1.35.2.1
@@ -518,9 +518,10 @@
QName nodeKind = Utils.getNodeQName(node);
if (nodeKind != null) {
- if ((nodeKind.getLocalPart().equals("complexType") ||
- nodeKind.getLocalPart().equals("simpleType")) &&
- Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
+ String localPart = nodeKind.getLocalPart();
+ boolean isXSD = Constants.isSchemaXSD(nodeKind.getNamespaceURI());
+ if ((isXSD && localPart.equals("complexType") ||
+ localPart.equals("simpleType"))) {
// If an extension or restriction is present,
// create a type for the reference
@@ -534,8 +535,7 @@
// Create a Type.
createTypeFromDef(node, false, false);
}
- else if (nodeKind.getLocalPart().equals("element") &&
- Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
+ else if (isXSD && localPart.equals("element")) {
// If the element has a type/ref attribute, create
// a Type representing the referenced type.
if (Utils.getAttribute(node, "type") != null ||
@@ -556,14 +556,20 @@
// and element=.
createTypeFromDef(node, true, level > SCHEMA_LEVEL);
}
- else if (nodeKind.getLocalPart().equals("part") &&
+ else if (localPart.equals("part") &&
Constants.isWSDL(nodeKind.getNamespaceURI())) {
// This is a wsdl part. Create an TypeEntry representing the
reference
createTypeFromRef(node);
}
- else if (nodeKind.getLocalPart().equals("attribute") &&
- Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
+ else if (isXSD && localPart.equals("simpleContent")) {
+ // need to mark parent as a simple type
+ Node parent = node.getParentNode();
+ QName parentQName = Utils.getNodeNameQName(parent);
+ TypeEntry te = getTypeEntry(parentQName, false);
+ te.setSimpleType(true);
+ }
+ else if (isXSD && localPart.equals("attribute")) {
// we can no longer do .NET stuff and treat document as rpc style
this.dotNet = false;
// Create symbol table entry for attribute type
@@ -572,9 +578,8 @@
TypeEntry refType = getTypeEntry(refQName, false);
if (refType == null) {
// Not defined yet, add one
- // XXX This check is too basic, we need to handle
- // XXX <simpleType> types also.
- // XXX <simpleType> types also.
+ // TODO: This check is too basic, we need to handle
+ // <simpleType> types also.
String baseName = btm.getBaseName(refQName);
if (baseName != null) {
BaseType bt = new BaseType(refQName);
@@ -1000,8 +1005,15 @@
*/
private void addInishParm(Vector inputs, Vector outputs, int index, int outdex,
Parameters parameters, boolean trimInput) {
Parameter p = new Parameter();
- p.name = (String) inputs.get(index);
p.type = (TypeEntry) inputs.get(index - 1);
+ // If this is an element, we want the XML to reflect the element name
+ // not the part name.
+ if (p.type instanceof DefinedElement) {
+ DefinedElement de = (DefinedElement)p.type;
+ p.setQName(de.getQName());
+ } else {
+ p.setName((String) inputs.get(index));
+ }
// Should we remove the given parameter type/name entries from the Vector?
if (trimInput) {
@@ -1029,7 +1041,7 @@
*/
private void addOutParm(Vector outputs, int outdex, Parameters parameters,
boolean trim) {
Parameter p = new Parameter();
- p.name = (String) outputs.get(outdex);
+ p.setName((String) outputs.get(outdex));
p.type = (TypeEntry) outputs.get(outdex - 1);
if (trim) {
outputs.remove(outdex);
@@ -1061,12 +1073,14 @@
} else if (elementName != null) {
// Just an FYI: The WSDL spec says that for use=encoded
// that parts reference an abstract type using the type attr
- // but we do the right thing here, so let it go.
+ // but we kinda do the right thing here, so let it go.
v.add(getElement(elementName));
v.add(part.getName());
}
continue; // next part
}
+
+ // flow to here means literal use (no encoding)
// See if we can map all the XML types to java types
// if we can, we use these as the types
1.7.2.1 +9 -0 xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java
Index: TypeEntry.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/TypeEntry.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- TypeEntry.java 5 Feb 2002 22:42:35 -0000 1.7
+++ TypeEntry.java 27 Feb 2002 00:12:40 -0000 1.7.2.1
@@ -125,6 +125,7 @@
// until the Undefined type is found.
protected boolean isBaseType;// Indicates if represented by a
// java primitive or util class
+ protected boolean isSimpleType = false; // Indicates if this type is a simple
type
protected boolean onlyLiteralReference = false; // Indicates
// whether this type is only referenced
// via a binding's literal use.
@@ -201,6 +202,14 @@
else {
return null;
}
+ }
+
+ public boolean isSimpleType() {
+ return isSimpleType;
+ }
+
+ public void setSimpleType(boolean simpleType) {
+ isSimpleType = simpleType;
}
/**
1.15.2.1 +11 -5 xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- Utils.java 15 Feb 2002 19:41:17 -0000 1.15
+++ Utils.java 27 Feb 2002 00:12:40 -0000 1.15.2.1
@@ -381,13 +381,19 @@
if (minOccursValue == null) {
minOccursValue = "1";
}
- if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
+ if (minOccursValue.equals("0") && maxOccursValue.equals("1")) {
+ // If we have a minoccurs="0"/maxoccurs="1", this is just
+ // like a nillable single value, so treat it as such.
+ qName = getNillableQName(qName);
+ } else if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
String localPart = qName.getLocalPart();
- localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
+// localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
+// qName.setLocalPart(localPart);
+// String namespace = getScopedAttribute(node, "targetNamespace");
+// if (namespace != null)
+// qName.setNamespaceURI(namespace);
+ localPart += "[" + maxOccursValue + "]";
qName.setLocalPart(localPart);
- String namespace = getScopedAttribute(node, "targetNamespace");
- if (namespace != null)
- qName.setNamespaceURI(namespace);
}
}
No revision
No revision
1.80.2.1 +2 -2 xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml
Index: Wsdl2javaTestSuite.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaTestSuite.xml,v
retrieving revision 1.80
retrieving revision 1.80.2.1
diff -u -r1.80 -r1.80.2.1
--- Wsdl2javaTestSuite.xml 26 Feb 2002 22:59:30 -0000 1.80
+++ Wsdl2javaTestSuite.xml 27 Feb 2002 00:12:40 -0000 1.80.2.1
@@ -366,7 +366,7 @@
</wsdl2java>
<!-- More information at: http://www.whitemesa.net/ -->
- <wsdl2java url="http://www.whitemesa.net/wsdl/std/echoheadersvc.wsdl"
+<!-- <wsdl2java url="http://www.whitemesa.com/wsdl/std/echoheadersvc.wsdl"
output="build/work"
testcase="no"
deployscope="none"
@@ -376,7 +376,7 @@
<mapping namespace="http://soapinterop.org/"
package="interop.echoheadersvc"/>
<mapping namespace="http://soapinterop.org/xsd"
package="interop.echoheadersvc"/>
</wsdl2java>
-
+-->
<!-- http://www.mssoapinterop.org/stk/roundBC.htm -->
<wsdl2java url="http://mssoapinterop.org/stk/InteropB.wsdl"
output="build/work"
No revision
No revision
1.11.2.1 +1 -2 xml-axis/java/test/wsdl/types/VerifyTestCase.java
Index: VerifyTestCase.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/VerifyTestCase.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -r1.11 -r1.11.2.1
--- VerifyTestCase.java 26 Feb 2002 22:59:30 -0000 1.11
+++ VerifyTestCase.java 27 Feb 2002 00:12:40 -0000 1.11.2.1
@@ -222,8 +222,7 @@
} catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception
caught: " + re );
}
- String[] strValue = new String[] {"abc", "def"};
- String[][] optArray = new String[][] {strValue};
+ String[] optArray = new String[] {"abc", "def"};
byte[][] byteArray = new byte[][] { new byte[] {'a', 'b', 'c'}, new byte[]
{'x', 'y', 'z'} };
B b = new B();
A a = new A();