Author: darran.lofthouse(a)jboss.com
Date: 2007-09-11 07:59:59 -0400 (Tue, 11 Sep 2007)
New Revision: 4542
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/java/org/jboss/test/ws/tools/jbws1801/
stack/native/branches/dlofthouse/JBWS-1801/src/test/java/org/jboss/test/ws/tools/jbws1801/JBWS1801TestCase.java
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/Person.java
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook.wsdl
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook_PortType.java
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/TelephoneNumber.java
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/jaxrpc-mapping.xml
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/wstools-config.xml
Modified:
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
Log:
Fix and test case.
Modified:
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-09-11
11:55:45 UTC (rev 4541)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/core/soap/SOAPBodyImpl.java 2007-09-11
11:59:59 UTC (rev 4542)
@@ -38,7 +38,6 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.wsf.common.DOMUtils;
-import org.w3c.dom.Comment;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
@@ -271,11 +270,7 @@
private static boolean needsConversionToBodyElement(Node newChild)
{
// JBCTS-440 #addTextNodeTest1 appends a Text node to a SOAPBody
- boolean validChild = newChild instanceof SOAPBodyElement;
- validChild = validChild || newChild instanceof DocumentFragment;
- validChild = validChild || newChild instanceof Text;
- validChild = validChild || newChild instanceof Comment;
- return validChild == false;
+ return !(newChild instanceof SOAPBodyElement || newChild instanceof
DocumentFragment || newChild instanceof Text);
}
private static SOAPBodyElementDoc convertToBodyElement(Node node)
Modified:
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-09-11
11:55:45 UTC (rev 4541)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2007-09-11
11:59:59 UTC (rev 4542)
@@ -489,7 +489,8 @@
if (isDocStyle())
{
XSTypeDefinition xt = getXSType(input);
- addJavaXMLTypeMap(xt, input.getElement().getLocalPart(), "",
"", jwm, !isWrapped());
+ // Don't unwrap the actual parameter.
+ addJavaXMLTypeMap(xt, input.getElement().getLocalPart(), "",
"", jwm, false);
}
else
{
@@ -503,7 +504,8 @@
if (isDocStyle())
{
XSTypeDefinition xt = getXSType(output);
- addJavaXMLTypeMap(xt, output.getElement().getLocalPart(), "",
"", jwm, !isWrapped());
+ // Don't unwrap the response type.
+ addJavaXMLTypeMap(xt, output.getElement().getLocalPart(), "",
"", jwm, false);
}
else
{
@@ -704,7 +706,7 @@
}
}
- if ((skipWrapperArray && isRepresentsArray(xt)) == false)
+ if ((skipWrapperArray && SchemaUtils.isWrapperArrayType(xt)) == false)
{
jxtm = new JavaXmlTypeMapping(jwm);
String javaType;
@@ -900,40 +902,6 @@
}
/**
- * Checks whether the type represents an array type
- *
- * @param xst
- * @return true: type represents an array
- */
- private boolean isRepresentsArray(XSTypeDefinition xst)
- {
- boolean bool = false;
- if (xst instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xst;
- if (xc.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
- return false;
- XSParticle xsp = xc.getParticle();
-
- if (xsp == null)
- return false;
-
- XSTerm xsterm = xsp.getTerm();
- if (xsterm instanceof XSModelGroup)
- {
- XSModelGroup xm = (XSModelGroup)xsterm;
- XSObjectList xo = xm.getParticles();
- if (xo.getLength() == 1)
- {
- XSParticle xp = (XSParticle)xo.item(0);
- bool = xp.getMaxOccursUnbounded() || xp.getMaxOccurs() > 1;
- }
- }
- }
- return bool;
- }
-
- /**
* Any custom decisions that need to be made will be done here
*
* @param javaType
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/java/org/jboss/test/ws/tools/jbws1801/JBWS1801TestCase.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/java/org/jboss/test/ws/tools/jbws1801/JBWS1801TestCase.java
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/java/org/jboss/test/ws/tools/jbws1801/JBWS1801TestCase.java 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.tools.jbws1801;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import org.jboss.test.ws.tools.fixture.JBossSourceComparator;
+import org.jboss.test.ws.tools.validation.JaxrpcMappingValidator;
+import org.jboss.ws.tools.WSTools;
+import org.jboss.wsf.test.JBossWSTest;
+
+/**
+ * Test case to test the following fix: -
+ *
+ * @see
http://jira.jboss.com/jira/browse/JBWS-1801
+ *
+ * WSDL To Java - When an array if returned from a method
+ * on the SEI it is incorrectly ommitted from the generated
+ * JAX-RPC mapping.
+ *
+ * @author darran.lofthouse(a)jboss.com
+ * @since Sep 11, 2007
+ */
+public class JBWS1801TestCase extends JBossWSTest
+{
+
+ public void testDocumentLiteral() throws Exception
+ {
+ generateScenario("doclit");
+ }
+
+ protected void generateScenario(final String scenario) throws Exception
+ {
+ String resourceDir = "resources/tools/jbws1801/" + scenario;
+ String toolsDir = "tools/jbws1801/" + scenario;
+ String[] args = new String[] { "-dest", toolsDir, "-config",
resourceDir + "/wstools-config.xml" };
+ new WSTools().generate(args);
+ File resourceDirFile = new File(resourceDir);
+ String[] expectedFiles = resourceDirFile.list(new FilenameFilter() {
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".java");
+ }
+ });
+
+ for (int i = 0; i < expectedFiles.length; i++)
+ {
+ String currentFile = expectedFiles[i];
+
+ try
+ {
+ compareSource(resourceDir + "/" + currentFile, toolsDir +
"/org/jboss/test/ws/jbws1801/" + currentFile);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Validation of '" + currentFile +
"' failed.", e);
+ }
+ }
+
+ File packageDir = new File(toolsDir + "/org/jboss/test/ws/jbws1801");
+ String[] generatedFiles = packageDir.list();
+ for (int i = 0; i < generatedFiles.length; i++)
+ {
+ String currentFile = generatedFiles[i];
+
+ boolean matched = "PhoneBookService.java".equals(currentFile);
+
+ for (int j = 0; j < expectedFiles.length && (matched == false); j++)
+ matched = currentFile.equals(expectedFiles[j]);
+
+ assertTrue("File '" + currentFile + "' was not expected
to be generated", matched);
+ }
+
+ JaxrpcMappingValidator mappingValidator = new JaxrpcMappingValidator();
+ mappingValidator.validate(resourceDir + "/jaxrpc-mapping.xml", toolsDir +
"/jaxrpc-mapping.xml");
+ }
+
+ private static void compareSource(final String expectedName, final String
generatedName) throws Exception
+ {
+ File expected = new File(expectedName);
+ File generated = new File(generatedName);
+
+ JBossSourceComparator sc = new JBossSourceComparator(expected, generated);
+ sc.validate();
+ sc.validateImports();
+ }
+
+}
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/java/org/jboss/test/ws/tools/jbws1801/JBWS1801TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/Person.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/Person.java
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/Person.java 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,27 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Tue Sep 11 12:13:54 BST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1801;
+
+
+public class Person
+{
+
+protected java.lang.String[] surname;
+public Person(){}
+
+public Person(java.lang.String[] surname){
+this.surname=surname;
+}
+public java.lang.String[] getSurname() { return surname ;}
+
+public void setSurname(java.lang.String[] surname){ this.surname=surname; }
+
+}
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook.wsdl
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook.wsdl
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook.wsdl 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name='PhoneBook'
+
targetNamespace='http://test.jboss.org/ws/jbws1801'
+
xmlns='http://schemas.xmlsoap.org/wsdl/'
+
xmlns:ns1='http://test.jboss.org/ws/jbws1801/types'
+
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+
xmlns:tns='http://test.jboss.org/ws/jbws1801'
+
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <schema
targetNamespace='http://test.jboss.org/ws/jbws1801/types'
+
xmlns='http://www.w3.org/2001/XMLSchema'
+
xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'
+
xmlns:tns='http://test.jboss.org/ws/jbws1801/types'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+
+ <complexType name='Person'>
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0"
name="surname" nillable="true" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name='TelephoneNumber'>
+ <sequence>
+ <element maxOccurs="unbounded" minOccurs="0"
name="number" nillable="true" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name='lookup' type='tns:Person'/>
+ <element name='lookupResponse' type='tns:TelephoneNumber'/>
+
+ </schema>
+ </types>
+
+ <message name='PhoneBook_lookup'>
+ <part element='ns1:lookup' name='parameters'/>
+ </message>
+
+ <message name='PhoneBook_lookupResponse'>
+ <part element='ns1:lookupResponse' name='result'/>
+ </message>
+
+ <portType name='PhoneBook'>
+ <operation name='lookup'>
+ <input message='tns:PhoneBook_lookup'/>
+ <output message='tns:PhoneBook_lookupResponse'/>
+ </operation>
+ </portType>
+
+ <binding name='PhoneBookBinding' type='tns:PhoneBook'>
+ <soap:binding style='document'
transport='http://schemas.xmlsoap.org/soap/http'/>
+ <operation name='lookup'>
+ <soap:operation soapAction=''/>
+ <input>
+ <soap:body use='literal' parts='parameters'/>
+ </input>
+ <output>
+ <soap:body use='literal'/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name='PhoneBook'>
+ <port binding='tns:PhoneBookBinding' name='PhoneBookPort'>
+ <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+
+</definitions>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook_PortType.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook_PortType.java
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook_PortType.java 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,15 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Tue Sep 11 12:13:54 BST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+package org.jboss.test.ws.jbws1801;
+public interface PhoneBook_PortType extends java.rmi.Remote
+{
+
+ public org.jboss.test.ws.jbws1801.TelephoneNumber
lookup(org.jboss.test.ws.jbws1801.Person lookup) throws java.rmi.RemoteException;
+}
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/PhoneBook_PortType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/TelephoneNumber.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/TelephoneNumber.java
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/TelephoneNumber.java 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,27 @@
+/*
+ * JBossWS WS-Tools Generated Source
+ *
+ * Generation Date: Tue Sep 11 12:13:54 BST 2007
+ *
+ * This generated source code represents a derivative work of the input to
+ * the generator that produced it. Consult the input for the copyright and
+ * terms of use that apply to this source code.
+ */
+
+package org.jboss.test.ws.jbws1801;
+
+
+public class TelephoneNumber
+{
+
+protected java.lang.String[] number;
+public TelephoneNumber(){}
+
+public TelephoneNumber(java.lang.String[] number){
+this.number=number;
+}
+public java.lang.String[] getNumber() { return number ;}
+
+public void setNumber(java.lang.String[] number){ this.number=number; }
+
+}
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/TelephoneNumber.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/jaxrpc-mapping.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/jaxrpc-mapping.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/jaxrpc-mapping.xml 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,59 @@
+<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping
version='1.1'
xmlns='http://java.sun.com/xml/ns/j2ee'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1801</package-type>
+ <
namespaceURI>http://test.jboss.org/ws/jbws1801/types</namespaceURI>
+ </package-mapping>
+ <package-mapping>
+ <package-type>org.jboss.test.ws.jbws1801</package-type>
+ <
namespaceURI>http://test.jboss.org/ws/jbws1801</namespaceURI>
+ </package-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1801.Person</java-type>
+ <root-type-qname
xmlns:typeNS='http://test.jboss.org/ws/jbws1801/types'>typeNS:...
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>surname</java-variable-name>
+ <xml-element-name>surname</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <java-xml-type-mapping>
+ <java-type>org.jboss.test.ws.jbws1801.TelephoneNumber</java-type>
+ <root-type-qname
xmlns:typeNS='http://test.jboss.org/ws/jbws1801/types'>typeNS:...
+ <qname-scope>complexType</qname-scope>
+ <variable-mapping>
+ <java-variable-name>number</java-variable-name>
+ <xml-element-name>number</xml-element-name>
+ </variable-mapping>
+ </java-xml-type-mapping>
+ <service-interface-mapping>
+
<service-interface>org.jboss.test.ws.jbws1801.PhoneBook_Service</service-interface>
+ <wsdl-service-name
xmlns:serviceNS='http://test.jboss.org/ws/jbws1801'>serviceNS:...
+ <port-mapping>
+ <port-name>PhoneBookPort</port-name>
+ <java-port-name>PhoneBookPort</java-port-name>
+ </port-mapping>
+ </service-interface-mapping>
+ <service-endpoint-interface-mapping>
+
<service-endpoint-interface>org.jboss.test.ws.jbws1801.PhoneBook_PortType</service-endpoint-interface>
+ <wsdl-port-type
xmlns:portTypeNS='http://test.jboss.org/ws/jbws1801'>portTypeN...
+ <wsdl-binding
xmlns:bindingNS='http://test.jboss.org/ws/jbws1801'>bindingNS:...
+ <service-endpoint-method-mapping>
+ <java-method-name>lookup</java-method-name>
+ <wsdl-operation>lookup</wsdl-operation>
+ <method-param-parts-mapping>
+ <param-position>0</param-position>
+ <param-type>org.jboss.test.ws.jbws1801.Person</param-type>
+ <wsdl-message-mapping>
+ <wsdl-message
xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1801'>wsdlMsgNS:...
+ <wsdl-message-part-name>parameters</wsdl-message-part-name>
+ <parameter-mode>IN</parameter-mode>
+ </wsdl-message-mapping>
+ </method-param-parts-mapping>
+ <wsdl-return-value-mapping>
+
<method-return-value>org.jboss.test.ws.jbws1801.TelephoneNumber</method-return-value>
+ <wsdl-message
xmlns:wsdlMsgNS='http://test.jboss.org/ws/jbws1801'>wsdlMsgNS:...
+ <wsdl-message-part-name>result</wsdl-message-part-name>
+ </wsdl-return-value-mapping>
+ </service-endpoint-method-mapping>
+ </service-endpoint-interface-mapping>
+</java-wsdl-mapping>
\ No newline at end of file
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/jaxrpc-mapping.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/wstools-config.xml
===================================================================
---
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/wstools-config.xml
(rev 0)
+++
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/wstools-config.xml 2007-09-11
11:59:59 UTC (rev 4542)
@@ -0,0 +1,6 @@
+<configuration>
+ <wsdl-java location="resources/tools/jbws1801/doclit/PhoneBook.wsdl"
+ parameter-style="bare">
+ <mapping file="jaxrpc-mapping.xml"/>
+ </wsdl-java>
+</configuration>
Property changes on:
stack/native/branches/dlofthouse/JBWS-1801/src/test/resources/tools/jbws1801/doclit/wstools-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF