diff --git a/pom.xml b/pom.xml
index 1c58af7..7035a5f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -131,17 +131,13 @@
 			<version>1.6.13</version>
 		</dependency>
 -->
-		<dependency>
-			<groupId>org.inb.bsc</groupId>
-			<artifactId>tiny-xml-schema</artifactId>
-			<version>0.9.0</version>
-		</dependency>
 
-		<dependency>
-			<groupId>org.inb.bsc</groupId>
-			<artifactId>tiny-wsdl</artifactId>
-			<version>0.9.0</version>
-		</dependency>
+                <dependency>
+                    <groupId>org.apache.woden</groupId>
+                    <artifactId>woden</artifactId>
+                    <version>1.0M9</version>
+                </dependency>
+                
 		<dependency>
 			<groupId>javax.xml.rpc</groupId>
 			<artifactId>com.springsource.javax.xml.rpc</artifactId>
@@ -161,13 +157,19 @@
 	</dependencies>
 
 	<repositories>
-		<repository>
-			<id>inb-repository</id>
-			<name>INB Repository</name>
-			<url>http://moby-dev.inab.org/m2</url>
-		</repository>
 
-            
+                <repository>
+                    <id>Snaplogic-Maven-Repository</id>
+                    <name>Snaplogic Maven Repository</name>
+                    <url>http://maven.snaplogic.org/content/groups/public/</url>
+                    <releases>
+                        <enabled>true</enabled>
+                    </releases>
+                    <snapshots>
+                        <enabled>false</enabled>
+                    </snapshots>
+                </repository>
+
 		<repository>
 			<id>mygrid-repository</id>
 			<name>myGrid Repository</name>
diff --git a/src/main/java/net/sf/taverna/wsdl/parser/WSDL11Parser.java b/src/main/java/net/sf/taverna/wsdl/parser/WSDL11Parser.java
index a67bde6..e8e59fe 100644
--- a/src/main/java/net/sf/taverna/wsdl/parser/WSDL11Parser.java
+++ b/src/main/java/net/sf/taverna/wsdl/parser/WSDL11Parser.java
@@ -233,6 +233,7 @@
     }
     
     @Deprecated
+    @Override
     public String getOperationEndpointLocation(String operationName) throws UnknownOperationException {
         return getSoapAddress(findPort(operationName));
     }
@@ -262,6 +263,7 @@
      * 
      * @throws UnknownOperationException 
      */
+    @Override
     public QName getRPCRequestMethodName(String portName, String operationName) throws UnknownOperationException {
         if (portName == null) {
             portName = findPort(operationName);
@@ -299,6 +301,7 @@
      * 
      * @throws UnknownOperationException 
      */
+    @Override
     public QName getRPCResponseMethodName(String portName, String operationName) throws UnknownOperationException {
         if (portName == null) {
             portName = findPort(operationName);
@@ -379,6 +382,7 @@
         return getOutputParameters(null, operationName);
     }
     
+    @Override
     public LinkedHashMap<String, XmlSchemaObject> getOutputParameters(String portName, String operationName) throws UnknownOperationException {
         if (portName == null) {
             portName = findPort(operationName);
diff --git a/src/main/java/net/sf/taverna/wsdl/parser/WSDL20Parser.java b/src/main/java/net/sf/taverna/wsdl/parser/WSDL20Parser.java
index 14c25d5..4f05416 100644
--- a/src/main/java/net/sf/taverna/wsdl/parser/WSDL20Parser.java
+++ b/src/main/java/net/sf/taverna/wsdl/parser/WSDL20Parser.java
@@ -41,22 +41,27 @@
 import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
+import org.apache.woden.WSDLFactory;
+import org.apache.woden.WSDLReader;
+import org.apache.woden.XMLElement;
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.BindingOperation;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.Endpoint;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceMessageReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.extensions.ExtensionProperty;
+import org.apache.woden.wsdl20.extensions.soap.SOAPConstants;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.DocumentationElement;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.inb.bsc.wsdl20.Binding;
-import org.inb.bsc.wsdl20.BindingOperation;
-import org.inb.bsc.wsdl20.Description;
-import org.inb.bsc.wsdl20.ElementDeclaration;
-import org.inb.bsc.wsdl20.Endpoint;
-import org.inb.bsc.wsdl20.Interface;
-import org.inb.bsc.wsdl20.InterfaceMessageReference;
-import org.inb.bsc.wsdl20.InterfaceOperation;
-import org.inb.bsc.wsdl20.Service;
-import static org.inb.bsc.wsdl20.extensions.soap.SOAPBindingOperationExtensions.SOAP_ACTION_ATTR;
-import org.inb.bsc.wsdl20.factory.WSDL2Factory;
-import org.inb.bsc.wsdl20.xml.WSDL2Reader;
 import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
 
 /**
  * @author Dmitry Repchevsky
@@ -76,14 +81,15 @@
 
     @Override
     public String getDocumentBaseURI() {
-        URI documentBaseURI = description.getDocumentBaseURI();
+        DescriptionElement element = description.toElement();
+        URI documentBaseURI = element.getDocumentBaseURI();
         return documentBaseURI == null ? null : documentBaseURI.toString();
     }
 
     @Override
     public List<QName> getServices() {
         List<QName> services = new ArrayList<QName>();
-        for (Service service : description.getAllServices()) {
+        for (Service service : description.getServices()) {
             services.add(service.getName());
         }
         return services;
@@ -91,20 +97,37 @@
 
     @Override
     public List<String> getPorts(QName serviceName) {
-        List<String> interfaces = new ArrayList<String>();
-        for (Interface _interface : description.getAllInterfaces()) {
-            interfaces.add(_interface.getName().getLocalPart());
+        List<String> ports = new ArrayList<String>();
+        
+        Service service = description.getService(serviceName);
+        if (service != null) {
+            for (Endpoint endpoint : service.getEndpoints()) {
+                final NCName endpointName = endpoint.getName();
+                if (endpointName != null) {
+                    ports.add(endpointName.toString());
+                }
+            }
         }
-        return interfaces;
+        return ports;
     }
 
     @Override
     public List<String> getOperations(String portName) {
         List<String> operations = new ArrayList<String>();
-        for (Interface _interface : description.getAllInterfaces()) {
-            if (portName.equals(_interface.getName().getLocalPart())) {
-                for (InterfaceOperation operation : _interface.getAllInterfaceOperations()) {
-                    operations.add(operation.getName().getLocalPart());
+        
+        for (Service service : description.getServices()) {
+            for (Endpoint endpoint : service.getEndpoints()) {
+                final NCName endpointName = endpoint.getName();
+                if (endpointName != null && endpointName.toString().equals(portName)) {
+                    Binding binding = endpoint.getBinding();
+                    if (binding != null) {
+                        for (BindingOperation bindingOperation : binding.getBindingOperations()) {
+                            InterfaceOperation interfaceOperation = bindingOperation.getInterfaceOperation();
+                            if (interfaceOperation != null) {
+                                operations.add(interfaceOperation.getName().getLocalPart());
+                            }
+                        }
+                    }
                 }
             }
         }
@@ -123,27 +146,17 @@
 
     @Override
     public String getSOAPActionURI(String portName, String operationName) throws UnknownOperationException {
-        for (Binding binding : description.getAllBindings()) {
-            if (portName != null) {
-                Interface _interface = binding.getInterface();
-                if (_interface == null || !portName.equals(_interface.getName().getLocalPart())) {
-                    continue;
-                }
-            }    
-        
-            for (BindingOperation o : binding.getBindingOperations()) {
-                InterfaceOperation operation = o.getInterfaceOperation();
-                if (operation != null && operationName.equals(operation.getName().getLocalPart())) {
-                    return operation.getExtensionAttribute(SOAP_ACTION_ATTR);
-                }
-            }
-        }
-        return null;
+        BindingOperation bindingOperation = getBindingOperation(portName, operationName);
+        InterfaceOperation interfaceOperation = bindingOperation.getInterfaceOperation();
+
+        ExtensionProperty property = interfaceOperation.getExtensionProperty(SOAPConstants.NS_URI_SOAP, SOAPConstants.ATTR_ACTION);
+        return property == null ? null : property.getContent().toString();
     }
 
     @Override
     public QName getRPCRequestMethodName(String portName, String operationName) throws UnknownOperationException {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        // NO RPC SUPPORT YET
+        return new QName(operationName);
     }
 
     @Override
@@ -164,15 +177,12 @@
 
     @Override
     public String getSoapAddress(String portName) {
-        for (Service service : description.getAllServices()) {
+        for (Service service : description.getServices()) {
             for (Endpoint endpoint : service.getEndpoints()) {
-                Binding binding = endpoint.getBinding();
-                if (binding != null) {
-                    Interface _interface = binding.getInterface();
-                    if (_interface != null && portName.equals(_interface.getName().getLocalPart())) {
-                        URI address = endpoint.getAddress();
-                        return address == null ? null : address.toString();
-                    }
+                final NCName endpointName = endpoint.getName();
+                if (endpointName != null && endpointName.toString().equals(portName)) {
+                    URI address = endpoint.getAddress();
+                    return address == null ? null : address.toString();
                 }
             }    
         }
@@ -181,7 +191,7 @@
 
     @Override
     public String getOperationEndpointLocation(String operationName) throws UnknownOperationException {
-        for (Service service : description.getAllServices()) {
+        for (Service service : description.getServices()) {
             for (Endpoint endpoint : service.getEndpoints()) {
                 Binding binding = endpoint.getBinding();
                 if (binding != null) {
@@ -201,23 +211,25 @@
     @Override
     public String getOperationDocumentation(String portName, String operationName) throws UnknownOperationException {
         Writer writer = new StringWriter();
-        for (Interface _interface : description.getAllInterfaces()) {
-            if (portName == null || portName.equals(_interface.getName().getLocalPart())) {
-                for (InterfaceOperation operation : _interface.getAllInterfaceOperations()) {
-                    if (operationName.equals(operation.getName().getLocalPart())) {
-                        try {
-                            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-                            for (Element element : operation.getDocumentationElements()) {
-                                try {
-                                    transformer.transform(new DOMSource(element), new StreamResult(writer));
-                                } catch (TransformerException ex) {}
-                            }
-                        } catch (TransformerFactoryConfigurationError ex) {}
-                        catch (TransformerConfigurationException ex) {}
-                    }
+        
+        BindingOperation bindingOperation = getBindingOperation(portName, operationName);
+        InterfaceOperation interfaceOperation = bindingOperation.getInterfaceOperation();
+
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            for (DocumentationElement documentation : interfaceOperation.toElement().getDocumentationElements()) {
+                XMLElement xml = documentation.getContent();
+                Object source = xml.getSource();
+                if (source instanceof Element) {
+                    Element element = (Element)source;
+                    try {
+                        transformer.transform(new DOMSource(element), new StreamResult(writer));
+                    } catch (TransformerException ex) {}
                 }
             }
-        }
+        } catch (TransformerFactoryConfigurationError ex) {}
+          catch (TransformerConfigurationException ex) {}
+        
         return writer.toString();
     }
 
@@ -225,18 +237,14 @@
     public LinkedHashMap<String, XmlSchemaObject> getInputParameters(String portName, String operationName) throws UnknownOperationException {
         LinkedHashMap<String, XmlSchemaObject> parameters = new LinkedHashMap<String, XmlSchemaObject>();
 
+        BindingOperation bindingOperation = getBindingOperation(portName, operationName);
+        InterfaceOperation interfaceOperation = bindingOperation.getInterfaceOperation();
+        
         // NOTE THAT THIS CODE IS NOT VALID FOR "RPC" STYLE
-        for (Interface _interface : description.getAllInterfaces()) {
-            if (portName == null || portName.equals(_interface.getName().getLocalPart())) {
-                for (InterfaceOperation operation : _interface.getAllInterfaceOperations()) {
-                    if (operationName.equals(operation.getName().getLocalPart())) {
-                        for (InterfaceMessageReference input : operation.getInputs()) {
-                            ElementDeclaration element = input.getElementDeclaration();
-                            parameters.put(element.getName().getLocalPart(), (XmlSchemaObject)element.getContent());
-                        }
-                        return parameters;
-                    }
-                }
+        for (InterfaceMessageReference input : interfaceOperation.getInterfaceMessageReferences()) {
+            if (Direction.IN == input.getDirection()) {
+                ElementDeclaration element = input.getElementDeclaration();
+                parameters.put(element.getName().getLocalPart(), (XmlSchemaObject)element.getContent());
             }
         }
         return parameters;
@@ -246,21 +254,55 @@
     public LinkedHashMap<String, XmlSchemaObject> getOutputParameters(String portName, String operationName) throws UnknownOperationException {
         LinkedHashMap<String, XmlSchemaObject> parameters = new LinkedHashMap<String, XmlSchemaObject>();
         
+        BindingOperation bindingOperation = getBindingOperation(portName, operationName);
+        InterfaceOperation interfaceOperation = bindingOperation.getInterfaceOperation();
+        
         // NOTE THAT THIS CODE IS NOT VALID FOR "RPC" STYLE
-        for (Interface _interface : description.getAllInterfaces()) {
-            if (portName == null || portName.equals(_interface.getName().getLocalPart())) {
-                for (InterfaceOperation operation : _interface.getAllInterfaceOperations()) {
-                    if (operationName.equals(operation.getName().getLocalPart())) {
-                        for (InterfaceMessageReference output : operation.getOutputs()) {
-                            ElementDeclaration element = output.getElementDeclaration();
-                            parameters.put(element.getName().getLocalPart(), (XmlSchemaObject)element.getContent());
+        for (InterfaceMessageReference output : interfaceOperation.getInterfaceMessageReferences()) {
+            if (Direction.OUT == output.getDirection()) {
+                ElementDeclaration element = output.getElementDeclaration();
+                parameters.put(element.getName().getLocalPart(), (XmlSchemaObject)element.getContent());
+            }
+        }
+        return parameters;
+    }
+    
+    private BindingOperation getBindingOperation(String portName, String operationName) throws UnknownOperationException {
+        
+        Binding[] bindings = null;
+        if (portName == null) {
+            bindings = description.getBindings();
+        } else {
+            loop:
+            for (Service service : description.getServices()) {
+                for (Endpoint endpoint : service.getEndpoints()) {
+                    final NCName endpointName = endpoint.getName();
+                    if (endpointName != null && endpointName.toString().equals(portName)) {
+                        Binding binding = endpoint.getBinding();
+                        if (binding != null) {
+                            bindings = new Binding[] {binding};
+                            break loop;
                         }
-                        return parameters;
+                    }
+                }
+            }
+            if (bindings == null) {
+                bindings = description.getBindings();
+            }
+        }
+
+        if (bindings != null) {
+            for (Binding binding : bindings) {
+                for (BindingOperation bindingOperation : binding.getBindingOperations()) {
+                    InterfaceOperation interfaceOperation = bindingOperation.getInterfaceOperation();
+                    if (interfaceOperation != null && operationName.equals(interfaceOperation.getName().getLocalPart())) {
+                        return bindingOperation;
                     }
                 }
             }
         }
-        return parameters;
+
+        throw new UnknownOperationException("Unknown operation: " + operationName);
     }
     
     public static synchronized WSDL20Parser getWSDL20Parser(String wsdlLocation) throws Exception {
@@ -273,10 +315,10 @@
         }
         
         if (parser == null) {
-            WSDL2Factory factory = WSDL2Factory.newInstance();
-            WSDL2Reader reader = factory.getWSLD2Reader();
-            InputSource source = new InputSource(wsdlLocation);
-            Description description = reader.read(source);
+            WSDLFactory factory = WSDLFactory.newInstance();
+            WSDLReader reader = factory.newWSDLReader();
+            reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
+            Description description = reader.readWSDL(wsdlLocation);
 
             parser = new WSDL20Parser(description);
             
