stevel 2003/01/25 11:35:33 Modified: java/src/org/apache/axis/handlers/soap SOAPService.java java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java java/src/org/apache/axis/deployment/wsdd WSDDJAXRPCHandlerInfo.java WSDDJAXRPCHandlerInfoChain.java Log: more tabs to spaces; cvs is playing up and wont bulk commit. Revision Changes Path 1.92 +11 -11 xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java Index: SOAPService.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v retrieving revision 1.91 retrieving revision 1.92 diff -u -r1.91 -r1.92 --- SOAPService.java 20 Dec 2002 17:28:23 -0000 1.91 +++ SOAPService.java 25 Jan 2003 19:35:33 -0000 1.92 @@ -464,17 +464,17 @@ this.sendType = sendType; } - public void invoke(MessageContext msgContext) throws AxisFault { - HandlerInfoChainFactory handlerFactory = (HandlerInfoChainFactory) this.getOption(Constants.ATTR_HANDLERINFOCHAIN); - HandlerChainImpl handlerImpl = null; - if (handlerFactory != null) handlerImpl = (HandlerChainImpl) handlerFactory.createHandlerChain(); - if (handlerImpl != null) handlerImpl.handleRequest(msgContext); + public void invoke(MessageContext msgContext) throws AxisFault { + HandlerInfoChainFactory handlerFactory = (HandlerInfoChainFactory) this.getOption(Constants.ATTR_HANDLERINFOCHAIN); + HandlerChainImpl handlerImpl = null; + if (handlerFactory != null) handlerImpl = (HandlerChainImpl) handlerFactory.createHandlerChain(); + if (handlerImpl != null) handlerImpl.handleRequest(msgContext); - super.invoke(msgContext); + super.invoke(msgContext); - if ( handlerImpl != null) { - handlerImpl.handleResponse(msgContext); - handlerImpl.destroy(); - } - } + if ( handlerImpl != null) { + handlerImpl.handleResponse(msgContext); + handlerImpl.destroy(); + } + } } 1.72 +180 -180 xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java Index: SymbolTable.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- SymbolTable.java 20 Jan 2003 18:06:59 -0000 1.71 +++ SymbolTable.java 25 Jan 2003 19:35:33 -0000 1.72 @@ -792,19 +792,19 @@ if (includeName != null) { URL url = getURL(context, includeName); Document includeDoc = XMLUtils.newDocument(url.toString()); - // Vidyanand : Fix for Bug #15124 - org.w3c.dom.Element schemaEl = includeDoc.getDocumentElement(); - if( !schemaEl.hasAttribute( "targetNamespace")){ - org.w3c.dom.Element parentSchemaEl = (org.w3c.dom.Element) node.getParentNode(); - if( parentSchemaEl.hasAttribute( "targetNamespace")) { - // we need to set two things in here - // 1. targetNamespace - // 2. setup the xmlns=<targetNamespace> attribute - String tns = parentSchemaEl.getAttribute( "targetNamespace"); - schemaEl.setAttribute( "targetNamespace",tns ); - schemaEl.setAttribute( "xmlns", tns); - } - } + // Vidyanand : Fix for Bug #15124 + org.w3c.dom.Element schemaEl = includeDoc.getDocumentElement(); + if( !schemaEl.hasAttribute( "targetNamespace")){ + org.w3c.dom.Element parentSchemaEl = (org.w3c.dom.Element) node.getParentNode(); + if( parentSchemaEl.hasAttribute( "targetNamespace")) { + // we need to set two things in here + // 1. targetNamespace + // 2. setup the xmlns=<targetNamespace> attribute + String tns = parentSchemaEl.getAttribute( "targetNamespace"); + schemaEl.setAttribute( "targetNamespace",tns ); + schemaEl.setAttribute( "xmlns", tns); + } + } populate(url, null, includeDoc, url.toString()); } } @@ -1026,121 +1026,121 @@ } } // populateMessages - /** - * ensures that a message in a <code><input></code>, <code><output></code>, - * or <code><fault></fault> element in an <code><operation></code> - * element is valid. In particular, ensures that - * <ol> - * <li>an attribute <code>message</code> is present (according to the - * XML Schema for WSDL 1.1 <code>message</code> is <strong>required</strong> - * - * <li>the value of attribute <code>message</code> (a QName) refers to - * an already defined message - * </ol> - * - * <strong>Note</strong>: this method should throw a <code>javax.wsdl.WSDLException</code> rather than - * a <code>java.io.IOException</code> - * - * @param message the message object - * - * @exception IOException thrown, if the message is not valid - * - */ - protected void ensureOperationMessageValid(Message message) throws IOException { - - // make sure the message is not null (i.e. there is an - // attribute 'message ') - // - if (message == null) { - throw new IOException( - "<input>,<output>, or <fault> in <operation ..> without attribute 'message' found. Attribute 'message' is required." - ); - } - - // make sure the value of the attribute refers to an - // already defined message - // - if (message.isUndefined()) { - throw new IOException( - "<input ..>, <output ..> or <fault ..> in <portType> with undefined message found. message name is '" - + message.getQName().toString() - + "'" - ); - } - } - - - /** - * ensures that an an element <code><operation></code> within - * an element <code><portType><code> is valid. Throws an exception - * if the operation is not valid. - * - * <strong>Note</strong>: this method should throw a <code>javax.wsdl.WSDLException</code> - * rather than a <code>java.io.IOException</code> - * - * @param operation the operation element - * - * @exception IOException thrown, if the element is not valid. - * @exception IllegalArgumentException thrown, if operation is null - */ - protected void ensureOperationValid(Operation operation) throws IOException { - - if (operation == null) { - throw new IllegalArgumentException("parameter 'operation' must not be null"); - } - - Input input = operation.getInput(); - if (input != null) { - ensureOperationMessageValid(input.getMessage()); - } - - Output output = operation.getOutput(); - if (output != null) { - ensureOperationMessageValid(output.getMessage()); - } - - Map faults = operation.getFaults(); - if (faults != null) { - Iterator it = faults.values().iterator(); - while(it.hasNext()) { - ensureOperationMessageValid( - ((Fault)it.next()).getMessage() - ); - } - } - } - - /** - * ensures that an an element <code><portType></code> - * is valid. Throws an exception if the portType is not valid. - * - * <strong>Note</strong>: this method should throw a <code>javax.wsdl.WSDLException</code> - * rather than a <code>java.io.IOException</code> - * - * @param portType the portType element - * - * @exception IOException thrown, if the element is not valid. - * @exception IllegalArgumentException thrown, if operation is null - */ - - protected void ensureOperationsOfPortTypeValid(PortType portType) throws IOException { - if (portType == null) - throw new IllegalArgumentException("parameter 'portType' must not be null"); - + /** + * ensures that a message in a <code><input></code>, <code><output></code>, + * or <code><fault></fault> element in an <code><operation></code> + * element is valid. In particular, ensures that + * <ol> + * <li>an attribute <code>message</code> is present (according to the + * XML Schema for WSDL 1.1 <code>message</code> is <strong>required</strong> + * + * <li>the value of attribute <code>message</code> (a QName) refers to + * an already defined message + * </ol> + * + * <strong>Note</strong>: this method should throw a <code>javax.wsdl.WSDLException</code> rather than + * a <code>java.io.IOException</code> + * + * @param message the message object + * + * @exception IOException thrown, if the message is not valid + * + */ + protected void ensureOperationMessageValid(Message message) throws IOException { + + // make sure the message is not null (i.e. there is an + // attribute 'message ') + // + if (message == null) { + throw new IOException( + "<input>,<output>, or <fault> in <operation ..> without attribute 'message' found. Attribute 'message' is required." + ); + } + + // make sure the value of the attribute refers to an + // already defined message + // + if (message.isUndefined()) { + throw new IOException( + "<input ..>, <output ..> or <fault ..> in <portType> with undefined message found. message name is '" + + message.getQName().toString() + + "'" + ); + } + } + + + /** + * ensures that an an element <code><operation></code> within + * an element <code><portType><code> is valid. Throws an exception + * if the operation is not valid. + * + * <strong>Note</strong>: this method should throw a <code>javax.wsdl.WSDLException</code> + * rather than a <code>java.io.IOException</code> + * + * @param operation the operation element + * + * @exception IOException thrown, if the element is not valid. + * @exception IllegalArgumentException thrown, if operation is null + */ + protected void ensureOperationValid(Operation operation) throws IOException { + + if (operation == null) { + throw new IllegalArgumentException("parameter 'operation' must not be null"); + } + + Input input = operation.getInput(); + if (input != null) { + ensureOperationMessageValid(input.getMessage()); + } + + Output output = operation.getOutput(); + if (output != null) { + ensureOperationMessageValid(output.getMessage()); + } + + Map faults = operation.getFaults(); + if (faults != null) { + Iterator it = faults.values().iterator(); + while(it.hasNext()) { + ensureOperationMessageValid( + ((Fault)it.next()).getMessage() + ); + } + } + } + + /** + * ensures that an an element <code><portType></code> + * is valid. Throws an exception if the portType is not valid. + * + * <strong>Note</strong>: this method should throw a <code>javax.wsdl.WSDLException</code> + * rather than a <code>java.io.IOException</code> + * + * @param portType the portType element + * + * @exception IOException thrown, if the element is not valid. + * @exception IllegalArgumentException thrown, if operation is null + */ + + protected void ensureOperationsOfPortTypeValid(PortType portType) throws IOException { + if (portType == null) + throw new IllegalArgumentException("parameter 'portType' must not be null"); + List operations = portType.getOperations(); // no operations defined ? -> valid according to the WSDL 1.1 schema // if (operations == null || operations.size() == 0) return; - // check operations defined in this portType - // + // check operations defined in this portType + // Iterator it = operations.iterator(); while(it.hasNext()) { - Operation operation = (Operation)it.next(); - ensureOperationValid(operation); + Operation operation = (Operation)it.next(); + ensureOperationValid(operation); } - } + } /** * Populate the symbol table with all of the PortTypeEntry's from the Definition. @@ -1155,7 +1155,7 @@ // that didn't contain a portType, merely a binding that referred // to a non-existent port type. Don't bother with it. if (!portType.isUndefined()) { - ensureOperationsOfPortTypeValid(portType); + ensureOperationsOfPortTypeValid(portType); PortTypeEntry ptEntry = new PortTypeEntry(portType); symbolTablePut(ptEntry); } @@ -2174,58 +2174,58 @@ * @see javax.wsdl.Port */ private void populatePorts(Map ports) throws IOException { - if (ports == null) return; - Iterator it = ports.values().iterator(); - while(it.hasNext()) { - - Port port = (Port)it.next(); - String portName = port.getName(); - Binding portBinding = port.getBinding(); - - // make sure there is a port name. The 'name' attribute for WSDL ports is - // mandatory - // - if (portName == null){ - //REMIND: should rather be a javax.wsdl.WSDLException ? - throw new IOException( - Messages.getMessage("missingPortNameException") - ); - } - - // make sure there is a binding for the port. The 'binding' attribute for - // WSDL ports is mandatory - // - if (portBinding == null) { - //REMIND: should rather be a javax.wsdl.WSDLException ? - throw new IOException( - Messages.getMessage("missingBindingException") - ); - } - - // make sure the port name is unique among all port names defined in this - // WSDL document. - // - // NOTE: there's a flaw in com.ibm.wsdl.xml.WSDLReaderImpl#parsePort() and - // com.ibm.wsdl.xml.WSDLReaderImpl#addPort(). These methods do not enforce - // the port name exists and is unique. Actually, if two port definitions with - // the same name exist within the same service element, only *one* port - // element is present after parsing and the following exception is not thrown. - // - // If two ports with the same name exist in different service elements, - // the exception below is thrown. This is conformant to the WSDL 1.1 spec (sec 2.6) - // , which states: "The name attribute provides a unique name among all ports - // defined within in the enclosing WSDL document." - // - // - if (existsPortWithName(new QName(portName))) { - //REMIND: should rather be a javax.wsdl.WSDLException ? - throw new IOException( - Messages.getMessage("twoPortsWithSameName", portName) - ); - } - PortEntry portEntry = new PortEntry(port); - symbolTablePut(portEntry); - } + if (ports == null) return; + Iterator it = ports.values().iterator(); + while(it.hasNext()) { + + Port port = (Port)it.next(); + String portName = port.getName(); + Binding portBinding = port.getBinding(); + + // make sure there is a port name. The 'name' attribute for WSDL ports is + // mandatory + // + if (portName == null){ + //REMIND: should rather be a javax.wsdl.WSDLException ? + throw new IOException( + Messages.getMessage("missingPortNameException") + ); + } + + // make sure there is a binding for the port. The 'binding' attribute for + // WSDL ports is mandatory + // + if (portBinding == null) { + //REMIND: should rather be a javax.wsdl.WSDLException ? + throw new IOException( + Messages.getMessage("missingBindingException") + ); + } + + // make sure the port name is unique among all port names defined in this + // WSDL document. + // + // NOTE: there's a flaw in com.ibm.wsdl.xml.WSDLReaderImpl#parsePort() and + // com.ibm.wsdl.xml.WSDLReaderImpl#addPort(). These methods do not enforce + // the port name exists and is unique. Actually, if two port definitions with + // the same name exist within the same service element, only *one* port + // element is present after parsing and the following exception is not thrown. + // + // If two ports with the same name exist in different service elements, + // the exception below is thrown. This is conformant to the WSDL 1.1 spec (sec 2.6) + // , which states: "The name attribute provides a unique name among all ports + // defined within in the enclosing WSDL document." + // + // + if (existsPortWithName(new QName(portName))) { + //REMIND: should rather be a javax.wsdl.WSDLException ? + throw new IOException( + Messages.getMessage("twoPortsWithSameName", portName) + ); + } + PortEntry portEntry = new PortEntry(port); + symbolTablePut(portEntry); + } } /** @@ -2645,14 +2645,14 @@ * @return true, if there is a port element with the specified name; false, otherwise */ protected boolean existsPortWithName(QName name) { - Vector v = (Vector)symbolTable.get(name); - if (v == null) return false; - Iterator it = v.iterator(); - while(it.hasNext()) { - Object o = it.next(); - if (o instanceof PortEntry) return true; - } - return false; + Vector v = (Vector)symbolTable.get(name); + if (v == null) return false; + Iterator it = v.iterator(); + while(it.hasNext()) { + Object o = it.next(); + if (o instanceof PortEntry) return true; + } + return false; } 1.9 +32 -32 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDJAXRPCHandlerInfo.java Index: WSDDJAXRPCHandlerInfo.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDJAXRPCHandlerInfo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- WSDDJAXRPCHandlerInfo.java 11 Dec 2002 22:38:12 -0000 1.8 +++ WSDDJAXRPCHandlerInfo.java 25 Jan 2003 19:35:33 -0000 1.9 @@ -111,7 +111,7 @@ Element param = elements[i]; String pname = param.getAttribute(ATTR_NAME); String value = param.getAttribute(ATTR_VALUE); - _map.put(pname, value); + _map.put(pname, value); } } @@ -126,7 +126,7 @@ QName headerQName = XMLUtils.getQNameFromString(headerStr, qElem); if (headerQName != null) - headerList.add(headerQName); + headerList.add(headerQName); } QName[] headers = new QName[headerList.size()]; _headers = (QName[]) headerList.toArray(headers); @@ -165,37 +165,37 @@ public void writeToContext(SerializationContext context) throws IOException { - AttributesImpl attrs = new AttributesImpl(); - attrs.addAttribute("", ATTR_CLASSNAME, ATTR_CLASSNAME, - "CDATA", _classname); - context.startElement(WSDDConstants.QNAME_JAXRPC_HANDLERINFO, attrs); - - Map ht = _map; - if (ht != null) { - Set keys= ht.keySet(); - Iterator iter = keys.iterator(); - while (iter.hasNext()) { - String name = (String) iter.next(); - String value = (String) ht.get(name); - attrs = new AttributesImpl(); - attrs.addAttribute("",ATTR_NAME, ATTR_NAME, "CDATA", name); - attrs.addAttribute("",ATTR_VALUE, ATTR_VALUE, "CDATA", value); - context.startElement(WSDDConstants.QNAME_PARAM,attrs); - context.endElement(); - } - } - - if (_headers != null) { - for (int i=0 ; i < _headers.length ; i++) { - QName qname = _headers[i]; - attrs = new AttributesImpl(); - attrs.addAttribute("",ATTR_QNAME,ATTR_QNAME,"CDATA",context.qName2String(qname)); - context.startElement(WSDDConstants.QNAME_JAXRPC_HEADER,attrs); - context.endElement(); - } - } + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", ATTR_CLASSNAME, ATTR_CLASSNAME, + "CDATA", _classname); + context.startElement(WSDDConstants.QNAME_JAXRPC_HANDLERINFO, attrs); + + Map ht = _map; + if (ht != null) { + Set keys= ht.keySet(); + Iterator iter = keys.iterator(); + while (iter.hasNext()) { + String name = (String) iter.next(); + String value = (String) ht.get(name); + attrs = new AttributesImpl(); + attrs.addAttribute("",ATTR_NAME, ATTR_NAME, "CDATA", name); + attrs.addAttribute("",ATTR_VALUE, ATTR_VALUE, "CDATA", value); + context.startElement(WSDDConstants.QNAME_PARAM,attrs); + context.endElement(); + } + } + + if (_headers != null) { + for (int i=0 ; i < _headers.length ; i++) { + QName qname = _headers[i]; + attrs = new AttributesImpl(); + attrs.addAttribute("",ATTR_QNAME,ATTR_QNAME,"CDATA",context.qName2String(qname)); + context.startElement(WSDDConstants.QNAME_JAXRPC_HEADER,attrs); + context.endElement(); + } + } - context.endElement(); + context.endElement(); } } 1.6 +22 -22 xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDJAXRPCHandlerInfoChain.java Index: WSDDJAXRPCHandlerInfoChain.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDJAXRPCHandlerInfoChain.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- WSDDJAXRPCHandlerInfoChain.java 11 Dec 2002 22:38:12 -0000 1.5 +++ WSDDJAXRPCHandlerInfoChain.java 25 Jan 2003 19:35:33 -0000 1.6 @@ -91,14 +91,14 @@ public WSDDJAXRPCHandlerInfoChain(Element e) throws WSDDException { super(e); - ArrayList infoList = new ArrayList(); - _hiList = new ArrayList(); + ArrayList infoList = new ArrayList(); + _hiList = new ArrayList(); Element[] elements = getChildElements(e, ELEM_WSDD_JAXRPC_HANDLERINFO); if (elements.length != 0) { for (int i = 0; i < elements.length; i++) { WSDDJAXRPCHandlerInfo handlerInfo = new WSDDJAXRPCHandlerInfo(elements[i]); - _hiList.add(handlerInfo); + _hiList.add(handlerInfo); String handlerClassName = handlerInfo.getHandlerClassName(); Class handlerClass = null; @@ -151,26 +151,26 @@ */ public void writeToContext(SerializationContext context) throws IOException { - context.startElement(QNAME_JAXRPC_HANDLERINFOCHAIN,null); - - List his = _hiList; - Iterator iter = his.iterator(); - while (iter.hasNext()) { - WSDDJAXRPCHandlerInfo hi = (WSDDJAXRPCHandlerInfo) iter.next(); - hi.writeToContext(context); - } - - if (_roles != null) { - for (int i=0; i < _roles.length ; i++) { - AttributesImpl attrs1 = new AttributesImpl(); - attrs1.addAttribute("", ATTR_SOAPACTORNAME, ATTR_SOAPACTORNAME, + context.startElement(QNAME_JAXRPC_HANDLERINFOCHAIN,null); + + List his = _hiList; + Iterator iter = his.iterator(); + while (iter.hasNext()) { + WSDDJAXRPCHandlerInfo hi = (WSDDJAXRPCHandlerInfo) iter.next(); + hi.writeToContext(context); + } + + if (_roles != null) { + for (int i=0; i < _roles.length ; i++) { + AttributesImpl attrs1 = new AttributesImpl(); + attrs1.addAttribute("", ATTR_SOAPACTORNAME, ATTR_SOAPACTORNAME, "CDATA", _roles[i]); - context.startElement(QNAME_JAXRPC_ROLE,attrs1); - context.endElement(); - } - } - - context.endElement(); + context.startElement(QNAME_JAXRPC_ROLE,attrs1); + context.endElement(); + } + } + + context.endElement(); } public ArrayList getHandlerInfoList() {