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 ch...@apache.org on 2005/01/28 12:23:15 UTC
svn commit: r148875 - in webservices/axis/trunk/java/dev/scratch/prototype2/src: java/org/apache/axis/wsdl/wsdltowom java/org/apache/wsdl java/org/apache/wsdl/impl java/org/apache/wsdl/util test/org/apache/wsdl
Author: chathura
Date: Fri Jan 28 03:23:12 2005
New Revision: 148875
URL: http://svn.apache.org/viewcvs?view=rev&rev=148875
Log:
WOMBuilder Test added and few alterations done in WSDL
Added:
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/WOMBuilderTest.java
Removed:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/Parser.java
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java
Deleted: /webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/Parser.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/Parser.java?view=auto&rev=148874
==============================================================================
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java Fri Jan 28 03:23:12 2005
@@ -32,10 +32,22 @@
*/
public class WOMBuilderFactory {
- private static final int WSDL11 = 1;
- private static final int wsdl20 = 2;
+ public static final int WSDL11 = 1;
+ public static final int wsdl20 = 2;
+ public static WOMBuilder getBuilder(int wsdlDocumentType) throws WSDLException{
+
+ if(wsdlDocumentType == WSDL11){
+ return new WSDL1ToWOMBuilder();
+ }
+ if(wsdlDocumentType == wsdl20){
+ return new WSDL2ToWOMBuilder();
+ }
+ throw new WSDLException(WSDLException.INVALID_WSDL, "The document type specified is not valid");
+ }
+
+
public static WOMBuilder getBuilder(InputStream in) throws WSDLException{
// Load the wsdl as a DOM
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java Fri Jan 28 03:23:12 2005
@@ -18,6 +18,9 @@
import java.util.Iterator;
import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
import javax.wsdl.Definition;
import javax.wsdl.Input;
import javax.wsdl.Operation;
@@ -26,23 +29,33 @@
import javax.wsdl.Port;
import javax.wsdl.PortType;
import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
import javax.xml.namespace.QName;
+import org.apache.wsdl.ExtensionElement;
import org.apache.wsdl.MessageReference;
import org.apache.wsdl.WSDLBinding;
+import org.apache.wsdl.WSDLBindingMessageReference;
+import org.apache.wsdl.WSDLBindingOperation;
import org.apache.wsdl.WSDLConstants;
import org.apache.wsdl.WSDLDescription;
import org.apache.wsdl.WSDLEndpoint;
import org.apache.wsdl.WSDLInterface;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.WSDLService;
+import org.apache.wsdl.WSDLTypes;
+import org.apache.wsdl.impl.ExtensionElementImpl;
import org.apache.wsdl.impl.MessageReferenceImpl;
import org.apache.wsdl.impl.WSDLBindingImpl;
+import org.apache.wsdl.impl.WSDLBindingMessageReferenceImpl;
+import org.apache.wsdl.impl.WSDLBindingOperationImpl;
import org.apache.wsdl.impl.WSDLEndpointImpl;
import org.apache.wsdl.impl.WSDLInterfaceImpl;
import org.apache.wsdl.impl.WSDLOperationImpl;
import org.apache.wsdl.impl.WSDLProcessingException;
import org.apache.wsdl.impl.WSDLServiceImpl;
+import org.apache.wsdl.impl.WSDLTypesImpl;
/**
* @author chathura@opensource.lk
@@ -50,6 +63,7 @@
*/
public class WSDLPump {
+ private static final String BOUND_INTERFACE_NAME = "BoundInterface";
private WSDLDescription womDefinition;
private Definition wsdl4jParsedDefinition;
@@ -62,9 +76,11 @@
}
public void pump() {
- this.populateDefinition(
- this.womDefinition,
- this.wsdl4jParsedDefinition);
+ if(null != this.wsdl4jParsedDefinition && null != this.womDefinition ){
+ this.populateDefinition(this.womDefinition, this.wsdl4jParsedDefinition);
+ }else{
+ throw new WSDLProcessingException("Properties not set properly");
+ }
}
@@ -92,8 +108,21 @@
//////////////////////////(1)First pump the Types////////////////////////////
//Types may get changed inside the Operation pumping.
-
-
+ Types wsdl4jTypes = wsdl4JDefinition.getTypes();
+ WSDLTypes wsdlTypes = new WSDLTypesImpl();
+ Iterator wsdl4jelmentsIterator = wsdl4jTypes.getExtensibilityElements().iterator();
+ ExtensibilityElement wsdl4jElement;
+ ExtensionElement womElement;
+ while(wsdl4jelmentsIterator.hasNext()){
+ wsdl4jElement = (ExtensibilityElement)wsdl4jelmentsIterator.next();
+ womElement = new ExtensionElementImpl();
+ if(null != wsdl4jElement.getRequired())
+ womElement.setRequired(wsdl4jElement.getRequired().booleanValue());
+ //TODO
+
+ wsdlTypes.addElement(wsdl4jElement.getElementType(), womElement);
+ }
+ this.womDefinition.setTypes(wsdlTypes);
@@ -138,15 +167,15 @@
while(serviceIterator.hasNext()){
wsdlService = new WSDLServiceImpl();
this.populateServices(wsdlService, (Service)serviceIterator.next());
+ wsdlDefinition.addService(wsdlService);
}
-
- throw new UnsupportedOperationException("Fill the impl");
+
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////// Top level Components Copying ////////////////////
-
+
/**
* Simply Copy information.
@@ -154,23 +183,19 @@
* @param wsdl4jPortType
*/
//FIXME Evaluate a way of injecting features and priperties with a general formatted input
- private void populateInterfaces(
- WSDLInterface wsdlInterface,
- PortType wsdl4jPortType) {
+ private void populateInterfaces(WSDLInterface wsdlInterface, PortType wsdl4jPortType) {
//Copy the Attrebute information items
//Copied with the Same QName so it will reqire no Query in Binding pumping.
wsdlInterface.setName(wsdl4jPortType.getQName());
- Iterator wsdl4JOperationsIterator =
- wsdl4jPortType.getOperations().iterator();
+ Iterator wsdl4JOperationsIterator = wsdl4jPortType.getOperations().iterator();
+ WSDLOperation wsdloperation ;
while (wsdl4JOperationsIterator.hasNext()) {
- WSDLOperation wsdloperation = new WSDLOperationImpl();
- this.populateOperations(
- wsdloperation,
- (Operation) wsdl4JOperationsIterator.next(),
- wsdl4jPortType.getQName().getNamespaceURI());
+ wsdloperation = new WSDLOperationImpl();
+ this.populateOperations( wsdloperation, (Operation) wsdl4JOperationsIterator.next(), wsdl4jPortType.getQName().getNamespaceURI());
+ wsdlInterface.setOperation(wsdloperation);
}
@@ -193,10 +218,14 @@
Iterator bindingoperationsIterator = wsdl4JBinding.getBindingOperations().iterator();
+ WSDLBindingOperation wsdlBindingOperation;
while(bindingoperationsIterator.hasNext()){
- throw new UnsupportedOperationException("Fill the impl");
+ wsdlBindingOperation = new WSDLBindingOperationImpl();
+ this.populateBindingOperation(wsdlBindingOperation, (BindingOperation)bindingoperationsIterator.next(), wsdl4JBinding.getQName().getNamespaceURI());
+ wsdlBinding.addBindingOperation(wsdlBindingOperation);
}
+
}
@@ -204,10 +233,12 @@
public void populateServices(WSDLService wsdlService, Service wsdl4jService){
wsdlService.setName(wsdl4jService.getQName());
Iterator wsdl4jportsIterator = wsdl4jService.getPorts().values().iterator();
+ wsdlService.setServiceInterface(this.getBoundInterface(wsdlService));
WSDLEndpoint wsdlEndpoint;
while(wsdl4jportsIterator.hasNext()){
wsdlEndpoint = new WSDLEndpointImpl();
this.populatePorts(wsdlEndpoint, (Port)wsdl4jportsIterator.next(), wsdl4jService.getQName().getNamespaceURI());
+ wsdlService.setEndpoint(wsdlEndpoint);
}
}
@@ -230,6 +261,9 @@
//Get all the in parts and create a new Element out of it and add it to the Types.
//TODO
+
+ wsdlInputMessage.setMessageLabel(wsdl4jInputMessage.getName());
+ //wsdlInputMessage.setElement(wsdl4jInputMessage.getMessage())
// wsdlInputMessage.setMessageLabel()
@@ -248,17 +282,42 @@
}
+ private void populateBindingOperation(WSDLBindingOperation wsdlBindingOperation, BindingOperation wsdl4jBindingOperation, String nameSpaceOfTheBindingOperation){
+ wsdlBindingOperation.setName(new QName(nameSpaceOfTheBindingOperation, wsdl4jBindingOperation.getName()));
+
+ BindingInput wsdl4jInputBinding = wsdl4jBindingOperation.getBindingInput();
+ WSDLBindingMessageReference wsdlInputBinding = new WSDLBindingMessageReferenceImpl();
+
+ wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
+ //TODO
+ wsdlBindingOperation.setInput(wsdlInputBinding);
+
+
+
+ BindingOutput wsdl4jOutputBinding = wsdl4jBindingOperation.getBindingOutput();
+ WSDLBindingMessageReference wsdlOutputBinding = new WSDLBindingMessageReferenceImpl();
+
+ wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
+ //TODO
+ wsdlBindingOperation.setInput(wsdlOutputBinding);
+
+
+
+ }
+
+
+
public void populatePorts(WSDLEndpoint wsdlEndpoint, Port wsdl4jPort, String targetNamspace){
wsdlEndpoint.setName(new QName(targetNamspace, wsdl4jPort.getName()));
wsdlEndpoint.setBinding(this.womDefinition.getBinding(wsdl4jPort.getBinding().getQName()));
- ///Extesibility ekements.
+ ///Extesibility elements.
}
///////////////////////////Util Methods ////////////////////////////////////
-
+
/**
* Will return the URI for the MEP. if null will retun the IN_OUT as default
* pattern.
@@ -279,10 +338,46 @@
if(operationType.equals(OperationType.SOLICIT_RESPONSE))
return WSDLConstants.MEP_URI_OUT_IN;
}
-
- //Either operation type is null of its none of the above.
- throw new WSDLProcessingException("Invalid Operation Type(MEP) :Operation Type should be either of REQUESTRESPONCE, ONEWAY, NOTIFICATION, SOLICITRESPONCE");
-
+ //TODO
+ return WSDLConstants.MEP_URI_OUT_IN;
}
-
+
+ /**
+ * This method will fill up the gap of WSDL 1.1 and WSDL 2.0 w.r.t. the
+ * bound interface for the Service Component Defined in the WSDL 2.0.
+ * Logic being if there exist only one PortType in the WSDL 1.1 file
+ * then that will be set as the bound interface of the Service. If more than one
+ * Porttype exist in the WSDl 1.1 file this will create a dummy Interface
+ * with the available PortTypes and will return that interface so that it
+ * will inherit all those interfaces.
+ *
+ * Eventuall this will have to be fixed using user input since
+ * @param service
+ * @return
+ */
+ private WSDLInterface getBoundInterface(WSDLService service){
+
+ // Throw an exception if there are no interfaces defined as at yet.
+ if(0 ==this.womDefinition.getWsdlInterfaces().size())
+ throw new WSDLProcessingException( "There are no " +
+ "Interfaces/PortTypes identified in the current partially built" +
+ "WOM");
+
+ //If there is only one Interface available hten return that because normally
+ // that interface must be the one to the service should get bound.
+ if(1 == this.womDefinition.getWsdlInterfaces().size())
+ return (WSDLInterface)this.womDefinition.getWsdlInterfaces().values().iterator().next();
+
+ //If there are more than one interface available... For the time being create a
+ // new interface and set all those existing interfaces as superinterfaces of it
+ // and return.
+ WSDLInterface newBoundInterface = this.womDefinition.createInterface();
+ newBoundInterface.setName(new QName(service.getNamespace(), service.getName().getLocalPart()+ BOUND_INTERFACE_NAME));
+ Iterator interfaceIterator = this.womDefinition.getWsdlInterfaces().values().iterator();
+ while(interfaceIterator.hasNext()){
+ newBoundInterface.addSuperInterface((WSDLInterface)interfaceIterator.next());
+ }
+ return newBoundInterface;
+ }
+
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/MessageReference.java Fri Jan 28 03:23:12 2005
@@ -15,6 +15,8 @@
*/
package org.apache.wsdl;
+import javax.xml.namespace.QName;
+
/**
* @author chathura@opensource.lk
*
@@ -24,9 +26,14 @@
public void setDirection(String direction);
- public String getElement();
- public void setElement(String element);
+ /**
+ * This Element refers to the actual message that will get transported. This Element
+ * Abstracts all the Message Parts that was defined in the WSDL 1.1.
+ */
+ public QName getElement();
+
+ public void setElement(QName element);
public String getMessageLabel();
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLDescription.java Fri Jan 28 03:23:12 2005
@@ -97,9 +97,9 @@
public void setWsdlInterfaces(HashMap wsdlInterfaces);
- public Object[] getTypes();
+ public WSDLTypes getTypes();
- public void setTypes(Object[] types);
+ public void setTypes(WSDLTypes types);
/**
* Gets the name attrebute of the WSDL 1.1 Definitions Element
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/WSDLInterface.java Fri Jan 28 03:23:12 2005
@@ -101,11 +101,10 @@
/**
* The Inteface will be added to the list of super interfaces keyed with
- * the QName.
- * @param qName The QName of the Inteface
+ * the QName.
* @param interfaceComponent WSDLInterface Object
*/
- public void addSuperInterface(QName qName, WSDLInterface interfaceComponent);
+ public void addSuperInterface(WSDLInterface interfaceComponent);
/**
* Will return the StyleDefault if exist , otherwise will return null
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/ComponentImpl.java Fri Jan 28 03:23:12 2005
@@ -31,7 +31,7 @@
public class ComponentImpl implements WSDLConstants, Component{
protected HashMap componentProperties = new HashMap();
-
+
protected Document documentation = null;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/MessageReferenceImpl.java Fri Jan 28 03:23:12 2005
@@ -15,6 +15,8 @@
*/
package org.apache.wsdl.impl;
+import javax.xml.namespace.QName;
+
import org.apache.wsdl.MessageReference;
@@ -34,8 +36,8 @@
//TODO Do we need it "Message content model"
- //TODO can make it a QNAME value is a QName that needs to be resolved by the types element children
- private String element;
+
+ private QName element;
@@ -45,10 +47,21 @@
public void setDirection(String direction) {
Direction = direction;
}
- public String getElement() {
+
+ /**
+ * Returns an Element which refers to the actual message that will get transported. This Element
+ * Abstracts all the Message Parts that was defined in the WSDL 1.1.
+ */
+ public QName getElement() {
return element;
}
- public void setElement(String element) {
+
+
+ /**
+ * Sets the Element that will Abstract the actual message. All the parts defined in WSDL 1.1
+ * per message should be Encapsulated in this Element.
+ */
+ public void setElement(QName element) {
this.element = element;
}
public String getMessageLabel() {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLDescriptionImpl.java Fri Jan 28 03:23:12 2005
@@ -58,7 +58,7 @@
//TODO The object structure of some external xml data binding is going to be pluged here eventually.
- private Object[] types;
+ private WSDLTypes types;
/**
* This List will be a list of <code>WSDLInterface</code> objects.
@@ -213,10 +213,10 @@
public void setWsdlInterfaces(HashMap wsdlInterfaces) {
this.wsdlInterfaces = wsdlInterfaces;
}
- public Object[] getTypes() {
+ public WSDLTypes getTypes() {
return types;
}
- public void setTypes(Object[] types) {
+ public void setTypes(WSDLTypes types) {
this.types = types;
}
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLInterfaceImpl.java Fri Jan 28 03:23:12 2005
@@ -210,12 +210,11 @@
/**
* The Inteface will be added to the list of super interfaces keyed with
- * the QName.
- * @param qName The QName of the Inteface
+ * the QName.
* @param interfaceComponent WSDLInterface Object
*/
- public void addSuperInterface(QName qName, WSDLInterface interfaceComponent){
- this.superInterfaces.put(qName, interfaceComponent);
+ public void addSuperInterface(WSDLInterface interfaceComponent){
+ this.superInterfaces.put(interfaceComponent.getName(), interfaceComponent);
}
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/impl/WSDLServiceImpl.java Fri Jan 28 03:23:12 2005
@@ -45,7 +45,7 @@
/**
*
*/
- private HashMap endpoints;
+ private HashMap endpoints = new HashMap();
public HashMap getEndpoints() {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/util/Utils.java Fri Jan 28 03:23:12 2005
@@ -17,11 +17,15 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.Iterator;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.wsdl.WSDLTypes;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@@ -34,5 +38,14 @@
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
return db.parse(in);
+ }
+
+ public static WSDLTypes buildWSDL2ComplientMessageType(Message message){
+ Iterator messageTypeIterator = message.getParts().values().iterator();
+ if(1 == message.getParts().size() && messageTypeIterator.hasNext()){
+ Part part = (Part)messageTypeIterator.next();
+ /// new WSDLTypesImpl().set
+ }
+ return null;
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java?view=diff&rev=148875&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java&r1=148874&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java&r2=148875
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/InterfaceTest.java Fri Jan 28 03:23:12 2005
@@ -44,7 +44,7 @@
intfc.setOperation(op);
}
if(j>0){
- intfc.addSuperInterface(array[j-1].getName(), array[j-1]);
+ intfc.addSuperInterface(array[j-1]);
}
array[j] = intfc;
}
@@ -92,7 +92,7 @@
WSDLInterface inheritedInterface = new WSDLInterfaceImpl();
for(int i=0; i< array.length; i++){
- inheritedInterface.addSuperInterface(array[i].getName(), array[i]);
+ inheritedInterface.addSuperInterface(array[i]);
}
assertEquals(inheritedInterface.getAllOperations().size(),5);
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/WOMBuilderTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/WOMBuilderTest.java?view=auto&rev=148875
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/wsdl/WOMBuilderTest.java Fri Jan 28 03:23:12 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wsdl;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.axis.AbstractTestCase;
+import org.apache.axis.wsdl.wsdltowom.WOMBuilderFactory;
+import org.apache.wsdl.util.Utils;
+import org.w3c.dom.Document;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class WOMBuilderTest extends AbstractTestCase {
+
+ private WSDLDescription womDescription = null;
+
+ private Definition wsdl4jDefinition = null;
+
+ public WOMBuilderTest(String testName){
+ super(testName);
+ }
+
+ private void initialize()throws Exception{
+ if(null == this.womDescription){
+ InputStream in =new FileInputStream(this.getTestResourceFile("wsdl/SeismicService.wsdl"));
+ this.womDescription = WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in);
+ }
+ if(null == wsdl4jDefinition){
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ Document doc = Utils.newDocument(new FileInputStream(this.getTestResourceFile("wsdl/SeismicService.wsdl")));
+ this.wsdl4jDefinition = reader.readWSDL(null, doc);
+ }
+ }
+
+ public void testTopLevelComponentCount()throws Exception{
+ this.initialize();
+ assertEquals(womDescription.getServices().size(), wsdl4jDefinition.getServices().size());
+ assertEquals(womDescription.getWsdlInterfaces().size(), wsdl4jDefinition.getPortTypes().size());;
+ assertEquals(womDescription.getServices().size(), wsdl4jDefinition.getServices().size());
+ assertEquals(womDescription.getBindings().size(), wsdl4jDefinition.getBindings().size());
+ assertEquals(womDescription.getTypes().getTypes().size(), wsdl4jDefinition.getTypes().getExtensibilityElements().size());
+ }
+
+ public void testInterfacesComponent()throws Exception{
+ this.initialize();
+ Iterator interfaceIterator = this.womDescription.getWsdlInterfaces().values().iterator();
+ Iterator porttypeIterator = this.wsdl4jDefinition.getPortTypes().values().iterator();
+ while(interfaceIterator.hasNext() & porttypeIterator.hasNext()){
+ WSDLInterface wsdlInterface = (WSDLInterface)interfaceIterator.next();
+ PortType porttype = (PortType)porttypeIterator.next();
+ assertEquals(wsdlInterface.getName(), porttype.getQName());
+ assertEquals(wsdlInterface.getTargetnamespace(), porttype.getQName().getNamespaceURI());
+ assertEquals(wsdlInterface.getAllOperations().size(), porttype.getOperations().size());
+ Iterator womOperationIterator = wsdlInterface.getAllOperations().values().iterator();
+ Iterator wsdl4jOprationIterator = porttype.getOperations().iterator();
+ //Will only work if the order is retained in the iteration
+ while(womOperationIterator.hasNext() & wsdl4jOprationIterator.hasNext()){
+ this.operationsWaliking((WSDLOperation)womOperationIterator.next(), (Operation)wsdl4jOprationIterator.next());
+ }
+
+ }
+ }
+
+ public void testServiceComponent()throws Exception {
+ this.initialize();
+ Iterator womServiceIterator = this.womDescription.getServices().values().iterator();
+ Iterator wsdl4jServiceIterator = this.wsdl4jDefinition.getServices().values().iterator();
+
+ while(womServiceIterator.hasNext() & wsdl4jServiceIterator.hasNext()){
+ WSDLService wsdlService = (WSDLService)womServiceIterator.next();
+ Service wsdl4jService = (Service)wsdl4jServiceIterator.next();
+ assertEquals(wsdlService.getName(), wsdl4jService.getQName());
+// System.out.println(wsdlService.getServiceInterface());
+ }
+ }
+
+
+ private void operationsWaliking(WSDLOperation womOperation, Operation wsdl4jOperation){
+ assertEquals(womOperation.getName().getLocalPart(), wsdl4jOperation.getName());
+ //System.out.println(((ExtensibilityElement)wsdl4jDefinition.getTypes().getExtensibilityElements().get(1)).getElementType());
+// System.out.println(womOperation.getInputMessage().getMessageLabel());
+// System.out.println(wsdl4jOperation.getInput().getName());
+ //assertEquals(womOperation.getInputMessage().getMessageLabel(), wsdl4jOperation.getInput().getName());
+
+ }
+
+
+}