You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by nt...@apache.org on 2006/12/01 10:07:07 UTC
svn commit: r481191 - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/wsdl/ src/org/apache/axis2/jaxws/wsdl/impl/
test-resources/wsdl/ test-resources/xsd/
test/org/apache/axis2/jaxws/polymorphic/ test/org/apache/axis2/jaxws/p...
Author: nthaker
Date: Fri Dec 1 01:07:02 2006
New Revision: 481191
URL: http://svn.apache.org/viewvc?view=rev&rev=481191
Log:
AXIS-1802
Contributor - Nikhil Thaker
Previous commit failed, adding missing files.
Added:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReader.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReaderException.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/impl/
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/impl/SchemaReaderImpl.java
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/JAXB_Customization_Sample.wsdl
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/shapes.wsdl
webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/3DShape.xsd
webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape.xsd
webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape_wrappers.xsd
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/3DShape.xsd
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/services.xml
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape.xsd
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape_wrappers.xsd
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/PolymorphicShapePortTypeImpl.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapePortType.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapeService.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReader.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReader.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReader.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package org.apache.axis2.jaxws.wsdl;
+
+import java.util.Set;
+
+import javax.wsdl.Definition;
+/**
+ * Schema Reader interface is used to read schema from wsdl and derive appropriate package names from targetnamespace.
+ * The algorithm for deriving reading packages names from schema is as follows:
+ * 1) Read the inline schema defined in the wsdl
+ * 2) check if there is any jaxb customization/binding defined namely schemaBinding.
+ * if(schemaBinding defined) then
+ * read the package name and add that to the package set.
+ * else read the targetnamespace convert tns to package and add to pkg set.
+ * 3) check if there are any xsd imports or includes then
+ * for(each import)
+ * read the inline schema or perfor step 1
+ * check if there is any jaxb schemaBinding customization defined
+ * if(schemaBinding defined) then
+ * read the package name and add that to the package set.
+ * else read the targetnamespace convert tns to package and add to pkg set.
+ * Do Step 3 recursively so we cover Schema imports within import n times.
+ *
+ *
+ */
+public interface SchemaReader {
+ public Set<String> readPackagesFromSchema(Definition wsdlDefinition)throws SchemaReaderException;
+}
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReaderException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReaderException.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReaderException.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/SchemaReaderException.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,25 @@
+package org.apache.axis2.jaxws.wsdl;
+
+public class SchemaReaderException extends Exception {
+
+ public SchemaReaderException() {
+ super();
+
+ }
+
+ public SchemaReaderException(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+ public SchemaReaderException(String message) {
+ super(message);
+
+ }
+
+ public SchemaReaderException(Throwable cause) {
+ super(cause);
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/impl/SchemaReaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/impl/SchemaReaderImpl.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/impl/SchemaReaderImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/wsdl/impl/SchemaReaderImpl.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,240 @@
+package org.apache.axis2.jaxws.wsdl.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaImport;
+
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.marshaller.impl.DocLitBareMethodMarshallerImpl;
+import org.apache.axis2.jaxws.util.JavaUtils;
+import org.apache.axis2.jaxws.util.WSDLWrapper;
+import org.apache.axis2.jaxws.wsdl.SchemaReader;
+import org.apache.axis2.jaxws.wsdl.SchemaReaderException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class SchemaReaderImpl implements SchemaReader {
+
+ private static String JAXB_SCHEMA_BINDING = "schemaBindings";
+ private static String JAXB_SCHEMA_BINDING_PACKAGE = "package";
+ private static String JAXB_SCHEMA_Binding_PACKAGENAME = "name";
+ private static String SCHEMA_TARGETNAMESPACE = "targetNamespace";
+ private Definition wsdlDefinition = null;
+ private static Log log = LogFactory.getLog(SchemaReaderImpl.class);
+
+ public Set<String> readPackagesFromSchema(Definition wsdlDefinition) throws SchemaReaderException{
+ if(wsdlDefinition == null){
+ if(log.isDebugEnabled()){
+ log.debug("Invalid wsdl definition provided, NULL");
+ }
+ throw new SchemaReaderException(Messages.getMessage("SchemaReaderErr1"));
+ }
+ this.wsdlDefinition = wsdlDefinition;
+ HashSet<String> set = new HashSet<String>();
+ //Add WSDL TargetNamespace
+ String namespace = wsdlDefinition.getTargetNamespace();
+ String packageString = JavaUtils.getPackageFromNamespace(namespace);
+ set.add(packageString);
+
+ //Read Schema Definition in wsdl;
+ Types types = wsdlDefinition.getTypes();
+
+ List extensibilityElements = types.getExtensibilityElements();
+
+ //Read the schema defined in the wsdl
+ for(Object obj:extensibilityElements){
+ if(isSchema((ExtensibilityElement)obj)){
+ Schema schema = (Schema)obj;
+ //First Read all inline Schema packages
+ List<String> inlineSchemaPkgList = readPackagesFromInlineSchema(schema);
+ for(String pkgAsString:inlineSchemaPkgList){
+ if(pkgAsString!=null){
+ set.add(pkgAsString);
+ }
+ }
+
+ //Then read all imported schema definitions
+ ArrayList<String> schemaImportPkgList = readPackagesFromImports(schema);
+ for(String pkgAsString : schemaImportPkgList){
+ if(pkgAsString!=null){
+ set.add(pkgAsString);
+ }
+ }
+ }
+ }
+ //Set always stores unique objects, so I dont have to worry about removing duplicates from this set.
+ return set;
+ }
+ /*
+ * Read ShemaBinding from inline schema, if not SchemaBinding defined then read the targetnamespace.
+ * Inline Schema - Schema defined in WSDL Types.
+ */
+ private ArrayList<String> readPackagesFromInlineSchema(Schema schema){
+ ArrayList<String> pkgList = new ArrayList<String>();
+
+ //check if there is any jaxb customization/binding defined namely schemaBinding.
+ String packageString = readSchemaBindingPackageName(schema);
+ if(packageString == null){
+ //no Schema Binding package name found, this means no jaxb customizations in schema, lets read wsdl
+ //targetnamespace. Thats what will be used by RI tooling to store java Beans
+ String namespace = readSchemaTargetnamespace(schema);
+ if(namespace !=null){
+ packageString = JavaUtils.getPackageFromNamespace(namespace);
+ }
+ }
+ pkgList.add(packageString);
+
+ return pkgList;
+ }
+ /*
+ * Read ShemaBinding from import schema, if not SchemaBinding defined then read the targetnamespace.
+ * import Schema - import defined in Schema section of WSDL Types.
+ */
+ private ArrayList<String> readPackagesFromImports(Schema schema) throws SchemaReaderException{
+ ArrayList<String> schemaImportPkgList = new ArrayList<String>();
+ Map map = schema.getImports();
+ Collection collection = map.values();
+ for(Iterator i =collection.iterator(); i.hasNext(); ){
+ Vector value = (Vector) i.next();
+ for(Object vectorObj:value){
+ SchemaImport si = (SchemaImport)vectorObj;
+ if(log.isDebugEnabled()){
+ if(si!=null)
+ log.debug("Reading import for SchemaLocation ="+si.getSchemaLocationURI());
+ }
+
+ Schema refSchema = si.getReferencedSchema();
+
+ //Implementing recursion for reading import within import
+
+ //First read inline schema for imported schema
+ ArrayList<String> inlineSchemaPkgList = readPackagesFromInlineSchema(refSchema);
+ for(String packageString:inlineSchemaPkgList){
+ if(packageString!=null){
+ schemaImportPkgList.add(packageString);
+ }
+ }
+ //Before we fetch import within imports lets check for circular dependency
+ //Circular dependency is two imports calling each other in different xsd files.
+ if(isCircularDependency(this.readSchemaTargetnamespace(schema), refSchema)){
+ if(log.isDebugEnabled()){
+ log.debug("Circular Dependency Found in WSDL Schema Imports, Two Schemas are importing each other.");
+ }
+ throw new SchemaReaderException(Messages.getMessage("SchemaReaderErr2"));
+ }
+
+ //Lets read if import has any imports by recurisvely calling readPackageFromImport again....
+ ArrayList<String> rec_ImportPkgList = readPackagesFromImports(refSchema);
+ for(String packageString:rec_ImportPkgList){
+ if(packageString!=null){
+ schemaImportPkgList.add(packageString);
+ }
+ }
+ }
+
+ }
+
+ return schemaImportPkgList;
+ }
+
+ private String readSchemaTargetnamespace(Schema schema){
+ Node root = schema.getElement();
+ if(root!=null){
+ NamedNodeMap nodeMap = root.getAttributes();
+ Node attributeNode = nodeMap.getNamedItem(SCHEMA_TARGETNAMESPACE);
+ if(attributeNode!=null){
+ return attributeNode.getNodeValue();
+ }
+ }
+ return null;
+ }
+ private String readSchemaBindingPackageName(Schema schema){
+
+ /* JAXB Specification section 7.6 have following important points
+ * 1) <schemaBindings> binding declaration have schema scope
+ * 2) For inline annotation a <schemaBindings> is valid only in the annotation element of the <schema> element.
+ * 3) There must only be a single instance of <schemaBindings> declaration in the annotation element of the <schema> element.
+ */
+
+ //Get root node for schema.
+ Node root = schema.getElement();
+ if(root.hasChildNodes()){
+
+ //get all child nodes for schema
+ NodeList list = root.getChildNodes();
+
+ //search for JAXB schemaBinding customization in schema element definitions.
+ for(int i=0; i<list.getLength(); i++){
+ Node childNode = list.item(i);
+ if(isElementName(JAXB_SCHEMA_BINDING, childNode)){
+
+ //SchemaBinding has been defined, so lets look for package element.
+ NodeList schemaBindingNodeList = childNode.getChildNodes();
+ for(int j =0; j<schemaBindingNodeList.getLength(); j++){
+ Node schemaBindingNode = schemaBindingNodeList.item(j);
+ if(isElementName(JAXB_SCHEMA_BINDING_PACKAGE, schemaBindingNode)){
+
+ //Package Element found, so lets read the package name attribute and return that.
+ NamedNodeMap nodeMap = schemaBindingNode.getAttributes();
+ Node attributeNode = nodeMap.getNamedItem(JAXB_SCHEMA_Binding_PACKAGENAME);
+ return attributeNode.getNodeValue();
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+ private boolean isElementName(String name, Node domNode){
+ if(domNode == null){
+ return false;
+ }
+ if(domNode.getNodeType() == Node.ELEMENT_NODE){
+ String localName = domNode.getLocalName();
+ return localName!=null && localName.equals(name);
+ }
+ return false;
+ }
+
+ private boolean isSchema(ExtensibilityElement exElement){
+ return WSDLWrapper.SCHEMA.equals(exElement.getElementType());
+ }
+ /*
+ * Check if Schema1 imports Schema2 and Schema2 imports Schema1
+ */
+ private boolean isCircularDependency(String targetNamespaceSchema1, Schema Schema2){
+ //Get All imports of the schema2
+ Map map = Schema2.getImports();
+ Collection collection =map.values();
+ for(Iterator i =collection.iterator(); i.hasNext(); ){
+ Vector value = (Vector) i.next();
+ for(Object vectorObj:value){
+ SchemaImport si = (SchemaImport)vectorObj;
+
+ //Comparte Schema2 import targetNamespace URI with targetNamespace of Schema1 if they match its a circular
+ //dependency.
+ //TODO should we also check for Schema location here.
+ if(si.getNamespaceURI().equals(targetNamespaceSchema1)){
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/JAXB_Customization_Sample.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/JAXB_Customization_Sample.wsdl?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/JAXB_Customization_Sample.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/JAXB_Customization_Sample.wsdl Fri Dec 1 01:07:02 2006
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<definitions targetNamespace="http://nonanonymous.complextype.test.org"
+ xmlns:tns="http://nonanonymous.complextype.test.org"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+
+ <types>
+ <xsd:schema targetNamespace="http://nonanonymous.complextype.test.org"
+ xmlns:ts="http://nonanonymous.complextype.test.org/xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <complexType name="echoMessage">
+ <sequence>
+ <element name="request" type="xsd:string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="echoMessageResponse">
+ <sequence>
+ <element name="response" type="xsd:string"/>
+ </sequence>
+ </complexType>
+
+ <element name="echoMessage" type="tns:echoMessage"/>
+ <element name="echoMessageResponse" type="tns:echoMessageResponse"/>
+
+<!-- Using schema binding to change the package name for jaxb art effects -->
+ <jaxb:schemaBindings>
+ <jaxb:package name = "org.test.echomessage" />
+ </jaxb:schemaBindings>
+ </xsd:schema>
+ </types>
+
+ <message name="echoMessage">
+ <part name="message" element="tns:echoMessage"/>
+ </message>
+
+ <message name="echoMessageResponse">
+ <part name="result" element="tns:echoMessageResponse"/>
+ </message>
+
+ <portType name="EchoMessagePortType">
+ <operation name="echoMessage">
+ <input message="tns:echoMessage" />
+ <output message="tns:echoMessageResponse" />
+ </operation>
+ </portType>
+
+ <binding name="EchoMessageBinding" type="tns:EchoMessagePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echoMessage">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="EchoMessageService">
+ <port binding="tns:EchoMessageBinding" name="EchoMessagePort">
+ <soap:address location="http://localhost:8080/EchoMessageService/EchoMessageService"/>
+ </port>
+
+ </service>
+
+</definitions>
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/shapes.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/shapes.wsdl?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/shapes.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/shapes.wsdl Fri Dec 1 01:07:02 2006
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
+ targetNamespace="http://sei.shape.polymorphic.jaxws.axis2.apache.org"
+ xmlns="http://sei.shape.polymorphic.jaxws.axis2.apache.org"
+
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://sei.shape.polymorphic.jaxws.axis2.apache.org"
+ xmlns:tns1="http://shape.test.org"
+ xmlns:tns2="http://threed.shape.test.org"
+ xmlns:tns3="http://wrapper.shape.test.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+ <wsdl:types>
+ <xsd:schema>
+ <xsd:import namespace="http://shape.test.org"
+ schemaLocation="../xsd/shape.xsd"/>
+ <xsd:import namespace="http://threed.shape.test.org"
+ schemaLocation="../xsd/3DShape.xsd"/>
+ <xsd:import namespace="http://wrapper.shape.test.org"
+ schemaLocation="../xsd/shape_wrappers.xsd"/>
+ </xsd:schema>
+
+ </wsdl:types>
+ <wsdl:message name="draw3DRequest">
+ <wsdl:part name="request" element="tns3:draw3D">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="drawRequest">
+ <wsdl:part name="request" element="tns3:draw">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="drawResponse">
+ <wsdl:part name="typesQNameResponse" element="tns3:drawResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:portType name="PolymorphicShapePortType">
+ <wsdl:operation name="draw">
+ <wsdl:input message="tns:drawRequest" />
+ <wsdl:output message="tns:drawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="draw3D">
+ <wsdl:input message="tns:draw3DRequest" />
+ <wsdl:output message="tns:drawResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="PolymorphicShapeBinding" type="tns:PolymorphicShapePortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="draw">
+ <soap:operation
+ soapAction="http://sei.polymorphicshape.jaxws.axis2.apache.org/typesExtension" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="draw3D">
+ <soap:operation
+ soapAction="http://sei.polymorphicshape.jaxws.axis2.apache.org/typesExtension" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="PolymorphicShapeService">
+ <wsdl:port name="PolymorphicShapePort"
+ binding="tns:PolymorphicShapeBinding">
+ <soap:address
+ location="http://localhost:8080/axis2/services/PolymorphicShapeService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/3DShape.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/3DShape.xsd?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/3DShape.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/3DShape.xsd Fri Dec 1 01:07:02 2006
@@ -0,0 +1,21 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns1="http://shape.test.org"
+ xmlns:tns="http://threed.shape.test.org"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ targetNamespace="http://threed.shape.test.org">
+
+ <xsd:import namespace="http://shape.test.org"
+ schemaLocation="shape.xsd" />
+
+ <xsd:complexType name="ThreeDSquare">
+ <xsd:complexContent>
+ <xsd:extension base="tns1:Square">
+ <xsd:sequence>
+ <xsd:element name="bredth" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+
+</xsd:schema>
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape.xsd?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape.xsd Fri Dec 1 01:07:02 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://shape.test.org"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ targetNamespace="http://shape.test.org">
+
+ <xsd:complexType name="Shape" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="xAxis" type="xsd:float" />
+ <xsd:element name="yAxis" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Square" >
+ <xsd:complexContent>
+ <xsd:extension base="tns:Shape">
+ <xsd:sequence>
+ <xsd:element name="length" type="xsd:int" />
+ <xsd:element name="width" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="Circle" >
+ <xsd:complexContent>
+ <xsd:extension base="tns:Shape">
+ <xsd:sequence>
+ <xsd:element name="radius" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape_wrappers.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape_wrappers.xsd?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape_wrappers.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/xsd/shape_wrappers.xsd Fri Dec 1 01:07:02 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://wrapper.shape.test.org"
+ xmlns:tns1="http://shape.test.org"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ targetNamespace="http://wrapper.shape.test.org">
+
+ <xsd:import namespace="http://shape.test.org"
+ schemaLocation="shape.xsd" />
+
+ <xsd:element name="draw3D">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="tns1:Shape" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="draw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="tns1:Shape" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="drawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="tns1:Shape" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/3DShape.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/3DShape.xsd?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/3DShape.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/3DShape.xsd Fri Dec 1 01:07:02 2006
@@ -0,0 +1,19 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns1="http://shape.test.org"
+ xmlns:tns="http://threed.shape.test.org"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ targetNamespace="http://threed.shape.test.org">
+
+ <xsd:import namespace="http://shape.test.org"
+ schemaLocation="shape.xsd" />
+
+ <xsd:complexType name="ThreeDSquare">
+ <xsd:complexContent>
+ <xsd:extension base="tns1:Square">
+ <xsd:sequence>
+ <xsd:element name="bredth" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+</xsd:schema>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/services.xml?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/services.xml (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/services.xml Fri Dec 1 01:07:02 2006
@@ -0,0 +1,9 @@
+<serviceGroup>
+ <service name="PolymorphicShapeService">
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
+ </messageReceivers>
+ <parameter locked="false" name="ServiceClass">org.apache.axis2.jaxws.polymorphic.shape.PolymorphicShapePortTypeImpl</parameter>
+ </service>
+</serviceGroup>
+
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape.xsd?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape.xsd Fri Dec 1 01:07:02 2006
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://shape.test.org"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ targetNamespace="http://shape.test.org">
+
+ <xsd:complexType name="Shape" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="xAxis" type="xsd:float" />
+ <xsd:element name="yAxis" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Square" >
+ <xsd:complexContent>
+ <xsd:extension base="tns:Shape">
+ <xsd:sequence>
+ <xsd:element name="length" type="xsd:int" />
+ <xsd:element name="width" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="Circle" >
+ <xsd:complexContent>
+ <xsd:extension base="tns:Shape">
+ <xsd:sequence>
+ <xsd:element name="radius" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+</xsd:schema>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape_wrappers.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape_wrappers.xsd?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape_wrappers.xsd (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shape_wrappers.xsd Fri Dec 1 01:07:02 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://wrapper.shape.test.org"
+ xmlns:tns1="http://shape.test.org"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+ targetNamespace="http://wrapper.shape.test.org">
+
+ <xsd:import namespace="http://shape.test.org"
+ schemaLocation="shape.xsd" />
+
+ <xsd:element name="draw3D">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="tns1:Shape" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="draw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" type="tns1:Shape" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="drawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="tns1:Shape" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl Fri Dec 1 01:07:02 2006
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
+ targetNamespace="http://sei.shape.polymorphic.jaxws.axis2.apache.org"
+ xmlns="http://sei.shape.polymorphic.jaxws.axis2.apache.org"
+
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:tns="http://sei.shape.polymorphic.jaxws.axis2.apache.org"
+ xmlns:tns1="http://shape.test.org"
+ xmlns:tns2="http://threed.shape.test.org"
+ xmlns:tns3="http://wrapper.shape.test.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+ <wsdl:types>
+ <xsd:schema>
+ <xsd:import namespace="http://shape.test.org"
+ schemaLocation="shape.xsd"/>
+ <xsd:import namespace="http://threed.shape.test.org"
+ schemaLocation="3DShape.xsd"/>
+ <xsd:import namespace="http://wrapper.shape.test.org"
+ schemaLocation="shape_wrappers.xsd"/>
+ </xsd:schema>
+
+ </wsdl:types>
+ <wsdl:message name="draw3DRequest">
+ <wsdl:part name="request" element="tns3:draw3D">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="drawRequest">
+ <wsdl:part name="request" element="tns3:draw">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="drawResponse">
+ <wsdl:part name="typesQNameResponse" element="tns3:drawResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:portType name="PolymorphicShapePortType">
+ <wsdl:operation name="draw">
+ <wsdl:input message="tns:drawRequest" />
+ <wsdl:output message="tns:drawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="draw3D">
+ <wsdl:input message="tns:draw3DRequest" />
+ <wsdl:output message="tns:drawResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="PolymorphicShapeBinding" type="tns:PolymorphicShapePortType">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="draw">
+ <soap:operation
+ soapAction="http://sei.polymorphicshape.jaxws.axis2.apache.org/typesExtension" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="draw3D">
+ <soap:operation
+ soapAction="http://sei.polymorphicshape.jaxws.axis2.apache.org/typesExtension" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="PolymorphicShapeService">
+ <wsdl:port name="PolymorphicShapePort"
+ binding="tns:PolymorphicShapeBinding">
+ <soap:address
+ location="http://localhost:8080/axis2/services/PolymorphicShapeService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/PolymorphicShapePortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/PolymorphicShapePortTypeImpl.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/PolymorphicShapePortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/PolymorphicShapePortTypeImpl.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,36 @@
+package org.apache.axis2.jaxws.polymorphic.shape;
+
+import javax.jws.WebService;
+import org.apache.axis2.jaxws.polymorphic.shape.sei.PolymorphicShapePortType;
+import org.test.shape.Circle;
+import org.test.shape.Shape;
+import org.test.shape.Square;
+import org.test.shape.threed.ThreeDSquare;
+
+@WebService(endpointInterface="org.apache.axis2.jaxws.polymorphic.shape.sei.PolymorphicShapePortType", wsdlLocation="test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl")
+public class PolymorphicShapePortTypeImpl implements PolymorphicShapePortType {
+
+ public Shape draw(Shape request) {
+ if(request instanceof Circle){
+ Circle circle =(Circle) request;
+ System.out.println("Drawing Circle on x ="+request.getXAxis()+" y=" +request.getYAxis()+ " With Radius ="+circle.getRadius());
+ return request;
+ }
+ if(request instanceof Square){
+ Square square =(Square) request;
+ System.out.println("Drawing Square on x ="+request.getXAxis()+" y=" +request.getYAxis()+ " With Sides ="+square.getLength());
+ return request;
+ }
+ return null;
+ }
+
+ public Shape draw3D(Shape request) {
+ if(request instanceof ThreeDSquare){
+ ThreeDSquare threeDsquare =(ThreeDSquare) request;
+ System.out.println("Drawing 3DSquare on x ="+request.getXAxis()+" y=" +request.getYAxis()+ " With Bredth ="+threeDsquare.getBredth());
+ return request;
+ }
+ return null;
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapePortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapePortType.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapePortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapePortType.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,51 @@
+
+package org.apache.axis2.jaxws.polymorphic.shape.sei;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+import org.test.shape.Shape;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ *
+ */
+@WebService(name = "PolymorphicShapePortType", targetNamespace = "http://sei.shape.polymorphic.jaxws.axis2.apache.org")
+public interface PolymorphicShapePortType {
+
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns org.test.shape.Shape
+ */
+ @WebMethod(action = "http://sei.polymorphicshape.jaxws.axis2.apache.org/typesExtension")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "draw", targetNamespace = "http://wrapper.shape.test.org", className = "org.test.shape.wrapper.Draw")
+ @ResponseWrapper(localName = "drawResponse", targetNamespace = "http://wrapper.shape.test.org", className = "org.test.shape.wrapper.DrawResponse")
+ public Shape draw(
+ @WebParam(name = "request", targetNamespace = "")
+ Shape request);
+
+ /**
+ *
+ * @param request
+ * @return
+ * returns org.test.shape.Shape
+ */
+ @WebMethod(action = "http://sei.polymorphicshape.jaxws.axis2.apache.org/typesExtension")
+ @WebResult(name = "response", targetNamespace = "")
+ @RequestWrapper(localName = "draw3D", targetNamespace = "http://wrapper.shape.test.org", className = "org.test.shape.wrapper.Draw3D")
+ @ResponseWrapper(localName = "drawResponse", targetNamespace = "http://wrapper.shape.test.org", className = "org.test.shape.wrapper.DrawResponse")
+ public Shape draw3D(
+ @WebParam(name = "request", targetNamespace = "")
+ Shape request);
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapeService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapeService.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapeService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/sei/PolymorphicShapeService.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,62 @@
+
+package org.apache.axis2.jaxws.polymorphic.shape.sei;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+
+/**
+ * This class was generated by the JAXWS SI.
+ * JAX-WS RI 2.0_01-b15-fcs
+ * Generated source version: 2.0
+ *
+ */
+@WebServiceClient(name = "PolymorphicShapeService", targetNamespace = "http://sei.shape.polymorphic.jaxws.axis2.apache.org", wsdlLocation = "shapes.wsdl")
+public class PolymorphicShapeService
+ extends Service
+{
+
+ private final static URL POLYMORPHICSHAPESERVICE_WSDL_LOCATION;
+
+ private static String wsdlLocation="/test/org/apache/axis2/jaxws/polymorphic/shape/META-INF/shapes.wsdl";
+ static {
+ URL url = null;
+ try {
+ try{
+ String baseDir = new File(".").getCanonicalPath();
+ wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ File file = new File(wsdlLocation);
+ url = file.toURL();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ POLYMORPHICSHAPESERVICE_WSDL_LOCATION = url;
+ }
+
+ public PolymorphicShapeService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public PolymorphicShapeService() {
+ super(POLYMORPHICSHAPESERVICE_WSDL_LOCATION, new QName("http://sei.shape.polymorphic.jaxws.axis2.apache.org", "PolymorphicShapeService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns PolymorphicShapePortType
+ */
+ @WebEndpoint(name = "PolymorphicShapePort")
+ public PolymorphicShapePortType getPolymorphicShapePort() {
+ return (PolymorphicShapePortType)super.getPort(new QName("http://sei.shape.polymorphic.jaxws.axis2.apache.org", "PolymorphicShapePort"), PolymorphicShapePortType.class);
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java?view=auto&rev=481191
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java Fri Dec 1 01:07:02 2006
@@ -0,0 +1,131 @@
+package org.apache.axis2.jaxws.polymorphic.shape.tests;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.wsdl.WSDLException;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.jaxws.polymorphic.shape.sei.PolymorphicShapePortType;
+import org.apache.axis2.jaxws.polymorphic.shape.sei.PolymorphicShapeService;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.axis2.jaxws.util.WSDLWrapper;
+import org.apache.axis2.jaxws.wsdl.SchemaReaderException;
+import org.apache.axis2.jaxws.wsdl.impl.SchemaReaderImpl;
+import org.test.shape.Shape;
+import org.test.shape.Square;
+import org.test.shape.threed.ThreeDSquare;
+
+public class PolymorphicTests extends TestCase {
+
+ public void testFormalAndActualTypeInDifferentPackages(){
+ System.out.println("------------------------------");
+ System.out.println("Test : "+getName());
+ PolymorphicShapeService service = new PolymorphicShapeService();
+ PolymorphicShapePortType port = service.getPolymorphicShapePort();
+ Shape shapeType;
+
+ System.out.println("Sending Request to draw Square");
+ Square shape = new Square();
+ shape.setXAxis(1);
+ shape.setYAxis(1);
+ shape.setLength(10);
+ shapeType = port.draw(shape);
+ assertTrue(shapeType instanceof Square);
+ System.out.println("Square was drawn");
+
+ System.out.println("Sending Request to draw 3D Square");
+ ThreeDSquare threeDshape = new ThreeDSquare();
+ threeDshape.setXAxis(1);
+ threeDshape.setYAxis(1);
+ threeDshape.setLength(10);
+ threeDshape.setWidth(10);
+ threeDshape.setBredth(10);
+ shapeType = port.draw3D(threeDshape);
+ assertTrue(shapeType instanceof ThreeDSquare);
+ System.out.println("3D Square was drawn");
+ System.out.println("-------------------------------");
+ }
+
+ public void testInlineUseOfJAXBBinding(){
+ System.out.println("------------------------------");
+ System.out.println("Test : "+getName());
+ String schemaBindingPkgName = "org.test.echomessage";
+ String standardPkgName= "org.test.complextype.nonanonymous";
+ String wsdlLocation="test-resources/wsdl/JAXB_Customization_Sample.wsdl";
+ URL url = null;
+ try{
+ try{
+ String baseDir = new File(".").getCanonicalPath();
+ wsdlLocation = new File(baseDir +File.separator+ wsdlLocation).getAbsolutePath();
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ File file = new File(wsdlLocation);
+ url = file.toURL();
+ WSDLWrapper wsdlWrapper = new WSDL4JWrapper(url);
+ org.apache.axis2.jaxws.wsdl.SchemaReader sr= new SchemaReaderImpl();
+ Set<String> set= sr.readPackagesFromSchema(wsdlWrapper.getDefinition());
+ assertNotNull(set);
+ Iterator<String> iter = set.iterator();
+ while(iter.hasNext()){
+ String pkg = iter.next();
+ System.out.println("Package = " +pkg);
+ }
+ System.out.println("------------------------------");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ fail();
+ }catch(WSDLException e){
+ e.printStackTrace();
+ fail();
+ }catch(SchemaReaderException e){
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ public void testSchemaReader(){
+ System.out.println("------------------------------");
+ System.out.println("Test : "+getName());
+ String wsdlLocation="test-resources/wsdl/shapes.wsdl";
+ URL url = null;
+ try{
+ try{
+ String baseDir = new File(".").getCanonicalPath();
+ wsdlLocation = new File(baseDir +File.separator+ wsdlLocation).getAbsolutePath();
+ }catch(Exception e){
+ e.printStackTrace();
+ fail();
+ }
+ File file = new File(wsdlLocation);
+ url = file.toURL();
+ WSDLWrapper wsdlWrapper = new WSDL4JWrapper(url);
+ org.apache.axis2.jaxws.wsdl.SchemaReader sr= new SchemaReaderImpl();
+ Set<String> set= sr.readPackagesFromSchema(wsdlWrapper.getDefinition());
+ assertNotNull(set);
+ Iterator<String> iter = set.iterator();
+ while(iter.hasNext()){
+ System.out.println("Package ="+iter.next());
+ }
+ System.out.println("------------------------------");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ fail();
+ }catch(WSDLException e){
+ e.printStackTrace();
+ fail();
+ }catch(SchemaReaderException e){
+ e.printStackTrace();
+ fail();
+ }
+
+
+
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org