AXISCPP-1092 Generated code for attribute with no type assigned fails to compile
diff --git a/src/wsdl/org/apache/axis/wsdl/symbolTable/CContainedAttribute.java b/src/wsdl/org/apache/axis/wsdl/symbolTable/CContainedAttribute.java
index 9a5f66e..34c4e69 100644
--- a/src/wsdl/org/apache/axis/wsdl/symbolTable/CContainedAttribute.java
+++ b/src/wsdl/org/apache/axis/wsdl/symbolTable/CContainedAttribute.java
@@ -22,6 +22,10 @@
import org.apache.axis.wsdl.symbolTable.SymbolTable;
import org.apache.axis.wsdl.wsdl2ws.info.Type;
+/**
+ *
+ *
+ */
public class CContainedAttribute
{
/** Field qname - the qname. Immutable, no setter for it. */
@@ -38,6 +42,12 @@
/** Field optional - is attribute optional? */
private boolean optional = false;
+
+ /** Field fixedValue - corresponds to fixed attribute value */
+ private String fixedValue = null;
+
+ /** Field defaultValue - corresponds to default attribute value */
+ private String defaultValue = null;
protected CContainedAttribute(TypeEntry typeEntry, QName qname) {
this.qname = qname;
@@ -76,4 +86,31 @@
return optional;
}
+ /**
+ * @param s fixed value
+ */
+ public void setFixedValue(String s) {
+ fixedValue = s;
+ }
+
+ /**
+ * @return the fixedValue
+ */
+ public String getFixedValue() {
+ return fixedValue;
+ }
+
+ /**
+ * @param s default value
+ */
+ public void setDefaultValue(String s) {
+ defaultValue = s;
+ }
+
+ /**
+ * @return the default value if there is one, or null;
+ */
+ public String getDefaultValue() {
+ return defaultValue;
+ }
}
diff --git a/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java b/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
index 828c529..9427285 100644
--- a/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
+++ b/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
@@ -1717,10 +1717,17 @@
CContainedAttribute attr = new CContainedAttribute(type, attributeName);
String useValue = Utils.getAttribute(child, "use");
-
if (useValue != null)
attr.setOptional(useValue.equalsIgnoreCase("optional"));
-
+
+ String fixedValue = Utils.getAttribute(child, "fixed");
+ if (fixedValue != null)
+ attr.setFixedValue(fixedValue);
+
+ String defaultValue = Utils.getAttribute(child, "default");
+ if (defaultValue != null)
+ attr.setDefaultValue(defaultValue);
+
v.add(attr);
}
}
diff --git a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
index 74af83b..0176a38 100644
--- a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
+++ b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
@@ -877,6 +877,15 @@
public static String getDeserializerMethodName(String typeName, boolean isAttrib)
{
String methodname = (String)c_simpleTypeToMethodSuffixMapper.get(typeName);
+
+ // for attributes that are not defined with a type, just treat as string. Here
+ // is an example:
+ // <s:attribute fixed="http://tempuri.org/DStruttura.xsd" name="namespace" />
+ // The above translates to anyType, but since we do not have such a method
+ // for attributes, just treat as a string.
+ if (isAttrib && methodname.equals("AnyType"))
+ methodname = "String";
+
methodname = (isAttrib ? c_getAttributeAs : c_getElementAs) + methodname;
return methodname;
}
diff --git a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
index 54bb225..e91ddbc 100644
--- a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
+++ b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/ParamWriter.java
@@ -142,7 +142,9 @@
this.attribs[i].setType(attr.getType());
this.attribs[i].setAttribute(true);
this.attribs[i].setElementName(attr.getType().getName());
- this.attribs[i].setOptional(attr.isOptional());
+ this.attribs[i].setOptional(attr.isOptional());
+ this.attribs[i].setAttributeFixedValue(attr.getFixedValue());
+ this.attribs[i].setAttributeDefaultValue(attr.getDefaultValue());
}
for (int i = intAttrFieldSz; i < intAttrFieldSz + intEleFieldSz; i++)
diff --git a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java
index d6424b7..c01250c 100644
--- a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java
+++ b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java
@@ -682,9 +682,8 @@
c_writer.write(tab2 + "param->"
+ attribs[i].getParamNameAsMember() + " = "
+ "axiscSoapDeSerializer"
- + CUtils.getDeserializerMethodName(
- attribs[i].getTypeName(), attribs[i].isAttribute()) + "(pDZ, \""
- + soapTagName + "\",0);\n");
+ + CUtils.getDeserializerMethodName(attribs[i].getTypeName(), attribs[i].isAttribute())
+ + "(pDZ, \"" + soapTagName + "\",0);\n");
}
else
{
diff --git a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
index 9785f48..bc22c65 100644
--- a/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
+++ b/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
@@ -41,7 +41,9 @@
private boolean isAttribute = false;
private boolean isNillable = false;
private boolean isOptional = false;
-
+ private String attributeDefaultValue = null;
+ private String attributeFixedValue = null;
+
private boolean isSimpleType = true;
private int maxOccurs = 1;
@@ -361,4 +363,36 @@
{
this.minOccurs = minOccurs;
}
+
+ /**
+ * @return default or fixed attribute value
+ */
+ public String getAttributeDefaultValue()
+ {
+ return attributeDefaultValue;
+ }
+
+ /**
+ * @param s attribute default or fixed value
+ */
+ public void setAttributeDefaultValue(String s)
+ {
+ attributeDefaultValue = s;
+ }
+
+ /**
+ * @return default or fixed attribute value
+ */
+ public String getAttributeFixedValue()
+ {
+ return attributeFixedValue;
+ }
+
+ /**
+ * @param s attribute default or fixed value
+ */
+ public void setAttributeFixedValue(String s)
+ {
+ attributeFixedValue = s;
+ }
}