Index: src/com/ibm/wsdl/BindingImpl.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/BindingImpl.java,v retrieving revision 1.1.1.1 diff -w -u -r1.1.1.1 BindingImpl.java --- src/com/ibm/wsdl/BindingImpl.java 20 Jun 2001 14:03:40 -0000 1.1.1.1 +++ src/com/ibm/wsdl/BindingImpl.java 18 Jun 2002 16:41:28 -0000 @@ -90,6 +90,8 @@ String inputName, String outputName) { + BindingOperation bo = null; + boolean found = false; Iterator opBindingIterator = bindingOperations.iterator(); while (opBindingIterator.hasNext()) @@ -117,15 +119,11 @@ { String opInputName = input.getName(); - if (opInputName == null || !opInputName.equals(inputName)) + if (opInputName != null && !opInputName.equals(inputName)) { op = null; } } - else - { - op = null; - } } if (op != null && outputName != null) @@ -136,24 +134,28 @@ { String opOutputName = output.getName(); - if (opOutputName == null || !opOutputName.equals(outputName)) + if (opOutputName != null && !opOutputName.equals(outputName)) { op = null; } } - else - { - op = null; - } } if (op != null) { - return op; + if (found == true) + { + return null; //throw an exception?????? + } + else + { + found = true; + bo = op; + } } } - return null; + return bo; } /** Index: src/com/ibm/wsdl/Constants.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/Constants.java,v retrieving revision 1.4 diff -w -u -r1.4 Constants.java --- src/com/ibm/wsdl/Constants.java 25 Jan 2002 04:25:47 -0000 1.4 +++ src/com/ibm/wsdl/Constants.java 18 Jun 2002 16:41:28 -0000 @@ -88,4 +88,6 @@ public static final String FEATURE_VERBOSE = "javax.wsdl.verbose"; public static final String FEATURE_IMPORT_DOCUMENTS = "javax.wsdl.importDocuments"; + public static final String FEATURE_TOLERATE_UNQUALIFIED_QNAMES = + "javax.wsdl.tolerateUnqualifiedQNames"; } Index: src/com/ibm/wsdl/DefinitionImpl.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/DefinitionImpl.java,v retrieving revision 1.5 diff -w -u -r1.5 DefinitionImpl.java --- src/com/ibm/wsdl/DefinitionImpl.java 18 Jan 2002 21:24:43 -0000 1.5 +++ src/com/ibm/wsdl/DefinitionImpl.java 18 Jun 2002 16:41:29 -0000 @@ -4,6 +4,7 @@ import org.w3c.dom.*; import javax.wsdl.*; import javax.wsdl.extensions.*; +import com.ibm.wsdl.util.StringUtils; import com.ibm.wsdl.util.xml.*; /** @@ -166,7 +167,7 @@ String prefix = (String)entry.getKey(); String assocNamespaceURI = (String)entry.getValue(); - if (namespaceURI.equals(assocNamespaceURI)) + if (StringUtils.areURIsEquivalent(namespaceURI, assocNamespaceURI)) { return prefix; } Index: src/com/ibm/wsdl/PartImpl.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/PartImpl.java,v retrieving revision 1.1.1.1 diff -w -u -r1.1.1.1 PartImpl.java --- src/com/ibm/wsdl/PartImpl.java 20 Jun 2001 14:03:40 -0000 1.1.1.1 +++ src/com/ibm/wsdl/PartImpl.java 18 Jun 2002 16:41:29 -0000 @@ -2,6 +2,7 @@ import org.w3c.dom.*; import javax.wsdl.*; +import java.util.*; /** * This class represents a message part and contains the part's @@ -17,6 +18,7 @@ protected QName elementName = null; protected QName typeName = null; protected Element docEl = null; + protected HashMap extAttrMap = new HashMap(); /** * Set the name of this part. @@ -98,6 +100,43 @@ strBuf.append("\ntypeName=" + typeName); } + Iterator extAtts = getExtensionAttributeNames(); + while (extAtts.hasNext()) + { + QName aName = (QName) extAtts.next(); + QName aValue = (QName) getExtensionAttribute(aName); + strBuf.append("\n"+aName+"="+aValue); + } + return strBuf.toString(); + } + + public void setExtensionAttribute(QName name, QName value) + throws WSDLException + { + String lName = name.getLocalPart(); + String nSpace = name.getNamespaceURI(); + if (lName == null) return; + if ((nSpace.equals("") || nSpace.equals(Constants.NS_URI_WSDL)) + && (lName.equals(Constants.ATTR_NAME) + || lName.equals(Constants.ATTR_ELEMENT) + || lName.equals(Constants.ATTR_TYPE))) + { + throw new WSDLException( + WSDLException.OTHER_ERROR, + "Extension attribute duplicates standard attribute."); + } + if (value == null) extAttrMap.remove(name); + else extAttrMap.put(name, value); + } + + public Iterator getExtensionAttributeNames() + { + return extAttrMap.keySet().iterator(); + } + + public QName getExtensionAttribute(QName name) + { + return (QName) extAttrMap.get(name); } } Index: src/com/ibm/wsdl/extensions/soap/SOAPFaultSerializer.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/extensions/soap/SOAPFaultSerializer.java,v retrieving revision 1.3 diff -w -u -r1.3 SOAPFaultSerializer.java --- src/com/ibm/wsdl/extensions/soap/SOAPFaultSerializer.java 30 Nov 2001 04:27:53 -0000 1.3 +++ src/com/ibm/wsdl/extensions/soap/SOAPFaultSerializer.java 18 Jun 2002 16:41:29 -0000 @@ -5,6 +5,8 @@ import javax.wsdl.*; import javax.wsdl.extensions.*; import javax.wsdl.extensions.soap.*; +import javax.wsdl.xml.*; +import javax.wsdl.factory.*; import com.ibm.wsdl.*; import com.ibm.wsdl.util.*; import com.ibm.wsdl.util.xml.*; @@ -67,10 +69,19 @@ { SOAPFault soapFault = (SOAPFault)extReg.createExtension(parentType, elementType); - QName message = DOMUtils.getQualifiedAttributeValue(el, + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader wsdlReader = factory.newWSDLReader(); + QName message = wsdlReader.getFeature(Constants.FEATURE_TOLERATE_UNQUALIFIED_QNAMES) + ? DOMUtils.getQualifiedAttributeValue(el, + Constants.ATTR_MESSAGE, + SOAPConstants.ELEM_HEADER, + def.getTargetNamespace(), + false) + : DOMUtils.getQualifiedAttributeValue(el, Constants.ATTR_MESSAGE, SOAPConstants.ELEM_HEADER, false); + String name = DOMUtils.getAttribute(el, Constants.ATTR_NAME); String use = DOMUtils.getAttribute(el, SOAPConstants.ATTR_USE); String encStyleStr = DOMUtils.getAttribute(el, Index: src/com/ibm/wsdl/extensions/soap/SOAPHeaderSerializer.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/extensions/soap/SOAPHeaderSerializer.java,v retrieving revision 1.3 diff -w -u -r1.3 SOAPHeaderSerializer.java --- src/com/ibm/wsdl/extensions/soap/SOAPHeaderSerializer.java 30 Nov 2001 04:27:53 -0000 1.3 +++ src/com/ibm/wsdl/extensions/soap/SOAPHeaderSerializer.java 18 Jun 2002 16:41:29 -0000 @@ -6,6 +6,8 @@ import javax.wsdl.*; import javax.wsdl.extensions.*; import javax.wsdl.extensions.soap.*; +import javax.wsdl.xml.*; +import javax.wsdl.factory.*; import com.ibm.wsdl.*; import com.ibm.wsdl.util.*; import com.ibm.wsdl.util.xml.*; @@ -133,11 +135,19 @@ { SOAPHeader soapHeader = (SOAPHeader)extReg.createExtension(parentType, elementType); - QName message = - DOMUtils.getQualifiedAttributeValue(el, + WSDLFactory factory = WSDLFactory.newInstance(); + WSDLReader wsdlReader = factory.newWSDLReader(); + QName message = wsdlReader.getFeature(Constants.FEATURE_TOLERATE_UNQUALIFIED_QNAMES) + ? DOMUtils.getQualifiedAttributeValue(el, + Constants.ATTR_MESSAGE, + SOAPConstants.ELEM_HEADER, + def.getTargetNamespace(), + false) + : DOMUtils.getQualifiedAttributeValue(el, Constants.ATTR_MESSAGE, SOAPConstants.ELEM_HEADER, false); + String part = DOMUtils.getAttribute(el, SOAPConstants.ATTR_PART); String use = DOMUtils.getAttribute(el, SOAPConstants.ATTR_USE); String encStyleStr = DOMUtils.getAttribute(el, Index: src/com/ibm/wsdl/util/StringUtils.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/util/StringUtils.java,v retrieving revision 1.2 diff -w -u -r1.2 StringUtils.java --- src/com/ibm/wsdl/util/StringUtils.java 5 Dec 2001 18:27:45 -0000 1.2 +++ src/com/ibm/wsdl/util/StringUtils.java 18 Jun 2002 16:41:29 -0000 @@ -362,17 +362,16 @@ if (content instanceof InputStream) { - Reader in = null; + Reader in; - /* - Create an InputStreamReader appropriate to the codepage of the - URL content. If the content is from the local file system, the - encoding can be defaulted. Otherwise, assume an ISO Latin 1 - encoding. + /* Create an InputStreamReader appropriate to the codepage of the URL content. + If the content is from the local file system, the encoding can be defaulted. + Otherwise, assume an ISO Latin 1 encoding. */ if (url.getProtocol().equals("file")) { in = new InputStreamReader((InputStream)content); + if (!in.ready()) throw new FileNotFoundException(); } else { @@ -443,4 +442,34 @@ return null; } } + + public static boolean areURIsEquivalent(String uri1, String uri2) + { + // If the object references are identical then they are the same object! + // Also returns true if they're both null + if (uri1 == uri2) return true; + + // If either one of them is now null, then they aren't the same! + if (uri1 == null || uri2 == null) return false; + + // If they are equal then they are of course equivalent + if (uri1.equals(uri2)) return true; + + // Remove or add trailing / to uri2 as necessary + String uri2Equiv = uri2; + if (uri1.endsWith("/")) { + if (!uri2.endsWith("/")) { + uri2Equiv = uri2 + '/'; + } + } else { + // uri1 doesn't have trailing / + if (uri2.endsWith("/")) { + // but uri2 does so remove it + uri2Equiv = uri2.substring(0, uri2.length()-1); + } + } + // Now do the comparison + if (!uri1.equals(uri2Equiv)) return false; + return true; + } } Index: src/com/ibm/wsdl/util/xml/DOMUtils.java =================================================================== RCS file: /usr/cvs/wsdl4j/wsdl4j/src/com/ibm/wsdl/util/xml/DOMUtils.java,v retrieving revision 1.2 diff -w -u -r1.2 DOMUtils.java --- src/com/ibm/wsdl/util/xml/DOMUtils.java 27 Nov 2001 05:51:57 -0000 1.2 +++ src/com/ibm/wsdl/util/xml/DOMUtils.java 18 Jun 2002 16:41:29 -0000 @@ -3,6 +3,8 @@ import java.io.*; import org.w3c.dom.*; import javax.wsdl.*; +import java.util.*; +import com.ibm.wsdl.Constants; public class DOMUtils { /** @@ -30,6 +32,39 @@ } /** + * Returns the a HashMap of the attributes of an element. + * Element.getAttributes returns a NamedNodeMap + * + * @param el Element whose attributes are being looked for + * @return the attributes + */ + static public Map getAttributes (Element el) throws WSDLException { + HashMap attributes = new HashMap(); + NamedNodeMap nodeMap = el.getAttributes(); + int atts = nodeMap.getLength(); + for (int a=0; a