axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject svn commit: r600141 [8/10] - in /webservices/axis2/branches/java/jaxws21/modules: adb-codegen/ adb-codegen/src/org/apache/axis2/schema/ adb-codegen/src/org/apache/axis2/schema/template/ adb-codegen/src/org/apache/axis2/schema/util/ adb-codegen/src/org/...
Date Sat, 01 Dec 2007 14:43:54 GMT
Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService.java Sat Dec  1 06:43:28 2007
@@ -79,7 +79,6 @@
 import java.io.*;
 import java.net.SocketException;
 import java.net.URL;
-import java.net.URISyntaxException;
 import java.security.PrivilegedAction;
 import java.util.*;
 
@@ -1115,22 +1114,34 @@
                 for (int i = 0; i < list.size(); i++) {
                     Object extensibilityEle = list.get(i);
                     if (extensibilityEle instanceof SOAPAddress) {
+                        SOAPAddress soapAddress = (SOAPAddress) extensibilityEle;
+                        String exsistingAddress = soapAddress.getLocationURI();
                         if (requestIP == null) {
-                            ((SOAPAddress) extensibilityEle).setLocationURI(getEPRs()[0]);
+                            ((SOAPAddress) extensibilityEle).setLocationURI(
+                                    getLocationURI(getEPRs(), exsistingAddress));
                         } else {
-                            ((SOAPAddress) extensibilityEle).setLocationURI(calculateEPRs(requestIP)[0]);
+                            ((SOAPAddress) extensibilityEle).setLocationURI(
+                                    getLocationURI(calculateEPRs(requestIP), exsistingAddress));
                         }
                     } else if (extensibilityEle instanceof SOAP12Address){
+                        SOAP12Address soapAddress = (SOAP12Address) extensibilityEle;
+                        String exsistingAddress = soapAddress.getLocationURI();
                         if (requestIP == null) {
-                            ((SOAP12Address) extensibilityEle).setLocationURI(getEPRs()[0]);
+                            ((SOAP12Address) extensibilityEle).setLocationURI(
+                                    getLocationURI(getEPRs(), exsistingAddress));
                         } else {
-                            ((SOAP12Address) extensibilityEle).setLocationURI(calculateEPRs(requestIP)[0]);
+                            ((SOAP12Address) extensibilityEle).setLocationURI(
+                                    getLocationURI(calculateEPRs(requestIP), exsistingAddress));
                         }
                     } else if (extensibilityEle instanceof HTTPAddress){
+                        HTTPAddress httpAddress = (HTTPAddress) extensibilityEle;
+                        String exsistingAddress = httpAddress.getLocationURI();
                         if (requestIP == null) {
-                            ((HTTPAddress) extensibilityEle).setLocationURI(getEPRs()[0]);
+                            ((HTTPAddress) extensibilityEle).setLocationURI(
+                                    getLocationURI(getEPRs(), exsistingAddress));
                         } else {
-                            ((HTTPAddress) extensibilityEle).setLocationURI(calculateEPRs(requestIP)[0]);
+                            ((HTTPAddress) extensibilityEle).setLocationURI(
+                                    getLocationURI(calculateEPRs(requestIP), exsistingAddress));
                         }
                     }
                     //TODO : change the Endpoint refrence addess as well.
@@ -1139,6 +1150,39 @@
         }
     }
 
+    /**
+     * this method returns the new IP address corresponding to the
+     * already existing ip
+     * @param eprs
+     * @param epr
+     * @return corresponding Ip address
+     */
+    private String getLocationURI(String[] eprs, String epr) throws AxisFault {
+        String returnIP = null;
+        if (epr != null) {
+            if (epr.indexOf(":") > -1) {
+                String existingProtocol = epr.substring(0, epr.indexOf(":")).trim();
+                String eprProtocol;
+                for (int i = 0; i < eprs.length; i++) {
+                    eprProtocol = eprs[i].substring(0, eprs[i].indexOf(":")).trim();
+                    if (eprProtocol.equals(existingProtocol)) {
+                        returnIP = eprs[i];
+                        break;
+                    }
+                }
+                if (returnIP != null) {
+                    return returnIP;
+                } else {
+                    throw new AxisFault("Server does not have an epr for the wsdl epr==>" + epr);
+                }
+            } else {
+                throw new AxisFault("invalid epr is given epr ==> " + epr);
+            }
+        } else {
+            throw new AxisFault("No epr is given in the wsdl port");
+        }
+    }
+
     private void getWSDL(OutputStream out, String[] serviceURL) throws AxisFault {
         // Retrieve WSDL using the same data retrieval path for GetMetadata request.
         DataRetrievalRequest request = new DataRetrievalRequest();
@@ -1966,20 +2010,20 @@
 
         //populate the axis service with the necessary schema references
         ArrayList schema = this.schemaList;
-        Map changedScheamLocations = null;
+        Map changedSchemaLocations = null;
         if (!this.schemaLocationsAdjusted) {
             Hashtable nameTable = new Hashtable();
             Hashtable sourceURIToNewLocationMap = new Hashtable();
             //calculate unique names for the schemas
-            calcualteSchemaNames(schema, nameTable, sourceURIToNewLocationMap);
+            calculateSchemaNames(schema, nameTable, sourceURIToNewLocationMap);
             //adjust the schema locations as per the calculated names
-            changedScheamLocations = adjustSchemaNames(schema, nameTable,sourceURIToNewLocationMap);
+            changedSchemaLocations = adjustSchemaNames(schema, nameTable,sourceURIToNewLocationMap);
             //reverse the nametable so that there is a mapping from the
             //name to the schemaObject
             setSchemaMappingTable(swapMappingTable(nameTable));
             setSchemaLocationsAdjusted(true);
         }
-        return changedScheamLocations;
+        return changedSchemaLocations;
     }
 
 
@@ -1988,7 +2032,7 @@
      *
      * @param schemas
      */
-    private void calcualteSchemaNames(List schemas, Hashtable nameTable, Hashtable sourceURIToNewLocationMap) {
+    private void calculateSchemaNames(List schemas, Hashtable nameTable, Hashtable sourceURIToNewLocationMap) {
         //first traversal - fill the hashtable
         for (int i = 0; i < schemas.size(); i++) {
             XmlSchema schema = (XmlSchema) schemas.get(i);
@@ -2000,11 +2044,12 @@
                 if (item instanceof XmlSchemaExternal) {
                     XmlSchemaExternal externalSchema = (XmlSchemaExternal) item;
                     s = externalSchema.getSchema();
-                    if (s != null && sourceURIToNewLocationMap.get(s.getSourceURI()) == null) {
+
+                    if (s != null && getScheamLocationWithDot(sourceURIToNewLocationMap, s) == null) {
                         //insert the name into the table
                         insertIntoNameTable(nameTable, s, sourceURIToNewLocationMap);
                         //recursively call the same procedure
-                        calcualteSchemaNames(Arrays.asList(new XmlSchema[]{s}), nameTable, sourceURIToNewLocationMap);
+                        calculateSchemaNames(Arrays.asList(new XmlSchema[]{s}), nameTable, sourceURIToNewLocationMap);
                     }
                 }
             }
@@ -2105,13 +2150,21 @@
 
             String newscheamlocation = customSchemaNamePrefix == null ?
                     //use the default mode
-                    (getName() + "?xsd=" + sourceURIToNewLocationMap.get(s.getSourceURI())) :
+                    (getName() + "?xsd=" + getScheamLocationWithDot(sourceURIToNewLocationMap, s)) :
                     //custom prefix is present - add the custom prefix
-                    (customSchemaNamePrefix + sourceURIToNewLocationMap.get(s.getSourceURI()));
+                    (customSchemaNamePrefix + getScheamLocationWithDot(sourceURIToNewLocationMap, s));
             String schemaLocation = xmlSchemaExternal.getSchemaLocation();
             xmlSchemaExternal.setSchemaLocation(newscheamlocation);
             importedScheams.put(schemaLocation, newscheamlocation);
         }
+    }
+
+    private Object getScheamLocationWithDot(Hashtable sourceURIToNewLocationMap, XmlSchema s) {
+        String o = (String) sourceURIToNewLocationMap.get(s.getSourceURI());
+        if (o !=null && o.indexOf(".") <0){
+            return o + ".xsd";
+        }
+        return o;
     }
 
     /**

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Sat Dec  1 06:43:28 2007
@@ -957,11 +957,17 @@
                 
                 OMNode firstChildElem = parentElement.getFirstElement();
                 
-                if (firstChildElem == null) {
-                    parentElement.addChild(child);
-                } else {
-                    firstChildElem.insertSiblingBefore(child);
-                }
+//                if (firstChildElem == null) {
+//                    parentElement.addChild(child);
+//                } else {
+//                    firstChildElem.insertSiblingBefore(child);
+//                }
+                // there is a problem with the OM insertSiblingBefore element with
+                // drops the already exists elements.
+                // since there is no any techical problem of adding policy elements after other
+                // children temporaliy fix this as it is.
+                // one OM fix this issue we can revert this change.
+                parentElement.addChild(child);
 
             } else if (policyElement instanceof PolicyReference) {
                 OMElement child = PolicyUtil

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Sat Dec  1 06:43:28 2007
@@ -107,6 +107,7 @@
         OMNamespace wsoap;
         OMNamespace whttp;
         OMNamespace wsdlx;
+        OMNamespace wrpc;
 
         OMNamespace tns = omFactory
                 .createOMNamespace(axisService.getTargetNamespace(),
@@ -141,23 +142,18 @@
             wsdlx = descriptionElement.declareNamespace(WSDL2Constants.URI_WSDL2_EXTENSIONS,
                                                         WSDL2Constants.WSDL_EXTENTION_PREFIX);
         }
+        if (nameSpacesMap != null && nameSpacesMap.containsValue(WSDL2Constants.URI_WSDL2_RPC)) {
+            wrpc = omFactory
+                    .createOMNamespace(WSDL2Constants.URI_WSDL2_RPC,
+                                       WSDLSerializationUtil.getPrefix(
+                                               WSDL2Constants.URI_WSDL2_RPC, nameSpacesMap));
+        } else {
+            wrpc = descriptionElement.declareNamespace(WSDL2Constants.URI_WSDL2_RPC,
+                                                        WSDL2Constants.WSDL_RPC_PREFIX);
+        }
 
         // Add the documentation element
-        String description;
-        OMElement documentationElement =
-                omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
-        if ((description = axisService.getDocumentation()) != null) {
-            OMText omText;
-            if (description.indexOf(WSDLSerializationUtil.CDATA_START) > -1) {
-                description = description.replaceFirst(WSDLSerializationUtil.CDATA_START_REGEX, "");
-                description = description.replaceFirst(WSDLSerializationUtil.CDATA_END_REGEX, "");
-                omText = omFactory.createOMText(description, XMLStreamConstants.CDATA);
-            } else {
-            omText =  omFactory.createOMText(description);
-            }
-            documentationElement.addChild(omText);
-            descriptionElement.addChild(documentationElement);
-        }
+        WSDLSerializationUtil.addWSDLDocumentationElement(axisService, descriptionElement, omFactory, wsdl);
 
         // Add types element
         OMElement typesElement = omFactory.createOMElement(WSDL2Constants.TYPES_LOCAL_NALE, wsdl);
@@ -193,7 +189,8 @@
         }
 
         // Add the interface element
-        descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, omFactory, interfaceName));
+        descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, wrpc, omFactory,
+                                                        interfaceName));
 
         // axis2.xml indicated no HTTP binding?
         boolean disableREST = false;
@@ -322,7 +319,7 @@
      * @return The generated interface element
      */
     private OMElement getInterfaceElement(OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx,
-                                          OMFactory fac, String interfaceName)
+                                          OMNamespace wrpc, OMFactory fac, String interfaceName)
             throws URISyntaxException, AxisFault {
 
         OMElement interfaceElement = fac.createOMElement(WSDL2Constants.INTERFACE_LOCAL_NAME, wsdl);
@@ -337,7 +334,8 @@
             if (axisOperation.isControlOperation()) {
                 continue;
             }
-            interfaceOperations.add(i, generateInterfaceOperationElement(axisOperation, wsdl, tns, wsdlx));
+            interfaceOperations.add(i, generateInterfaceOperationElement(axisOperation, wsdl, tns,
+                                                                         wsdlx, wrpc));
             i++;
             Iterator faultsIterator = axisOperation.getFaultMessages().iterator();
             while (faultsIterator.hasNext()) {
@@ -399,7 +397,8 @@
     public OMElement generateInterfaceOperationElement(AxisOperation axisOperation,
                                                        OMNamespace wsdl,
                                                        OMNamespace tns,
-                                                       OMNamespace wsdlx) throws
+                                                       OMNamespace wsdlx,
+                                                       OMNamespace wrpc) throws
             URISyntaxException, AxisFault {
         OMFactory omFactory = OMAbstractFactory.getOMFactory();
         OMElement axisOperationElement =
@@ -424,6 +423,12 @@
             }
             axisOperationElement.addAttribute(
                     omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_STYLE, null, style));
+            if (style.indexOf(WSDL2Constants.STYLE_RPC) >= 0) {
+                axisOperationElement.addAttribute(
+                    omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_SIGNATURE, wrpc,
+                                                (String) axisOperation.getParameterValue(
+                                                        WSDL2Constants.ATTR_WRPC_SIGNATURE)));
+            }
         }
         axisOperationElement.addAttribute(omFactory.createOMAttribute(
                 WSDL2Constants.ATTRIBUTE_NAME_PATTERN, null, axisOperation.getMessageExchangePattern()));
@@ -487,7 +492,7 @@
      * @param axisOperation - The axisOperation that needs to be checked
      * @return String [] - An array of styles that the operation adheres to.
      */
-    private URI [] checkStyle(AxisOperation axisOperation) throws URISyntaxException {
+    private URI [] checkStyle(AxisOperation axisOperation) throws URISyntaxException, AxisFault {
         boolean isRPC = true;
         boolean isMultipart = true;
         boolean isIRI = true;
@@ -569,8 +574,10 @@
         } else {
             return new URI [0];
         }
+        AxisMessage outMessage = null;
+        Map outMessageElementDetails = new HashMap();                                    
         if (isRPC && !WSDL2Constants.MEP_URI_IN_ONLY.equals(mep)) {
-            AxisMessage outMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_OUT);
+            outMessage = axisOperation.getMessage(WSDL2Constants.MESSAGE_LABEL_OUT);
             QName qName = outMessage.getElementQName();
             if (qName == null && Constants.XSD_ANY.equals(qName)) {
                 isRPC = false;
@@ -595,7 +602,6 @@
                                 xmlSchemaSequence.getItems();
                         if (schemaObjectCollection != null) {
                             Iterator iterator = schemaObjectCollection.getIterator();
-                            Map outMessageElementDetails = new HashMap();
                             while (iterator.hasNext()) {
                                 Object next = iterator.next();
                                 if (!(next instanceof XmlSchemaElement)) {
@@ -632,6 +638,7 @@
         int count = 0;
         if (isRPC) {
             styles.add(new URI(WSDL2Constants.STYLE_RPC));
+            axisOperation.addParameter(WSDL2Constants.ATTR_WRPC_SIGNATURE, generateRPCSignature(inMessageElementDetails,  outMessageElementDetails));
             count ++;
         }
         if (isIRI) {
@@ -643,5 +650,30 @@
             count ++;
         }
         return (URI[]) styles.toArray(new URI[count]);
+    }
+
+    private String generateRPCSignature(Map inMessageElementDetails, Map outMessageElementDetails) {
+        String in = "";
+        String out = "";
+        String inOut = "";
+        Set inElementSet = inMessageElementDetails.keySet();
+        Set outElementSet = outMessageElementDetails.keySet();
+
+        Iterator inElementIterator = inElementSet.iterator();
+        while (inElementIterator.hasNext()) {
+            String inElementName = (String) inElementIterator.next();
+            if (outElementSet.contains(inElementName)) {
+                inOut = inOut + inElementName + " " + WSDL2Constants.RPC_INOUT + " ";
+                outElementSet.remove(inElementName);
+            } else {
+                in = in + inElementName + " " + WSDL2Constants.RPC_IN + " ";
+            }
+        }
+        Iterator outElementIterator = outElementSet.iterator();
+        while (outElementIterator.hasNext()) {
+            String outElementName = (String) outElementIterator.next();
+            out = out + outElementName + " " + WSDL2Constants.RPC_OUT + " ";
+        }
+        return in + out + inOut;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/OutInAxisOperation.java Sat Dec  1 06:43:28 2007
@@ -199,8 +199,11 @@
                     " can not be used with OutInAxisOperationClient , user either "
                     + "fireAndForget or sendRobust)");
         }
-        if (replyTo!=null && !replyTo.hasAnonymousAddress()){
-            useAsync = true;
+        String customReeplyTo = (String)options.getProperty(Options.CUSTOM_REPLYTO_ADDRESS);
+        if ( ! (Options.CUSTOM_REPLYTO_ADDRESS_TRUE.equals(customReeplyTo))) {
+            if (replyTo!=null && !replyTo.hasAnonymousAddress()){
+                useAsync = true;
+            }
         }
 
         if (useAsync || options.isUseSeparateListener()) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Sat Dec  1 06:43:28 2007
@@ -89,18 +89,14 @@
 import javax.xml.parsers.ParserConfigurationException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.util.Vector;
+import java.util.*;
 
 public class WSDL11ToAxisServiceBuilder extends WSDLToAxisServiceBuilder {
 
+    public static final int COMPONENT_PORT_TYPE = 1;
+    public static final int COMPONENT_MESSAGE = 2;
+    public static final int COMPONENT_BINDING = 3;
+
     protected static final Log log = LogFactory
             .getLog(WSDL11ToAxisServiceBuilder.class);
     private static final boolean isTraceEnabled = log.isTraceEnabled();
@@ -256,7 +252,7 @@
 
     /**
      * Sets the URI to the base document associated with the WSDL definition.
-     * This identifies the origin of the Definition and allows the 
+     * This identifies the origin of the Definition and allows the
      * Definition to be reloaded.  Note that this is the URI of the base
      * document, not the imports.
      *
@@ -271,7 +267,7 @@
 
     /**
      * Gets the URI to the base document associated with the WSDL definition.
-     * This identifies the origin of the Definition and allows the 
+     * This identifies the origin of the Definition and allows the
      * Definition to be reloaded.  Note that this is the URI of the base
      * document, not the imports.
      *
@@ -284,7 +280,7 @@
 
 
     /**
-     * Populates a given service. 
+     * Populates a given service.
      *
      * @throws AxisFault
      */
@@ -292,7 +288,7 @@
         try {
             setup();
 
-            // NOTE: set the axisService with the Parameter for the WSDL 
+            // NOTE: set the axisService with the Parameter for the WSDL
             // Definition after the rest of the work
 
             if (wsdl4jDefinition == null) {
@@ -303,11 +299,15 @@
             axisService.setTargetNamespace(wsdl4jDefinition.getTargetNamespace());
             axisService.setNameSpacesMap(new NamespaceMap(wsdl4jDefinition.getNamespaces()));
 
+            //TODO : find the service also in imported wsdls
             Service wsdl4jService = findService(wsdl4jDefinition);
-            Binding binding = findBinding(wsdl4jDefinition, wsdl4jService);
-
 
-            PortType portType = getPortType(binding.getPortType().getQName(), wsdl4jDefinition);
+            Binding binding = findBinding(wsdl4jDefinition, wsdl4jService);
+            Definition bindingWSDL = getParentDefinition(wsdl4jDefinition,
+                    binding.getQName(), COMPONENT_BINDING, new HashSet());
+            Definition portTypeWSDL = getParentDefinition(bindingWSDL,
+                    binding.getPortType().getQName(), COMPONENT_PORT_TYPE, new HashSet());
+            PortType portType = portTypeWSDL.getPortType(binding.getPortType().getQName());
 
 
             if (portType == null) {
@@ -318,14 +318,6 @@
             // (if its present)
             Element[] schemaElements = generateWrapperSchema(schemaMap, binding, portType);
 
-            // we might have modified the schemas by now so the addition should
-            // happen here
-//            Types wsdl4jTypes = wsdl4jDefinition.getTypes();
-//            if (null != wsdl4jTypes) {
-//                this.copyExtensibleElements(wsdl4jTypes
-//                        .getExtensibilityElements(), wsdl4jDefinition,
-//                                                     axisService, TYPES);
-//            }
             processTypes(wsdl4jDefinition, axisService);
 
             // add the newly created schemas
@@ -342,14 +334,14 @@
             addDocumentation(axisService, documentationElement);
 
             axisService.setName(wsdl4jService.getQName().getLocalPart());
-            populateEndpoints(binding, wsdl4jService, portType);
+            populateEndpoints(binding, bindingWSDL,wsdl4jService, portType, portTypeWSDL);
             processPoliciesInDefintion(wsdl4jDefinition);
             axisService.getPolicyInclude().setPolicyRegistry(registry);
 
 
-            // Setting wsdl4jdefintion to the axisService parameter include list, 
-            // so if someone needs to use the definition directly, 
-            // he can do that by getting the parameter 
+            // Setting wsdl4jdefintion to the axisService parameter include list,
+            // so if someone needs to use the definition directly,
+            // he can do that by getting the parameter
             Parameter wsdlDefinitionParameter = new Parameter();
             wsdlDefinitionParameter.setName(WSDLConstants.WSDL_4_J_DEFINITION);
 
@@ -378,12 +370,14 @@
 
     private void processTypes(Definition wsdlDefinition, AxisService axisService)
             throws AxisFault {
-        processTypes(wsdlDefinition, axisService, new Stack());
+        processTypes(wsdlDefinition, axisService, new HashSet());
     }
 
-    private void processTypes(Definition wsdlDefinition, AxisService axisService, Stack stack)
+    private void processTypes(Definition wsdlDefinition,
+                              AxisService axisService,
+                              Set visitedWSDLs)
             throws AxisFault {
-        stack.push(wsdlDefinition);
+        visitedWSDLs.add(wsdlDefinition.getDocumentBaseURI());
         // process all the types in all the wsdls
         Types types = wsdlDefinition.getTypes();
         if (types != null) {
@@ -403,12 +397,11 @@
                 wsdlImport = (Import) valuesIter.next();
                 // process the types recuresiveilt
                 Definition innerDefinition = wsdlImport.getDefinition();
-                if(!stack.contains(innerDefinition)){
-                    processTypes(innerDefinition, axisService, stack);
+                if(!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())){
+                    processTypes(innerDefinition, axisService, visitedWSDLs);
                 }
             }
         }
-        stack.pop();
     }
 
     private void addDocumentation(AxisDescription axisDescription, Element documentationElement) {
@@ -427,8 +420,10 @@
      * @throws AxisFault
      */
     private void populateEndpoints(Binding binding,
+                                   Definition bindingWSDL,
                                    Service wsdl4jService,
-                                   PortType portType) throws AxisFault {
+                                   PortType portType,
+                                   Definition portTypeWSDL) throws AxisFault {
 
         Map wsdl4jPorts = wsdl4jService.getPorts();
         QName bindingName = binding.getQName();
@@ -441,28 +436,33 @@
         // process the port type for this binding
         // although we support multiports they must be belongs to same port type and should have the
         // same soap style
-        populatePortType(portType);
+        populatePortType(portType, portTypeWSDL);
 
         Binding currentBinding;
+        Definition currentBindingWSDL = null;
 
         for (Iterator iterator = wsdl4jPorts.values().iterator(); iterator.hasNext();) {
             port = (Port) iterator.next();
             // if the user has picked a port then we have to process only that port
             if ((this.portName == null) || (this.portName.equals(port.getName()))) {
                 // we process the port only if it has the same port type as the selected binding
-                currentBinding = getBinding(port.getBinding().getQName(), wsdl4jDefinition);
+                currentBindingWSDL = getParentDefinition(wsdl4jDefinition,
+                        port.getBinding().getQName(), COMPONENT_BINDING, new HashSet());
+                currentBinding = currentBindingWSDL.getBinding(port.getBinding().getQName());
 
                 if (currentBinding.getPortType().getQName().equals(binding.getPortType().getQName())) {
                     axisEndpoint = new AxisEndpoint();
                     axisEndpoint.setName(port.getName());
 
                     if (axisService.getEndpointName() == null &&
-                        bindingName.equals(port.getBinding().getQName())) {
-                        populateEndpoint(axisEndpoint, port, true);
+                            bindingName.equals(port.getBinding().getQName())) {
+                        populateEndpoint(axisEndpoint, port, currentBinding,
+                                bindingWSDL, portType, portTypeWSDL, true);
                         axisService.setEndpointName(axisEndpoint.getName());
                         axisService.setBindingName(axisEndpoint.getBinding().getName().getLocalPart());
                     } else {
-                        populateEndpoint(axisEndpoint, port, false);
+                        populateEndpoint(axisEndpoint, port, currentBinding,
+                                bindingWSDL, portType, portTypeWSDL, false);
                     }
 
                     axisEndpoint.setParent(axisService);
@@ -483,16 +483,18 @@
      * @param isSetMessageQNames
      * @throws AxisFault
      */
-    private void populateEndpoint(AxisEndpoint axisEndpoint, Port wsdl4jPort,
+    private void populateEndpoint(AxisEndpoint axisEndpoint,
+                                  Port wsdl4jPort,
+                                  Binding wsdl4jBinding,
+                                  Definition bindingWSDL,
+                                  PortType portType,
+                                  Definition portTypeWSDL,
                                   boolean isSetMessageQNames)
             throws AxisFault {
 
         copyExtensibleElements(wsdl4jPort.getExtensibilityElements(), wsdl4jDefinition,
                                axisEndpoint, BINDING);
 
-
-        Binding wsdl4jBinding = getBinding(wsdl4jPort.getBinding().getQName(), wsdl4jDefinition);
-
         addDocumentation(axisEndpoint, wsdl4jPort.getDocumentationElement());
         if (processedBindings.containsKey(wsdl4jBinding.getQName())) {
             axisEndpoint.setBinding(
@@ -503,13 +505,19 @@
             axisBinding.setParent(axisEndpoint);
             axisEndpoint.setBinding(axisBinding);
             axisBinding.setParent(axisEndpoint);
-            populateBinding(axisBinding, wsdl4jBinding, isSetMessageQNames);
+            populateBinding(axisBinding,
+                    wsdl4jBinding,
+                    bindingWSDL,
+                    portType,
+                    portTypeWSDL,
+                    isSetMessageQNames);
             processedBindings.put(wsdl4jBinding.getQName(), axisBinding);
         }
 
     }
 
-    private void populatePortType(PortType wsdl4jPortType) throws AxisFault {
+    private void populatePortType(PortType wsdl4jPortType,
+                                  Definition portTypeWSDL) throws AxisFault {
         List wsdl4jOperations = wsdl4jPortType.getOperations();
 
         // Added to use in ?wsdl2 as the interface name
@@ -528,7 +536,7 @@
         for (Iterator iterator = wsdl4jOperations.iterator(); iterator.hasNext();) {
             wsdl4jOperation = (Operation) iterator.next();
 
-            axisOperation = populateOperations(wsdl4jOperation, wsdl4jPortType, wsdl4jDefinition);
+            axisOperation = populateOperations(wsdl4jOperation, wsdl4jPortType, portTypeWSDL);
             addDocumentation(axisOperation, wsdl4jOperation.getDocumentationElement());
             axisOperation.setParent(axisService);
             axisService.addChild(axisOperation);
@@ -542,11 +550,15 @@
 
     }
 
-    private void populateBinding(AxisBinding axisBinding, Binding wsdl4jBinding,
+    private void populateBinding(AxisBinding axisBinding,
+                                 Binding wsdl4jBinding,
+                                 Definition bindingWSDL,
+                                 PortType portType,
+                                 Definition portTypeWSDL,
                                  boolean isSetMessageQNames)
             throws AxisFault {
 
-        copyExtensibleElements(wsdl4jBinding.getExtensibilityElements(), wsdl4jDefinition,
+        copyExtensibleElements(wsdl4jBinding.getExtensibilityElements(), bindingWSDL,
                                axisBinding, BINDING);
 
         List wsdl4jBidingOperations = wsdl4jBinding.getBindingOperations();
@@ -566,20 +578,16 @@
         Map httpLocationMap = new TreeMap();
         String httpLocation = null;
 
-        PortType portType = getPortType(wsdl4jBinding.getPortType().getQName(), wsdl4jDefinition);
-
-        String targetNamespace = wsdl4jDefinition.getTargetNamespace();
-
         for (Iterator iterator = wsdl4jBidingOperations.iterator(); iterator.hasNext();) {
 
             axisBindingOperation = new AxisBindingOperation();
             wsdl4jBindingOperation = (BindingOperation) iterator.next();
             wsdl4jOperation = findOperation(portType, wsdl4jBindingOperation);
 
-            axisBindingOperation.setName(new QName(targetNamespace, wsdl4jBindingOperation.getName()));
+            axisBindingOperation.setName(new QName(bindingWSDL.getTargetNamespace(), wsdl4jBindingOperation.getName()));
             addDocumentation(axisBindingOperation, wsdl4jBindingOperation.getDocumentationElement());
 
-            axisOperation = axisService.getOperation(new QName(targetNamespace, wsdl4jOperation.getName()));
+            axisOperation = axisService.getOperation(new QName(portTypeWSDL.getTargetNamespace(), wsdl4jOperation.getName()));
             axisBindingOperation.setAxisOperation(axisOperation);
 
             // process ExtensibilityElements of the wsdl4jBinding
@@ -681,22 +689,33 @@
                  bindingFaults.hasNext();) {
 
                 BindingFault bindingFault = (BindingFault) bindingFaults.next();
-                Fault wsdl4jFault = wsdl4jOperation.getFault(bindingFault.getName());
-                Message wsdl4jFaultMessge = wsdl4jFault.getMessage();
-
-                AxisMessage faultMessage = findFaultMessage(
-                        wsdl4jFaultMessge.getQName().getLocalPart(),
-                        axisOperation.getFaultMessages());
-
-                AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage();
-                addDocumentation(axisBindingFaultMessage, wsdl4jFaultMessge.getDocumentationElement());
-                axisBindingFaultMessage.setFault(true);
-                axisBindingFaultMessage.setAxisMessage(faultMessage);
-                axisBindingFaultMessage.setParent(axisBindingOperation);
+                if (bindingFault.getName() == null) {
+                    throw new AxisFault("Binding name is null for the binding fault in " +
+                            " binding operation ==> " + wsdl4jBindingOperation.getName());
+                } else {
+                    Fault wsdl4jFault = wsdl4jOperation.getFault(bindingFault.getName());
+                    if (wsdl4jFault == null){
+                        throw new AxisFault("Can not find the corresponding fault element in " +
+                                "wsdl operation " + wsdl4jOperation.getName() + " for the fault" +
+                                " name " + bindingFault.getName());
+                    } else {
+                        Message wsdl4jFaultMessge = wsdl4jFault.getMessage();
 
-                axisBindingOperation.addFault(axisBindingFaultMessage);
-                if (isSetMessageQNames) {
-                    addQNameReference(faultMessage, wsdl4jFault.getMessage());
+                        AxisMessage faultMessage = findFaultMessage(
+                                wsdl4jFaultMessge.getQName().getLocalPart(),
+                                axisOperation.getFaultMessages());
+
+                        AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage();
+                        addDocumentation(axisBindingFaultMessage, wsdl4jFaultMessge.getDocumentationElement());
+                        axisBindingFaultMessage.setFault(true);
+                        axisBindingFaultMessage.setAxisMessage(faultMessage);
+                        axisBindingFaultMessage.setParent(axisBindingOperation);
+
+                        axisBindingOperation.addFault(axisBindingFaultMessage);
+                        if (isSetMessageQNames) {
+                            addQNameReference(faultMessage, wsdl4jFault.getMessage());
+                        }
+                    }
                 }
             }
 
@@ -728,17 +747,15 @@
             return; // can't continue without wsdl
         }
 
-        // process the imports
-//        WSDL4JImportedWSDLHelper.processImports(wsdl4jDefinition, new ArrayList());
 
         // setup the schemaMap
         this.schemaMap = new HashMap();
-        populateSchemaMap(wsdl4jDefinition, new Stack());
+        populateSchemaMap(wsdl4jDefinition, new HashSet());
 
         setPolicyRegistryFromService(axisService);
 
         setupComplete = true; // if any part of setup fails, don't mark
-        // setupComplete        
+        // setupComplete
     }
 
 
@@ -749,8 +766,9 @@
      * @param definition
      */
 
-    private void populateSchemaMap(Definition definition, Stack stack) {
-        stack.push(definition);
+    private void populateSchemaMap(Definition definition, Set visitedWSDLs) {
+        visitedWSDLs.add(definition.getDocumentBaseURI());
+        // first process the types in the given wsdl
         Types types = definition.getTypes();
         Object extensibilityElement;
         if (types != null) {
@@ -773,12 +791,11 @@
             for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                 wsdlImport = (Import) valuesIter.next();
                 Definition innerDefinition = wsdlImport.getDefinition();
-                if(!stack.contains(innerDefinition)) {
-                    populateSchemaMap(innerDefinition, stack);
+                if(!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())) {
+                    populateSchemaMap(innerDefinition, visitedWSDLs);
                 }
             }
         }
-        stack.pop();
     }
 
 
@@ -875,8 +892,9 @@
         if (port != null) {
             copyExtensibleElements(port.getExtensibilityElements(), dif,
                                    axisService, PORT);
-//            binding = dif.getBinding(port.getBinding().getQName());
-            binding = getBinding(port.getBinding().getQName(), dif);
+            Definition parentDefinition = getParentDefinition(dif,
+                    port.getBinding().getQName(), COMPONENT_BINDING, new HashSet());
+            binding = parentDefinition.getBinding(port.getBinding().getQName());
             if (binding == null) {
                 binding = port.getBinding();
             }
@@ -886,143 +904,6 @@
     }
 
     /**
-     * find the message from imported wsdls
-     *
-     * @param messageQName
-     * @param definition
-     * @return message
-     */
-    private Message getMessage(QName messageQName, Definition definition) {
-        Message message = null;
-        // this can be in a imported wsdl
-        Iterator iter = definition.getImports().values().iterator();
-        Vector values = null;
-        Import wsdlImport = null;
-        for (; iter.hasNext();) {
-            values = (Vector) iter.next();
-            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
-                wsdlImport = (Import) valuesIter.next();
-                // find the binding recursively
-                message = getMessage(messageQName, wsdlImport.getDefinition());
-                if (message != null) {
-                    break;
-                }
-            }
-            if (message != null) {
-                break;
-            }
-        }
-
-        if (message == null) {
-            message = definition.getMessage(messageQName);
-        }
-        return message;
-    }
-
-    /**
-     * get the port type form all the imported documents
-     *
-     * @param portTypeQName
-     * @param definition
-     * @return portType
-     */
-
-    private PortType getPortType(QName portTypeQName, Definition definition) {
-        return getPortType(portTypeQName, definition, new Stack());
-    }
-
-    /**
-     * get the port type form all the imported documents
-     *
-     * @param portTypeQName
-     * @param definition
-     * @return portType
-     */
-
-    private PortType getPortType(QName portTypeQName, Definition definition, Stack stack) {
-        stack.push(definition);
-        PortType portType = null;
-        Iterator iter = definition.getImports().values().iterator();
-        Vector values = null;
-        Import wsdlImport = null;
-        for (; iter.hasNext();) {
-            values = (Vector) iter.next();
-            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
-                wsdlImport = (Import) valuesIter.next();
-                Definition innerDefinition = wsdlImport.getDefinition();
-                if(!stack.contains(innerDefinition)){
-                    // find the binding recursively
-                    portType = getPortType(portTypeQName, innerDefinition, stack);
-                    if (portType != null) {
-                        break;
-                    }
-                }
-            }
-            if (portType != null) {
-                break;
-            }
-        }
-
-        if (portType == null) {
-            // this can be in a imported wsdl
-            portType = definition.getPortType(portTypeQName);
-        }
-        stack.pop();
-        return portType;
-    }
-
-    private Binding getBinding(QName bindingQName, Definition definition) {
-        ArrayList list = new ArrayList();
-        Binding binding = getBinding(bindingQName, definition, list);
-        if (binding == null) {
-            for(int i=0;i<list.size();i++){
-                Binding binding2 = definition.getBinding(bindingQName);
-                if(binding2 != null && binding2.getPortType() != null){
-                    binding = binding2;
-                    break;
-                }
-            }
-        }
-        return binding;
-    }
-
-    /**
-     * first find the binding in the given definition
-     * if not found serch in the imported doucuments
-     *
-     * @param bindingQName
-     * @param definition
-     * @return binding
-     */
-
-    private Binding getBinding(QName bindingQName, Definition definition, ArrayList list) {
-        list.add(definition);
-        Binding binding = null;
-        //first try to find a binding in the upper inmport
-        Iterator iter = definition.getImports().values().iterator();
-        Vector values = null;
-        Import wsdlImport = null;
-        for (; iter.hasNext();) {
-            values = (Vector) iter.next();
-            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
-                wsdlImport = (Import) valuesIter.next();
-                Definition innerDefinition = wsdlImport.getDefinition();
-                if(!list.contains(innerDefinition)) {
-                    // find the binding recursively
-                    binding = getBinding(bindingQName, innerDefinition, list);
-                    if (binding != null) {
-                        break;
-                    }
-                }
-            }
-            if (binding != null) {
-                break;
-            }
-        }
-        return binding;
-    }
-
-    /**
      * Finds a SOAP port given the port map
      */
     private Port findPort(Map ports) {
@@ -2131,6 +2012,7 @@
 
         // switch off the verbose mode for all usecases
         reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);
+        reader.setFeature("javax.wsdl.importDocuments", true);
 
         Definition def;
         // if the custem resolver is present then use it
@@ -2154,7 +2036,7 @@
                 throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error",
                                         e);
             }
-            
+
             // Log when and from where the WSDL is loaded.
             if (log.isDebugEnabled()) {
                 log.debug("Reading 1.1 WSDL with base uri = " + getBaseUri());
@@ -2733,7 +2615,7 @@
      * @param definition
      */
     private void processPoliciesInDefintion(Definition definition) {
-        processPoliciesInDefintion(definition, new Stack());
+        processPoliciesInDefintion(definition, new HashSet());
     }
 
     /**
@@ -2741,8 +2623,8 @@
      *
      * @param definition
      */
-    private void processPoliciesInDefintion(Definition definition, Stack stack) {
-        stack.push(definition);
+    private void processPoliciesInDefintion(Definition definition, Set visitedWSDLs) {
+        visitedWSDLs.add(definition.getDocumentBaseURI());
         List extElements = definition.getExtensibilityElements();
         ExtensibilityElement extElement;
         UnknownExtensibilityElement unknown = null;
@@ -2775,12 +2657,11 @@
                 wsdlImport = (Import) valuesIter.next();
                 Definition innerDefinition = wsdlImport.getDefinition();
                 // find the binding recursively
-                if(!stack.contains(innerDefinition)) {
-                    processPoliciesInDefintion(innerDefinition, stack);
+                if(!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())) {
+                    processPoliciesInDefintion(innerDefinition, visitedWSDLs);
                 }
             }
         }
-        stack.pop();
     }
 
 
@@ -2814,11 +2695,11 @@
     }
 
 //    private void processPoliciesInDefinition() {
-//        
+//
 //        Object obj;
 //        for (Iterator iterator = wsdl4jDefinition.getExtensibilityElements().iterator(); iterator.hasNext();) {
 //            obj = iterator.next();
-//            
+//
 //            if (obj instanceof UnknownExtensibilityElement) {
 //                Element e = ((UnknownExtensibilityElement) obj).getElement();
 //                if (WSDLConstants.WSDL11Constants.POLICY.getNamespaceURI().equals(e.getNamespaceURI()) &&
@@ -2858,5 +2739,72 @@
             }
         }
         return null;
+    }
+
+    /**
+     * returns the wsld defintion for the given component.
+     * @param definition
+     * @param qname
+     * @param componentType
+     * @param visitedWSDLs
+     * @return definition containing the component.
+     */
+    private Definition getParentDefinition(Definition definition,
+                                           QName qname,
+                                           int componentType,
+                                           Set visitedWSDLs){
+        visitedWSDLs.add(definition.getDocumentBaseURI());
+        Definition newParentDefinition = null;
+        // first find through imports
+        Iterator iter = definition.getImports().values().iterator();
+        Vector values = null;
+        Import wsdlImport = null;
+        for (; iter.hasNext();) {
+            values = (Vector) iter.next();
+            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
+                wsdlImport = (Import) valuesIter.next();
+                Definition innerDefinition = wsdlImport.getDefinition();
+                if (!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())){
+                    newParentDefinition = getParentDefinition(innerDefinition,qname,componentType,visitedWSDLs);
+                    if (newParentDefinition != null){
+                        break;
+                    }
+                }
+            }
+            if (newParentDefinition != null) {
+                break;
+            }
+        }
+
+        // if it not available in imports we check for the current definition.
+        if (newParentDefinition == null) {
+            // this can be in a imported wsdl
+            if (isComponetAvailable(definition, qname, componentType)) {
+                newParentDefinition = definition;
+            }
+        }
+
+        return newParentDefinition;
+    }
+
+    private boolean isComponetAvailable(Definition definition,
+                                        QName qname,
+                                        int componentType){
+        boolean isAvailable = false;
+        switch (componentType){
+            case COMPONENT_BINDING : {
+                isAvailable = (definition.getBinding(qname) != null);
+                break;
+            }
+            case COMPONENT_PORT_TYPE : {
+                isAvailable = (definition.getPortType(qname) != null);
+                break;
+            }
+            case COMPONENT_MESSAGE : {
+                isAvailable = (definition.getMessage(qname) != null);
+                break;
+            }
+        }
+        return isAvailable;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Sat Dec  1 06:43:28 2007
@@ -44,6 +44,7 @@
 import org.apache.woden.internal.wsdl20.extensions.http.HTTPHeaderImpl;
 import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingExtensionsImpl;
 import org.apache.woden.schema.Schema;
+import org.apache.woden.types.NamespaceDeclaration;
 import org.apache.woden.wsdl20.Binding;
 import org.apache.woden.wsdl20.BindingFault;
 import org.apache.woden.wsdl20.BindingFaultReference;
@@ -90,6 +91,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -108,7 +110,7 @@
 
     private String savedTargetNamespace;
 
-    private Map namespacemap;
+    private NamespaceDeclaration[] namespacemap;
 
     private List operationNames = new ArrayList();
 
@@ -145,7 +147,7 @@
         DescriptionElement descriptionElement = description.toElement();
         savedTargetNamespace = descriptionElement.getTargetNamespace()
                 .toString();
-        namespacemap = descriptionElement.getNamespaces();
+        namespacemap = descriptionElement.getDeclaredNamespaces();
         this.description = description;
         this.serviceName = null;
         if (name != null) {
@@ -443,17 +445,17 @@
                 }
 
                 savedTargetNamespace = descriptionElement.getTargetNamespace().toString();
-                namespacemap = descriptionElement.getNamespaces();
+                namespacemap = descriptionElement.getDeclaredNamespaces();
                 this.description = description;
 
             }
             // Create the namespacemap
 
             stringBasedNamespaceMap = new NamespaceMap();
-            Iterator iterator = namespacemap.keySet().iterator();
-            while (iterator.hasNext()) {
-                String key = (String) iterator.next();
-                stringBasedNamespaceMap.put(key, (namespacemap.get(key)).toString());
+            for (int i = 0; i < namespacemap.length; i++) {
+                NamespaceDeclaration namespaceDeclaration = namespacemap[i];
+                stringBasedNamespaceMap.put(namespaceDeclaration.getPrefix(),
+                                            namespaceDeclaration.getNamespaceURI().toString());
             }
 
             setupComplete = true;
@@ -1021,6 +1023,10 @@
             faultMessage.setDirection(interfaceFaultReference.getDirection().toString());
 
             InterfaceFault interfaceFault = interfaceFaultReference.getInterfaceFault();
+
+            if (interfaceFault == null) {
+                throw new AxisFault("Interface Fault reference defined in operation " + opName + " cannot be found in interface");
+            }
 
             faultMessage.setElementQName(interfaceFault.getElementDeclaration().getName());
             faultMessage.setName(interfaceFault.getName().getLocalPart());

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java Sat Dec  1 06:43:28 2007
@@ -26,9 +26,11 @@
     String URI_WSDL2_SOAP = "http://www.w3.org/ns/wsdl/soap";
     String URI_WSDL2_HTTP = "http://www.w3.org/ns/wsdl/http";
     String URI_WSDL2_EXTENSIONS = "http://www.w3.org/ns/wsdl-extensions";
+    String URI_WSDL2_RPC = "http://www.w3.org/ns/wsdl/rpc";
     String SOAP_PREFIX = "wsoap";
     String HTTP_PREFIX = "whttp";
     String WSDL_EXTENTION_PREFIX = "wsdlx";
+    String WSDL_RPC_PREFIX = "wrpc";
     String SOAP_ENV_PREFIX = "soap";
     String DEFAULT_TARGET_NAMESPACE_PREFIX = "axis2";
     String DOCUMENTATION = "documentation";
@@ -73,6 +75,7 @@
     String ATTRIBUTE_AUTHENTICATION_TYPE = "authenticationType";
     String ATTRIBUTE_AUTHENTICATION_REALM = "authenticationRealm";
     String ATTRIBUTE_STYLE = "style";
+    String ATTRIBUTE_SIGNATURE = "signature";
     String OPERATION_STYLE = "operationStyle";
     String IN_PUT_LOCAL_NAME = "input";
     String OUT_PUT_LOCAL_NAME = "output";
@@ -116,11 +119,17 @@
 
     String ATTR_WSDLX_SAFE = "wsdlx:safe";
 
+    String ATTR_WRPC_SIGNATURE = "wrpc:signature";
+
     String SOAP_VERSION_1_1 = "1.1";
     String SOAP_VERSION_1_2 = "1.2";
 
     String MESSAGE_LABEL_IN = "In";
     String MESSAGE_LABEL_OUT = "Out";
+
+    String RPC_IN = "#in";
+    String RPC_OUT = "#out";
+    String RPC_INOUT = "#inout";
 
     String HTTP_LOCATION_TABLE = "HTTPLocationTable";
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/AnnotationConstants.java Sat Dec  1 06:43:28 2007
@@ -28,4 +28,5 @@
     String EXCLUDE = "exclude";
     String ACTION = "action";
     String WSDL_LOCATION = "wsdlLocation";
+    String OPERATION_NAME ="operationName";
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Sat Dec  1 06:43:28 2007
@@ -154,9 +154,9 @@
         for (int count = 0; count < getExtraClasses().size(); ++count) {
             jam_service_parms.includeClass((String) getExtraClasses().get(count));
         }
-        JamService service = factory.createService(jam_service_parms);
+        JamService jamService = factory.createService(jam_service_parms);
         QName extraSchemaTypeName;
-        JamClassIterator jClassIter = service.getClasses();
+        JamClassIterator jClassIter = jamService.getClasses();
         //all most all the time the ittr will have only one class in it
         while (jClassIter.hasNext()) {
             JClass jclass = (JClass) jClassIter.next();
@@ -164,7 +164,7 @@
                 /**
                  * Schema genertaion done in two stage 1. Load all the methods and
                  * create type for methods parameters (if the parameters are Bean
-                 * then it will create Complex types for those , and if the
+                 * then it will create Complex types foer those , and if the
                  * parameters are simple type which decribe in SimpleTypeTable
                  * nothing will happen) 2. In the next stage for all the methods
                  * messages and port types will be creteated
@@ -177,6 +177,11 @@
                         targetNamespace = tns;
                         schemaTargetNameSpace = tns;
                     }
+                    if(annotation.getValue(AnnotationConstants.NAME) != null) {
+                        String serviceName = (annotation.getValue(AnnotationConstants.NAME)).asString();
+                        service.setName(serviceName);
+                    }
+
                 }
                 methods = processMethods(jclass.getDeclaredMethods());
 
@@ -387,9 +392,8 @@
     }
 
     /**
-     * JAM convert first name of an attribute into UpperCase as an example if there is a instance
-     * variable called foo in a bean , then Jam give that as Foo so this method is to correct that
-     * error
+     * JAM converts the first letter of a field into uppercase, so field "foo" would end up
+     * called "Foo".  This method corrects that problem.
      *
      * @param wrongName
      * @return the right name, using english as the locale for case conversion
@@ -690,12 +694,8 @@
         if ("javax.activation.DataHandler".equals(classType)) {
             return true;
         } else {
-            JClass supuerClass = clazz.getSuperclass();
-            if (supuerClass != null) {
-                return isDataHandler(supuerClass);
-            } else {
-                return false;
-            }
+            JClass superClass = clazz.getSuperclass();
+            return superClass != null && isDataHandler(superClass);
         }
     }
 
@@ -779,7 +779,7 @@
         XmlSchema xmlSchema;
 
         if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) {
-            String targetNamespacePrefix = null;
+            String targetNamespacePrefix;
 
             if (targetNamespace.equals(schemaTargetNameSpace) &&
                     schema_namespace_prefix != null) {
@@ -924,7 +924,7 @@
     }
 
     protected String getSimpleName(JMethod method) {
-        return method.getSimpleName();
+       return Utils.getSimpleName(method);
     }
 
     protected String getSimpleName(JClass type) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/dispatchers/HTTPLocationBasedDispatcher.java Sat Dec  1 06:43:28 2007
@@ -21,12 +21,15 @@
 package org.apache.axis2.dispatchers;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisEndpoint;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.AxisBinding;
+import org.apache.axis2.description.AxisBindingOperation;
 import org.apache.axis2.engine.AbstractDispatcher;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.commons.logging.Log;
@@ -81,8 +84,22 @@
                             Map httpLocationTable = (Map) endpoint.getBinding()
                                     .getProperty(WSDL2Constants.HTTP_LOCATION_TABLE);
                             if (httpLocationTable != null) {
-                                return getOperationFromHTTPLocation(httpLocation,
-                                                                    httpLocationTable);
+                                AxisOperation axisOperation =
+                                        getOperationFromHTTPLocation(httpLocation,
+                                                                     httpLocationTable);
+                                if (axisOperation != null) {
+                                    messageContext.setProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME,
+                                                               endpoint);
+                                    AxisBinding axisBinding = endpoint.getBinding();
+                                    if (axisBinding != null) {
+                                        AxisBindingOperation axisBindingOperation =
+                                                (AxisBindingOperation) axisBinding
+                                                        .getChild(axisOperation.getName());
+                                        messageContext.setProperty(Constants.AXIS_BINDING_OPERATION,
+                                                                   axisBindingOperation);
+                                        return axisOperation;
+                                    }
+                                }
                             }
                         }
                     }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Sat Dec  1 06:43:28 2007
@@ -20,6 +20,7 @@
 
 package org.apache.axis2.engine;
 
+import org.apache.axiom.soap.RolePlayer;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
@@ -72,7 +73,7 @@
         }
 
         // Get all the headers targeted to us
-        Iterator headerBlocks = envelope.getHeader().getHeadersToProcess(null);
+        Iterator headerBlocks = envelope.getHeader().getHeadersToProcess((RolePlayer)msgContext.getConfigurationContext().getAxisConfiguration().getParameterValue("rolePlayer"));
 
         while (headerBlocks.hasNext()) {
             SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next();

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Sat Dec  1 06:43:28 2007
@@ -152,11 +152,11 @@
                 }
             }
             Builder builder = BuilderUtil.getBuilderFromSelector(type, msgContext);
-            if (log.isDebugEnabled()) {
-                log.debug("createSOAPEnvelope using Builder (" + 
-                          builder.getClass() + ") selected from type (" + type +")");
-            }
             if (builder != null) {
+	            if (log.isDebugEnabled()) {
+	                log.debug("createSOAPEnvelope using Builder (" + 
+	                          builder.getClass() + ") selected from type (" + type +")");
+	            }
                 documentElement = builder.processDocument(inStream, contentType, msgContext);
             }
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Sat Dec  1 06:43:28 2007
@@ -693,7 +693,10 @@
         private HttpServletResponse response;
         private boolean responseWritten = false;
         private CountDownLatch responseReadySignal = new CountDownLatch(1);
-        RequestResponseTransportStatus status = RequestResponseTransportStatus.INITIAL;
+		// The initial status must be WAITING, as the main servlet will do some other
+		// work after setting this RequestResponseTransport up, and we don't want to miss
+		// signals that come in before this thread gets to the awaitResponse call.
+        private RequestResponseTransportStatus status = RequestResponseTransportStatus.WAITING;
         AxisFault faultToBeThrownOut = null;
 
         ServletRequestResponseTransport(HttpServletResponse response) {
@@ -721,7 +724,6 @@
         public void awaitResponse()
                 throws InterruptedException, AxisFault {
             log.debug("Blocking servlet thread -- awaiting response");
-            status = RequestResponseTransportStatus.WAITING;
             responseReadySignal.await();
 
             if (faultToBeThrownOut != null) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Sat Dec  1 06:43:28 2007
@@ -29,7 +29,6 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.deployment.DeploymentConstants;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.engine.Handler.InvocationResponse;

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpConnectionImpl.java Sat Dec  1 06:43:28 2007
@@ -25,21 +25,18 @@
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.SocketException;
-import java.util.Iterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.ConnectionClosedException;
-import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
 import org.apache.http.HttpConnectionMetrics;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
-import org.apache.http.HttpRequestFactory;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
-import org.apache.http.RequestLine;
+import org.apache.http.ProtocolVersion;
 import org.apache.http.entity.ContentLengthStrategy;
 import org.apache.http.impl.DefaultHttpRequestFactory;
 import org.apache.http.impl.entity.StrictContentLengthStrategy;
@@ -47,20 +44,18 @@
 import org.apache.http.impl.io.ChunkedOutputStream;
 import org.apache.http.impl.io.ContentLengthInputStream;
 import org.apache.http.impl.io.ContentLengthOutputStream;
-import org.apache.http.impl.io.HttpDataInputStream;
+import org.apache.http.impl.io.HttpRequestParser;
+import org.apache.http.impl.io.HttpResponseWriter;
+import org.apache.http.impl.io.IdentityInputStream;
 import org.apache.http.impl.io.IdentityOutputStream;
-import org.apache.http.impl.io.SocketHttpDataReceiver;
-import org.apache.http.impl.io.SocketHttpDataTransmitter;
-import org.apache.http.io.HttpDataReceiver;
-import org.apache.http.io.HttpDataTransmitter;
-import org.apache.http.message.BasicHeader;
-import org.apache.http.message.BasicRequestLine;
-import org.apache.http.message.BasicStatusLine;
-import org.apache.http.message.BufferedHeader;
+import org.apache.http.impl.io.SocketInputBuffer;
+import org.apache.http.impl.io.SocketOutputBuffer;
+import org.apache.http.io.HttpMessageParser;
+import org.apache.http.io.HttpMessageWriter;
+import org.apache.http.io.SessionInputBuffer;
+import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
-import org.apache.http.util.CharArrayBuffer;
-import org.apache.http.util.HeaderUtils;
 
 public class AxisHttpConnectionImpl implements AxisHttpConnection {
 
@@ -68,13 +63,11 @@
         LogFactory.getLog("org.apache.axis2.transport.http.server.wire");
 
     private final Socket socket;
-    private final HttpDataTransmitter datatransmitter;
-    private final HttpDataReceiver datareceiver;
-    private final CharArrayBuffer charbuffer; 
-    private final HttpRequestFactory requestfactory;
+    private final SessionOutputBuffer outbuffer;
+    private final SessionInputBuffer inbuffer;
+    private final HttpMessageParser requestParser;
+    private final HttpMessageWriter responseWriter;
     private final ContentLengthStrategy contentLenStrategy;
-    private final int maxHeaderCount;
-    private final int maxLineLen;
 
     private OutputStream out = null;
     private InputStream in = null;
@@ -98,17 +91,17 @@
         
         int buffersize = HttpConnectionParams.getSocketBufferSize(params);
         this.socket = socket;
-        this.datatransmitter = new SocketHttpDataTransmitter(socket, buffersize, params); 
-        this.datareceiver = new SocketHttpDataReceiver(socket, buffersize, params); 
-        this.charbuffer = new CharArrayBuffer(256);
-        this.requestfactory = new DefaultHttpRequestFactory();
+        this.outbuffer = new SocketOutputBuffer(socket, buffersize, params); 
+        this.inbuffer = new SocketInputBuffer(socket, buffersize, params); 
         this.contentLenStrategy = new StrictContentLengthStrategy();
-        this.maxHeaderCount = params.getIntParameter(HttpConnectionParams.MAX_HEADER_COUNT, -1);
-        this.maxLineLen = params.getIntParameter(HttpConnectionParams.MAX_LINE_LENGTH, -1);
+        this.requestParser = new HttpRequestParser(
+                this.inbuffer, null, new DefaultHttpRequestFactory(), params);
+        this.responseWriter = new HttpResponseWriter(
+                this.outbuffer, null, params);
     }
 
     public void close() throws IOException {
-        this.datatransmitter.flush();
+        this.outbuffer.flush();
         try {
             this.socket.shutdownOutput();
         } catch (IOException ignore) {
@@ -126,7 +119,7 @@
 
     public boolean isStale() {
         try {
-            this.datareceiver.isDataAvailable(1);
+            this.inbuffer.isDataAvailable(1);
             return false;
         } catch (IOException ex) {
             return true;
@@ -141,23 +134,11 @@
     }
 
     public HttpRequest receiveRequest() throws HttpException, IOException {
-        this.charbuffer.clear();
-        int i = this.datareceiver.readLine(this.charbuffer);
-        if (i == -1) {
-            throw new ConnectionClosedException("Client closed connection"); 
-        }
-        RequestLine requestline = BasicRequestLine.parse(this.charbuffer, 0, this.charbuffer.length());
-        HttpRequest request = this.requestfactory.newHttpRequest(requestline);
-        Header[] headers = HeaderUtils.parseHeaders(
-                this.datareceiver, 
-                this.maxHeaderCount,
-                this.maxLineLen);
-        request.setHeaders(headers);
-        
+        HttpRequest request = (HttpRequest) this.requestParser.parse();
         if (HEADERLOG.isDebugEnabled()) {
             HEADERLOG.debug(">> " + request.getRequestLine().toString());
-            for (i = 0; i < headers.length; i++) {
-                HEADERLOG.debug(">> " + headers[i].toString());
+            for (HeaderIterator it = request.headerIterator(); it.hasNext(); ) {
+                HEADERLOG.debug(">> " + it.nextHeader().toString());
             }
         }
         
@@ -166,11 +147,11 @@
         if (request instanceof HttpEntityEnclosingRequest) {
             long len = this.contentLenStrategy.determineLength(request);
             if (len == ContentLengthStrategy.CHUNKED) {
-                this.in = new ChunkedInputStream(this.datareceiver);
+                this.in = new ChunkedInputStream(this.inbuffer);
             } else if (len == ContentLengthStrategy.IDENTITY) {
-                this.in = new HttpDataInputStream(this.datareceiver);                            
+                this.in = new IdentityInputStream(this.inbuffer);                            
             } else {
-                this.in = new ContentLengthInputStream(datareceiver, len);
+                this.in = new ContentLengthInputStream(inbuffer, len);
             }
         }
         return request;
@@ -184,43 +165,28 @@
 
         if (HEADERLOG.isDebugEnabled()) {
             HEADERLOG.debug("<< " + response.getStatusLine().toString());
-            Header[] headers = response.getAllHeaders();
-            for (int i = 0; i < headers.length; i++) {
-                HEADERLOG.debug("<< " + headers[i].toString());
+            for (HeaderIterator it = response.headerIterator(); it.hasNext(); ) {
+                HEADERLOG.debug("<< " + it.nextHeader().toString());
             }
         }
         
-        this.charbuffer.clear();
-        BasicStatusLine.format(this.charbuffer, response.getStatusLine());
-        this.datatransmitter.writeLine(this.charbuffer);
-        for (Iterator it = response.headerIterator(); it.hasNext(); ) {
-            Header header = (Header) it.next();
-            if (header instanceof BufferedHeader) {
-                this.datatransmitter.writeLine(((BufferedHeader)header).getBuffer());
-            } else {
-                this.charbuffer.clear();
-                BasicHeader.format(this.charbuffer, header);
-                this.datatransmitter.writeLine(this.charbuffer);
-            }
-        }
-        this.charbuffer.clear();
-        this.datatransmitter.writeLine(this.charbuffer);
+        this.responseWriter.write(response);
 
         // Prepare output stream
         this.out = null;
-        HttpVersion ver = response.getStatusLine().getHttpVersion();
+        ProtocolVersion ver = response.getStatusLine().getProtocolVersion();
         HttpEntity entity = response.getEntity();
         if (entity != null) {
             long len = entity.getContentLength();
             if (entity.isChunked() && ver.greaterEquals(HttpVersion.HTTP_1_1)) {
-                this.out = new ChunkedOutputStream(this.datatransmitter);
+                this.out = new ChunkedOutputStream(this.outbuffer);
             } else if (len >= 0) {
-                this.out = new ContentLengthOutputStream(this.datatransmitter, len);
+                this.out = new ContentLengthOutputStream(this.outbuffer, len);
             } else {
-                this.out = new IdentityOutputStream(this.datatransmitter); 
+                this.out = new IdentityOutputStream(this.outbuffer); 
             }
         } else {
-            this.datatransmitter.flush();
+            this.outbuffer.flush();
         }
     }
     
@@ -236,7 +202,7 @@
         if (this.out != null) {
             this.out.flush();
         } else {
-            this.datatransmitter.flush();
+            this.outbuffer.flush();
         }
     }
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpRequestImpl.java Sat Dec  1 06:43:28 2007
@@ -21,16 +21,16 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Iterator;
 
 import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
-import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolVersion;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
 import org.apache.http.protocol.HttpProcessor;
 
 public class AxisHttpRequestImpl implements AxisHttpRequest {
@@ -65,8 +65,8 @@
     }
     
     public void prepare() throws IOException, HttpException {
-        this.context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, this.conn);
-        this.context.setAttribute(HttpExecutionContext.HTTP_REQUEST, this.request);
+        this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn);
+        this.context.setAttribute(ExecutionContext.HTTP_REQUEST, this.request);
         
         this.httpproc.process(this.request, this.context);
     }
@@ -79,8 +79,8 @@
         return this.request.getRequestLine().getUri();
     }
 
-    public HttpVersion getHttpVersion() {
-        return this.request.getRequestLine().getHttpVersion();
+    public ProtocolVersion getProtocolVersion() {
+        return this.request.getRequestLine().getProtocolVersion();
     }
 
     public String getContentType() {
@@ -124,8 +124,12 @@
         return this.request.getLastHeader(name);
     }
 
-    public Iterator headerIterator() {
+    public HeaderIterator headerIterator() {
         return this.request.headerIterator();
+    }
+
+    public HeaderIterator headerIterator(final String name) {
+        return this.request.headerIterator(name);
     }
 
     public void removeHeader(final Header header) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpResponseImpl.java Sat Dec  1 06:43:28 2007
@@ -21,17 +21,17 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Iterator;
 
 import org.apache.axis2.transport.OutTransportInfo;
 import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
 import org.apache.http.HttpException;
 import org.apache.http.HttpResponse;
-import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolVersion;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpExecutionContext;
 import org.apache.http.protocol.HttpProcessor;
 
 public class AxisHttpResponseImpl implements AxisHttpResponse, OutTransportInfo {
@@ -86,8 +86,8 @@
         }
         this.commited = true;
         
-        this.context.setAttribute(HttpExecutionContext.HTTP_CONNECTION, this.conn);
-        this.context.setAttribute(HttpExecutionContext.HTTP_RESPONSE, this.response);
+        this.context.setAttribute(ExecutionContext.HTTP_CONNECTION, this.conn);
+        this.context.setAttribute(ExecutionContext.HTTP_RESPONSE, this.response);
         
         BasicHttpEntity entity = new BasicHttpEntity();
         entity.setChunked(true);
@@ -108,7 +108,7 @@
 
     public void sendError(int sc, final String msg) {
         assertNotCommitted();
-        HttpVersion ver = this.response.getHttpVersion();
+        ProtocolVersion ver = this.response.getProtocolVersion();
         this.response.setStatusLine(ver, sc, msg);
     }
 
@@ -127,8 +127,8 @@
         this.contentType = contentType;
     }
 
-    public HttpVersion getHttpVersion() {
-        return this.response.getHttpVersion();
+    public ProtocolVersion getProtocolVersion() {
+        return this.response.getProtocolVersion();
     }
 
     public void addHeader(final Header header) {
@@ -161,8 +161,12 @@
         return this.response.getLastHeader(name);
     }
 
-    public Iterator headerIterator() {
+    public HeaderIterator headerIterator() {
         return this.response.headerIterator();
+    }
+
+    public HeaderIterator headerIterator(String name) {
+        return this.response.headerIterator(name);
     }
 
     public void removeHeader(final Header header) {

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java?rev=600141&r1=600140&r2=600141&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java Sat Dec  1 06:43:28 2007
@@ -18,7 +18,18 @@
  */
 package org.apache.axis2.transport.http.server;
 
-import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.SocketException;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingHelper;
@@ -29,27 +40,29 @@
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.transport.RequestResponseTransport;
-import org.apache.axis2.transport.RequestResponseTransport.RequestResponseTransportStatus;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.util.MessageContextBuilder;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.*;
+import org.apache.http.ConnectionReuseStrategy;
+import org.apache.http.Header;
+import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.MethodNotSupportedException;
+import org.apache.http.ProtocolException;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.UnsupportedHttpVersionException;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpParamsLinker;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAP11Constants;
 
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.SocketException;
-import java.util.HashMap;
-import java.util.Iterator;
+import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
 
 /**
  * This class is an extension of the defaulf HTTP service responsible for
@@ -128,7 +141,7 @@
         try {
             HttpRequest request = conn.receiveRequest();
             HttpParamsLinker.link(request, this.params);
-            HttpVersion ver = request.getRequestLine().getHttpVersion();
+            ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
             if (!ver.lessEquals(HttpVersion.HTTP_1_1)) {
                 // Downgrade protocol version if greater than HTTP/1.1 
                 ver = HttpVersion.HTTP_1_1;
@@ -313,7 +326,7 @@
     class SimpleHTTPRequestResponseTransport implements RequestResponseTransport {
 
 		private CountDownLatch responseReadySignal = new CountDownLatch(1);
-        RequestResponseTransportStatus status = RequestResponseTransportStatus.INITIAL;
+        RequestResponseTransportStatus status = RequestResponseTransportStatus.WAITING;
         AxisFault faultToBeThrownOut = null;
         private boolean responseWritten = false;
 
@@ -324,7 +337,6 @@
         }
 
         public void awaitResponse() throws InterruptedException, AxisFault {
-            status = RequestResponseTransportStatus.WAITING;
             responseReadySignal.await();
 
             if (faultToBeThrownOut != null) {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message