Author: darran.lofthouse(a)jboss.com
Date: 2006-12-16 17:18:42 -0500 (Sat, 16 Dec 2006)
New Revision: 1662
Modified:
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java
branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_W/wstools-config.xml
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Y/wrapped-mapping.xml
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Z/wrapped-mapping.xml
Log:
JBWS-1260 - Further fixes to unwrapping and tests, remaining failures are where we do not
agree with the wscompile approach.
Modified: branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
---
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2006-12-16
22:18:42 UTC (rev 1662)
@@ -400,12 +400,7 @@
XSParticle particle = wrapper.getParticle();
if (particle == null)
{
- if (appendedAttribute)
- {
- buf.append(tempBuf);
- }
-
- return true;
+ unwrappedElement = true;
}
else
{
@@ -597,7 +592,12 @@
if (unwrapper.unwrappedElement != null)
{
xt = unwrapper.unwrappedElement.getTypeDefinition();
+
+ if (unwrapper.xmlType != null)
+ xmlType = unwrapper.xmlType;
+
containingElement = containingElement +
unwrapper.unwrappedElement.getName();
+
if (unwrapper.array)
arraySuffix = "[]";
}
Modified:
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
---
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2006-12-16
22:18:42 UTC (rev 1662)
@@ -260,6 +260,10 @@
{
xmlType = new QName(containingElement);
}
+ else if (unwrapper.xmlType != null)
+ {
+ xmlType = unwrapper.xmlType;
+ }
}
else if (unwrapper.unwrappedAttribute != null)
{
@@ -550,8 +554,7 @@
temp.append(">").append(name);
localName = temp.toString();
jxtm.setAnonymousTypeQName(new QName(xt.getNamespace(), localName,
"typeNS"));
-
-
+
}
else
{
@@ -574,6 +577,11 @@
jwm.addJavaXmlTypeMappings(jxtm);
// addJavaXMLTypeMapping(jwm, jxtm
+ // Add attributes
+ XSObjectList attributeUses =
((XSComplexTypeDefinition)xc).getAttributeUses();
+ if (attributeUses != null)
+ addAttributeMappings(attributeUses, jxtm);
+
if (xm != null)
{
addVariableMappingMap(xm, jxtm, javaType);
@@ -586,10 +594,6 @@
addJavaXMLTypeMap(simple, xc.getName(), "", "", jwm,
skipWrapperArray);
}
- // Add attributes
- XSObjectList attributeUses =
((XSComplexTypeDefinition)xc).getAttributeUses();
- if (attributeUses != null)
- addAttributeMappings(attributeUses, jxtm);
}
if (xm != null)
Modified:
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java
===================================================================
---
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java 2006-12-16
22:18:42 UTC (rev 1662)
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.tools.helpers;
+import javax.xml.namespace.QName;
+
import org.apache.xerces.xs.XSAttributeDeclaration;
import org.apache.xerces.xs.XSAttributeUse;
import org.apache.xerces.xs.XSComplexTypeDefinition;
@@ -43,6 +45,7 @@
{
public XSTypeDefinition xt;
+ public QName xmlType;
public XSAttributeDeclaration unwrappedAttribute;
public XSElementDeclaration unwrappedElement;
public boolean array = false;
@@ -102,6 +105,10 @@
else if (term instanceof XSElementDeclaration)
{
unwrappedElement = (XSElementDeclaration)term;
+ XSTypeDefinition type = unwrappedElement.getTypeDefinition();
+ if (type.getAnonymous() == false)
+ xmlType = new QName(unwrappedElement.getTypeDefinition().getNamespace(),
unwrappedElement.getTypeDefinition().getName());
+
this.array = array;
}
Modified:
branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java
===================================================================
---
branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/test/java/org/jboss/test/ws/tools/validation/JaxrpcMappingValidator.java 2006-12-16
22:18:42 UTC (rev 1662)
@@ -205,12 +205,25 @@
{
bool = validateVariableMapping(vm1[i], vm2[i]);
if (bool == false)
- throw new IllegalStateException("VariableMapping" + vm1[i] + "
does not match with " + vm2[i]);
+ throw new IllegalStateException("VariableMapping " +
variableMappingToString(vm1[i]) + " does not match with " +
variableMappingToString(vm2[i]));
}
return bool;
}
+ private String variableMappingToString(VariableMapping vm)
+ {
+ StringBuffer sb = new StringBuffer("[");
+ sb.append("JavaVariableName=").append(vm.getJavaVariableName());
+ sb.append(",XmlAttributeName=").append(vm.getXmlAttributeName());
+ sb.append(",XmlElementName=").append(vm.getXmlElementName());
+ sb.append(",XmlWildcard=").append(vm.getXmlWildcard());
+ sb.append(",DataMember=").append(vm.isDataMember());
+ sb.append("]");
+
+ return sb.toString();
+ }
+
private boolean validateVariableMapping(VariableMapping vm1, VariableMapping vm2)
{
boolean bool = true;
Modified:
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_W/wstools-config.xml
===================================================================
---
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_W/wstools-config.xml 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_W/wstools-config.xml 2006-12-16
22:18:42 UTC (rev 1662)
@@ -1,5 +1,5 @@
<configuration>
<wsdl-java location="resources/tools/jbws1260/scenario_W/Wrapped.wsdl"
parameter-style="wrapped">
- <!--mapping file="wrapped-mapping.xml"/-->
+ <mapping file="wrapped-mapping.xml"/>
</wsdl-java>
</configuration>
Modified:
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Y/wrapped-mapping.xml
===================================================================
---
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Y/wrapped-mapping.xml 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Y/wrapped-mapping.xml 2006-12-16
22:18:42 UTC (rev 1662)
@@ -44,16 +44,19 @@
<xml-element-name>surname</xml-element-name>
</variable-mapping>
</java-xml-type-mapping>
- <java-xml-type-mapping>
+
+ <!-- Anonymous wrapping of arrays not required for JBossWS -->
+ <!--java-xml-type-mapping>
<java-type>org.jboss.test.ws.jbws1260.Telephone[]</java-type>
<
anonymous-type-qname>http://test.jboss.org/ws/jbws1260/types:>l...
<qname-scope>complexType</qname-scope>
- </java-xml-type-mapping>
- <java-xml-type-mapping>
+ </java-xml-type-mapping-->
+ <!--java-xml-type-mapping>
<java-type>org.jboss.test.ws.jbws1260.Name[]</java-type>
<
anonymous-type-qname>http://test.jboss.org/ws/jbws1260/types:>l...
<qname-scope>complexType</qname-scope>
- </java-xml-type-mapping>
+ </java-xml-type-mapping-->
+
<service-interface-mapping>
<service-interface>org.jboss.test.ws.jbws1260.PhoneBook_Service</service-interface>
<wsdl-service-name
xmlns:serviceNS="http://test.jboss.org/ws/jbws1260">serviceN...
Modified:
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Z/wrapped-mapping.xml
===================================================================
---
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Z/wrapped-mapping.xml 2006-12-16
18:01:08 UTC (rev 1661)
+++
branches/dlofthouse/JBWS-1260/src/test/resources/tools/jbws1260/scenario_Z/wrapped-mapping.xml 2006-12-16
22:18:42 UTC (rev 1662)
@@ -44,16 +44,19 @@
<xml-element-name>surname</xml-element-name>
</variable-mapping>
</java-xml-type-mapping>
- <java-xml-type-mapping>
+
+ <!-- Anonymous wrapping of arrays not required for JBossWS -->
+ <!--java-xml-type-mapping>
<java-type>org.jboss.test.ws.jbws1260.Telephone[]</java-type>
<
anonymous-type-qname>http://test.jboss.org/ws/jbws1260/types:Telephone...
<qname-scope>complexType</qname-scope>
- </java-xml-type-mapping>
- <java-xml-type-mapping>
+ </java-xml-type-mapping-->
+ <!--java-xml-type-mapping>
<java-type>org.jboss.test.ws.jbws1260.Name[]</java-type>
<
anonymous-type-qname>http://test.jboss.org/ws/jbws1260/types:Person&am...
<qname-scope>complexType</qname-scope>
- </java-xml-type-mapping>
+ </java-xml-type-mapping-->
+
<service-interface-mapping>
<service-interface>org.jboss.test.ws.jbws1260.PhoneBook_Service</service-interface>
<wsdl-service-name
xmlns:serviceNS="http://test.jboss.org/ws/jbws1260">serviceN...