You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ke...@apache.org on 2007/01/20 03:53:43 UTC

svn commit: r498050 [1/2] - in /webservices/axis2/branches/java/WSDL_2_0: etc/ modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/ modules/kernel/src/org/apache/axis2/ modules/kernel/src/org/apache/axis2/client/ modules/kernel/src/org/apache/axi...

Author: keithc
Date: Fri Jan 19 18:53:42 2007
New Revision: 498050

URL: http://svn.apache.org/viewvc?view=rev&rev=498050
Log:
1. Added a map to axisservice which holds httplocation to axisoperation mapping. Used to dispatch rest messages.
2. Added a couple of constants
3. Added safty property to axisoperation, populated the map above
3. Added couple of default values
4. Added CONTENT_TYPE_OF_FAULT to hold the content type of a fault message
5. Updated to support httpLocation templating
6. Added method applyURITemplating which can be used by both restsender and soapsender to perform URITemplating
7. Fixed status code of one way operation of rest message and add headers if responce is gzip
8. Added media types MEDIA_TYPE_MULTIPART_FORM_DATA, MEDIA_TYPE_APPLICATION_ECHO_XML
9. Changed the tranfer coding header (Still not sure which header to use, must fix it once get confirmation from w3c member)
10. Updated to handle MEDIA_TYPE_MULTIPART_FORM_DATA content type, fixed location templating.
11. Fixed dataout of fault message in rest case, added support to gzip output messages
12. Updated to read MEDIA_TYPE_MULTIPART_FORM_DATA encoded messages and fixed it to work correctly with application/x-www-form-urlencoded 
content type
13. Used to create a complex part when creating a multipart request entity
14. Fixed a bug. Need to create appropriate soap factory. It was always creating SOAP 11 stuff
15. Fixed to dispatch rest messages using the newly addes map to axisservice
16. added cabability to schemaUtil to extract data from multipart messages and also to handle custom quaryParameterSeparator
17. AxisServiceBasedMultiLanguageEmitter updated to use default httpMethod (when operation safty is involved). Added mustUnderstand to intermediate XML

Added:
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/ComplexPart.java
Modified:
    webservices/axis2/branches/java/WSDL_2_0/etc/project.properties
    webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/Constants.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20DefaultValueHolder.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/wsdl/SOAPHeaderMessage.java

Modified: webservices/axis2/branches/java/WSDL_2_0/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/etc/project.properties?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/etc/project.properties (original)
+++ webservices/axis2/branches/java/WSDL_2_0/etc/project.properties Fri Jan 19 18:53:42 2007
@@ -18,7 +18,7 @@
 # -------------------------------------------------------------------
 #                Project Information
 # -------------------------------------------------------------------
-version_number=1.2-SNAPSHOT
+version_number=1.1.1-SNAPSHOT
 #version_affix=
 axis2_version=${version_number}
 addressing_version=${axis2_version}
@@ -92,7 +92,7 @@
 activation.version=1.1
 annogen.version=0.1.0
 ant.version=1.6.5
-axiom.version=1.2.1-SNAPSHOT
+axiom.version=SNAPSHOT
 backport_util_concurrent.version=2.2
 bcel.version=5.2
 bcprov.version=jdk13-133

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Fri Jan 19 18:53:42 2007
@@ -1870,7 +1870,7 @@
         addSOAPAction(doc, methodElement, axisOperation.getName());
         addOutputAndFaultActions(doc, methodElement, axisOperation);
         addHeaderOperations(soapHeaderInputParameterList, axisOperation, true);
-        addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
+//        addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
 
         /*
          * Setting the policy of the operation
@@ -1902,12 +1902,12 @@
 
         if (WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) {
             methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.ENABLE_REST", "true"));
-            methodElement.appendChild(generateOptionParamComponent(doc," Constants.Configuration.HTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET + "\""));
-       }
+            methodElement.appendChild(generateOptionParamComponent(doc," org.apache.axis2.Constants.Configuration.HTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET + "\""));
+            methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.Constants.Configuration.CONTENT_TYPE", "\"" + "org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM" + "\""));
+      }
 
-        setTransferCoding(axisOperation, methodElement, doc);
-        
-        if (axisBinding.getType().equals(WSDL2Constants.URI_WSDL2_HTTP)) {
+
+        else if (axisBinding.getType().equals(WSDL2Constants.URI_WSDL2_HTTP)) {
 
             methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.ENABLE_REST", "true"));
             
@@ -1923,6 +1923,29 @@
             methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_METHOD", "\"" + property + "\""));
             }
 
+            Boolean value = (Boolean) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,
+                        axisOperation.getName());
+            if (value != null) {
+            methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED", "\"" + value.booleanValue() + "\""));
+            }
+            
+            // If there is no WHTTP_METHOD defined then we better compute the default value which is get if the operation
+            // is wsdlx:safe or post otherwise
+            else if (!WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) {
+                Parameter safe = axisOperation.getParameter(WSDL2Constants.ATTR_WSDLX_SAFE);
+                if (safe != null) {
+                    if (((Boolean)safe.getValue()).booleanValue()) {
+                        methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET + "\""));
+                    }
+                    else {
+                        methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_METHOD", "\"" + org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST + "\""));
+                    }
+                }
+            }
+
+
+            setTransferCoding(axisOperation, methodElement, doc);
+
             property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_CODE,
                         axisOperation.getName());
             if (property != null) {
@@ -2159,7 +2182,7 @@
         if (headerparamList != null) {
             for (Iterator iterator = headerparamList.iterator(); iterator.hasNext();) {
                 SOAPHeaderMessage header = (SOAPHeaderMessage) iterator.next();
-                soapHeaderParameterQNameList.add(header.getElement());
+                soapHeaderParameterQNameList.add(header);
             }
         }
 
@@ -2641,7 +2664,8 @@
 
             for (int i = 0; i < count; i++) {
                 Element param = doc.createElement("param");
-                QName name = (QName) parameters.get(i);
+                SOAPHeaderMessage header = (SOAPHeaderMessage) parameters.get(i);
+                QName name = header.getElement();
 
                 addAttribute(doc, "name", this.mapper.getParameterName(name), param);
 
@@ -2652,6 +2676,7 @@
 
                 addAttribute(doc, "type", typeMappingStr, param);
                 addAttribute(doc, "location", location, param);
+                addAttribute(doc, "mustUnderstand", header.isMustUnderstand().toString(), param);
                 parameterElementList.add(param);
             }
         }

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/Constants.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/Constants.java Fri Jan 19 18:53:42 2007
@@ -239,6 +239,8 @@
         public static final String ENABLE_SWA = "enableSwA";
 
         public static final String CONTENT_TYPE = "ContentType";
+        public static final String CONTENT_TYPE_OF_FAULT = "ContentTypeOfFault";
+
         public static final String IS_USING_SEPARATE_LISTENER = "IsUsingSeparateListener";
 
         public static final String CONFIG_CONTEXT_TIMOUT_INTERVAL = "ConfigContextTimeoutInterval";

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/client/Stub.java Fri Jan 19 18:53:42 2007
@@ -150,7 +150,7 @@
 
 
     protected String setAppendAddressToEPR(OperationClient _operationClient,
-                                         String addressFromBinding) {
+                                           String addressFromBinding) {
         EndpointReference toEPRFromServiceClient = _serviceClient.getOptions().getTo();
 
         String oldAddress = toEPRFromServiceClient.getAddress();
@@ -158,15 +158,10 @@
 
         // here we assume either addressFromBinding have a '?' infront or not
         if (addressFromBinding.charAt(0) != '?') {
-            addressFromBinding = "?" + addressFromBinding;
-        }
-
-        if (address.indexOf("?") != -1) {
-            address += addressFromBinding.replaceAll("\\?", "&");
-        } else {
-            address += addressFromBinding;
+            addressFromBinding = "/" + addressFromBinding;
         }
 
+        address += addressFromBinding;
         toEPRFromServiceClient.setAddress(address);
         _operationClient.getOptions().setTo(toEPRFromServiceClient);
         return oldAddress;

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java Fri Jan 19 18:53:42 2007
@@ -80,6 +80,9 @@
     private static final Log log = LogFactory.getLog(AxisService.class);
     private URL fileName;
 
+    // Maps httpLocations to corresponding operations. Used to dispatch rest messages.    
+    private HashMap httpLocationDispatcherMap = null;
+
     private HashMap operationsAliasesMap = null;
 //    private HashMap operations = new HashMap();
 
@@ -251,6 +254,7 @@
         moduleConfigmap = new HashMap();
         //by default service scope is for the request
         scope = Constants.SCOPE_REQUEST;
+        httpLocationDispatcherMap = new HashMap();
         messageReceivers = new HashMap();
         moduleRefs = new ArrayList();
         engagedModules = new ArrayList();
@@ -567,6 +571,17 @@
         operationsAliasesMap.put(action, axisOperation);
     }
 
+    /**
+     * Maps an constant string in the whttp:location to the given operation. This is used by
+     * RequestURIOperationDispatcher based dispatching to figure out which operation it is that a
+     * given message is for.
+     *
+     * @param string        the constant drawn from whttp:location
+     * @param axisOperation the operation to map to
+     */
+    public void addHttpLocationDispatcherString(String string, AxisOperation axisOperation) {
+        httpLocationDispatcherMap.put(string, axisOperation);
+    }
 
     public void printSchema(OutputStream out) throws AxisFault {
         for (int i = 0; i < schemaList.size(); i++) {
@@ -932,6 +947,27 @@
     public AxisOperation getOperationByAction(String action) {
         return (AxisOperation) operationsAliasesMap.get(action);
     }
+
+    /**
+     * Given the requestPath that the request came to his method returns the corresponding axisOperation
+     *
+     * @param requestPath - Part of the request url which is the part after the service name
+     * @return AxisOperation - The corresponding AxisOperation
+     */
+    public AxisOperation getOperationFromRequestURL(String requestPath) {
+
+        Collection httpLocations = httpLocationDispatcherMap.keySet();
+        Iterator iter = httpLocations.iterator();
+        while (iter.hasNext()) {
+            String location = (String) iter.next();
+            if (requestPath.indexOf(location) == 0) {
+                return (AxisOperation) httpLocationDispatcherMap.get(location);
+            }
+
+        }
+        return null;
+    }
+
 
     /**
      * Returns the operation given a SOAP Action. This

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20DefaultValueHolder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20DefaultValueHolder.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20DefaultValueHolder.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20DefaultValueHolder.java Fri Jan 19 18:53:42 2007
@@ -22,9 +22,16 @@
 
     private static Map defaultValuesMap = new HashMap();
 
+    public static final String WHTTP_METHOD_WSDLX_SAFE = "whttp:methodWSDLsafe";
+    public static final String WHTTP_METHOD_WSDLX_NOTSAFE = "whttp:methodWSDLNotsafe";
+
+
     static {
         defaultValuesMap.put(WSDL2Constants.ATTR_WSOAP_VERSION, WSDL2Constants.SOAP_VERSION_1_2);
         defaultValuesMap.put(WSDL2Constants.ATTR_WSOAP_ACTION, "\\\"\\\"");
+        defaultValuesMap.put(WHTTP_METHOD_WSDLX_SAFE, org.apache.axis2.Constants.Configuration.HTTP_METHOD_GET);
+        defaultValuesMap.put(WHTTP_METHOD_WSDLX_SAFE, org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST);
+        defaultValuesMap.put(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
     }
 
     public static String getDefaultValue(String name) {

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Fri Jan 19 18:53:42 2007
@@ -3,6 +3,7 @@
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.transport.http.util.RESTUtil;
 import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
@@ -12,6 +13,7 @@
 import org.apache.woden.internal.DOMWSDLFactory;
 import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingExtensionsImpl;
 import org.apache.woden.internal.wsdl20.extensions.http.HTTPBindingExtensionsImpl;
+import org.apache.woden.internal.wsdl20.extensions.InterfaceOperationExtensionsImpl;
 import org.apache.woden.schema.Schema;
 import org.apache.woden.wsdl20.*;
 import org.apache.woden.wsdl20.enumeration.Direction;
@@ -512,7 +514,7 @@
             HTTPLocation httpLocation = soapBindingOperationExtensions.getHttpLocation();
             if (httpLocation != null) {
                 axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,
-                        httpLocation.toString());
+                        httpLocation.getLocationTemplate());
             }
             axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
                     soapBindingOperationExtensions.getHttpTransferCodingDefault());
@@ -678,17 +680,35 @@
                 throw new AxisFault("HTTP Binding Extention not found");
             }
 
-            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_FAULT_SERIALIZATION, httpBindingOperationExtensions.getHttpFaultSerialization());
-            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION, httpBindingOperationExtensions.getHttpInputSerialization());
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_FAULT_SERIALIZATION,
+                    httpBindingOperationExtensions.getHttpFaultSerialization());
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION,
+                    httpBindingOperationExtensions.getHttpInputSerialization());
             HTTPLocation httpLocation = httpBindingOperationExtensions.getHttpLocation();
 
+            // If httpLocation is not null we should extract a constant part from it and add its value and the
+            // corresponding AxisOperation to a map in order to dispatch rest messages. If httpLocation is null we add
+            // the operation name into this map.
             if (httpLocation != null) {
-                axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocation.toString());
+                String httpLocationString = httpLocation.getLocationTemplate();
+                axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, httpLocationString);
+                axisService.addHttpLocationDispatcherString(RESTUtil.getConstantFromHTTPLocation(httpLocationString),
+                        axisOperation);
+            } else {
+                axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION, "/" + axisOperation.getName().
+                        getLocalPart());
             }
-            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpBindingOperationExtensions.getHttpMethod());
-            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION, httpBindingOperationExtensions.getHttpOutputSerialization());
-            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, httpBindingOperationExtensions.getHttpQueryParameterSeparator());
-            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING, httpBindingOperationExtensions.getHttpTransferCodingDefault());
+            
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED, httpBindingOperationExtensions.
+                    isHttpLocationIgnoreUncited());
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_METHOD, httpBindingOperationExtensions.
+                    getHttpMethod());
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_OUTPUT_SERIALIZATION,
+                    httpBindingOperationExtensions.getHttpOutputSerialization());
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
+                    httpBindingOperationExtensions.getHttpQueryParameterSeparator());
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
+                    httpBindingOperationExtensions.getHttpTransferCodingDefault());
 
             BindingMessageReference[] bindingMessageReferences =
                     bindingOperation.getBindingMessageReferences();
@@ -716,8 +736,10 @@
                     throw new AxisFault("HTTP Binding Extention not found");
                 }
 
-                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER, createHttpHeaders(httpBindingMessageReferenceExtensions.getHttpHeaders()));
-                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING, httpBindingMessageReferenceExtensions.getHttpTransferCoding());
+                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER,
+                        createHttpHeaders(httpBindingMessageReferenceExtensions.getHttpHeaders()));
+                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
+                        httpBindingMessageReferenceExtensions.getHttpTransferCoding());
 
 //                    SOAPHeaderBlock[] soapHeaders = soapHeaderExt.getSoapHeaders();
 //
@@ -736,12 +758,10 @@
 
                 axisBindingOperation.addChild(axisMessage.getDirection(),axisBindingMessage);
 
-
             }
 
             axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation);
 
-
         }
     }
 
@@ -782,16 +802,19 @@
         axisOperation.setMessageExchangePattern(operation.getMessageExchangePattern().toString());
         axisOperation.setStyle("document");
 
-        // The following can be used to capture the wsdlx:safe attribute
+//         The following can be used to capture the wsdlx:safe attribute
 
-//        InterfaceOperationExtensionsImpl interfaceOperationExtensions;
-//        try {
-//            interfaceOperationExtensions = (InterfaceOperationExtensionsImpl)operation.getComponentExtensionsForNamespace(new URI(WSDL2Constants.URI_WSDL2_EXTENSIONS));
-//        } catch (URISyntaxException e) {
-//            throw new AxisFault("WSDL2 extensions not defined for this operation");
-//        }
-//
-//        interfaceOperationExtensions.isSafety();
+        InterfaceOperationExtensionsImpl interfaceOperationExtensions;
+        try {
+            interfaceOperationExtensions = (InterfaceOperationExtensionsImpl)operation.getComponentExtensionsForNamespace(new URI(WSDL2Constants.URI_WSDL2_EXTENSIONS));
+        } catch (URISyntaxException e) {
+            throw new AxisFault("WSDL2 extensions not defined for this operation");
+        }
+
+        if (interfaceOperationExtensions != null) {
+            Parameter parameter = new Parameter(WSDL2Constants.ATTR_WSDLX_SAFE, new Boolean(interfaceOperationExtensions.isSafety()));
+            axisOperation.addParameter(parameter);
+        }
 
 
         InterfaceMessageReference[] interfaceMessageReferences = operation
@@ -1265,8 +1288,10 @@
 
             if (elementDeclaration != null) {
                 QName name = elementDeclaration.getName();
-                SOAPHeaderMessage soapHeaderMessage = new SOAPHeaderMessage(name);
+                SOAPHeaderMessage soapHeaderMessage = new SOAPHeaderMessage();
+                soapHeaderMessage.setElement(name);
                 soapHeaderMessage.setRequired(soapHeaderBlock.isRequired().booleanValue());
+                soapHeaderMessage.setMustUnderstand(soapHeaderBlock.mustUnderstand());
                 soapHeaderMessages.add(soapHeaderMessage);
             }
         }

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java Fri Jan 19 18:53:42 2007
@@ -19,6 +19,7 @@
 */
 
 public interface WSDL2Constants {
+    
     String WSDL_NAMESPACE = "http://www.w3.org/2006/01/wsdl";
     String DEFAULT_WSDL_NAMESPACE_PREFIX = "wsdl2";
     String DESCRIPTION = "description";
@@ -49,7 +50,7 @@
     String SOAP_BINDING_PREFIX = "SOAPBinding";
     String HTTP_PROTOCAL = "http://www.w3.org/2003/05/soap/bindings/HTTP";
     String SERVICE_LOCAL_NAME = "service";
-    
+
     String URI_HTTP_SOAP12 = "http://www.w3.org/2003/05/soap/bindings/HTTP";
     String URI_HTTP_SOAP11 = "http://www.w3.org/2006/01/soap11/bindings/HTTP";
     String URI_WSOAP_MEP = "http://www.w3.org/2003/05/soap/mep/soap-response/";
@@ -69,17 +70,17 @@
     String ATTR_WHTTP_METHOD = "whttp:method";
     String ATTR_WHTTP_CODE = "whttp:code";
     String ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR = "whttp:queryParameterSeparator";
+    String ATTR_WHTTP_IGNORE_UNCITED = "whttp:ignoreUncited";
     String ATTR_WHTTP_INPUT_SERIALIZATION = "whttp:inputSerialization";
     String ATTR_WHTTP_OUTPUT_SERIALIZATION = "whttp:outputSerialization";
     String ATTR_WHTTP_FAULT_SERIALIZATION = "whttp:faultSerialization";
     String ATTR_WHTTP_AUTHENTICATION_TYPE = "whttp:authenticationType";
     String ATTR_WHTTP_AUTHENTICATION_REALM = "whttp:authenticationRealm";
 
-
+    String ATTR_WSDLX_SAFE = "wsdlx:safe";
 
     String SOAP_VERSION_1_1 = "1.1";
     String SOAP_VERSION_1_2 = "1.2";
-
 
     String MESSAGE_LABEL_IN = "In";
     String MESSAGE_LABEL_OUT = "Out";

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Fri Jan 19 18:53:42 2007
@@ -126,7 +126,6 @@
      * method is called twice, it implies that sending the error handling has failed, in which case
      * the method logs the error and exists.
      * @deprecated (post 1.1 branch)
-     * @see org.apache.axis2.util.MessageContextBuilder.createFaultMessageContext()
      */
     public MessageContext createFaultMessageContext(MessageContext processingContext, Throwable e)
             throws AxisFault {

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/engine/RequestURIOperationDispatcher.java Fri Jan 19 18:53:42 2007
@@ -58,6 +58,10 @@
                 QName operationName = new QName(values[1]);
                 log.debug("Checking for Operation using QName(target endpoint URI fragment) : " + operationName);
                 AxisOperation axisOperation = service.getOperation(operationName);
+                if (axisOperation == null) {
+                    log.debug("Attempted to check for Operation using target endpoint URI, but the operation fragment does not match a operation name");
+                    return null;
+                }
                 AxisEndpoint axisEndpoint = service.getEndpoint((String) messageContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME));
                 AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint.getBinding().getChild(axisOperation.getName());
                 messageContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Fri Jan 19 18:53:42 2007
@@ -31,6 +31,7 @@
 import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
+import org.apache.axiom.soap.impl.llom.soap12.SOAP12Factory;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
@@ -101,7 +102,13 @@
             } else if (msgContext.isDoingREST()) {
                 XMLStreamReader xmlreader =
                         StAXUtils.createXMLStreamReader(inStream, charSetEnc);
-                SOAPFactory soapFactory = new SOAP11Factory();
+                SOAPFactory soapFactory;
+                if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
+                soapFactory = new SOAP11Factory();
+                }
+                else {
+                    soapFactory = new SOAP12Factory();
+                }
 
                 builder = new StAXOMBuilder(xmlreader);
                 builder.setOMBuilderFactory(soapFactory);

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AbstractHTTPSender.java Fri Jan 19 18:53:42 2007
@@ -25,6 +25,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.axis2.util.Utils;
@@ -33,15 +34,20 @@
 import org.apache.commons.httpclient.auth.AuthPolicy;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.woden.wsdl20.extensions.http.HTTPLocation;
 
 import javax.xml.namespace.QName;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
 import java.util.zip.GZIPInputStream;
 
 public abstract class AbstractHTTPSender {
@@ -259,7 +265,7 @@
         InputStream in = httpMethod.getResponseBodyAsStream();
 
         Header contentEncoding =
-                httpMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_ENCODING);
+                httpMethod.getResponseHeader(HTTPConstants.HEADER_TRANSFER_ENCODING);
         if (contentEncoding != null) {
             if (contentEncoding.getValue().
                     equalsIgnoreCase(HTTPConstants.COMPRESSION_GZIP)) {
@@ -526,8 +532,22 @@
                                     HTTPConstants.COMPRESSION_GZIP);
         }
         if (Utils.isExplicitlyTrue(msgContext, HTTPConstants.MC_GZIP_REQUEST)) {
-            method.addRequestHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
-                                    HTTPConstants.COMPRESSION_GZIP);
+            Header header = null;
+            if ((header = method.getRequestHeader(HTTPConstants.HEADER_TRANSFER_ENCODING))  != null)
+
+            method.removeRequestHeader(header);
+//            method.addRequestHeader(HTTPConstants.HEADER_TRANSFER_ENCODING,
+//                                    HTTPConstants.COMPRESSION_GZIP + "," + HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
+
+
+            method.addRequestHeader(HTTPConstants.HEADER_TRANSFER_ENCODING,
+                                                HTTPConstants.COMPRESSION_GZIP);
+            method.addRequestHeader(HTTPConstants.HEADER_TRANSFER_ENCODING,
+                                                HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
+
+
+
+
         }
 
 
@@ -581,5 +601,84 @@
         }
 
         return userAgentString;
+    }
+
+        protected String applyURITemplating(MessageContext messageContext, String query, boolean detach) {
+
+            OMElement firstElement;
+            if (detach) {
+                firstElement = messageContext.getEnvelope().getBody().getFirstElement();
+            }
+            else {
+                firstElement = messageContext.getEnvelope().getBody().getFirstElement().cloneOMElement();
+            }
+
+
+            HTTPLocation httpLocation = new HTTPLocation(query);
+
+            String [] localNames = httpLocation.getLocalNames();
+            String [] values = new String[localNames.length];
+            int i;
+            for (i = 0; i < localNames.length; i++) {
+                String localName = localNames[i];
+
+                try {
+                values[i] = URLEncoder.encode(getOMElementValue(localName,firstElement), "UTF-8");
+                } catch (UnsupportedEncodingException e) {
+                    log.error("Unable to encode Query String");
+                }
+            }
+
+
+             httpLocation.substitute(values);
+
+
+//            // first process the situ where user had explicitly put some params to go in the URL
+//            ArrayList httpLocationParams = (ArrayList) messageContext.getProperty(
+//                    Constants.Configuration.URL_HTTP_LOCATION_PARAMS_LIST);
+//
+//           // now let's process URL templates.
+//            String patternString = "\\{[A-Z0-9a-z._%-]+\\}";
+//            Pattern pattern = Pattern.compile(patternString);
+//
+//            StringBuffer buffer = new StringBuffer(query);
+//
+//            Matcher matcher = pattern.matcher(buffer);
+//
+//            while (matcher.find()) {
+//                String match = matcher.group();
+//
+//                // Get indices of matching string
+//                int start = matcher.start();
+//                int end = matcher.end();
+//
+//                CharSequence charSequence = match.subSequence(1, match.length() - 1);
+//
+//                buffer.delete(start, end);
+//                try {
+//                    buffer.insert(start, URLEncoder.encode(getOMElementValue(charSequence.toString(), firstElement, detach),"UTF-8"));
+//                } catch (UnsupportedEncodingException e) {
+//                    log.error("Unable to encode Query String");
+//                }
+//                matcher.reset();
+//
+//            }
+//
+//            return buffer.toString();
+
+            return httpLocation.toString();
+    }
+
+     private String getOMElementValue(String elementName, OMElement parentElement) {
+        OMElement httpURLParam = parentElement.getFirstChildWithName(new QName(elementName));
+
+        if (httpURLParam != null) {
+            httpURLParam.detach();
+            if (parentElement.getFirstOMChild() == null) {
+                parentElement.detach();
+            }
+            }
+            return httpURLParam.getText();
+
     }
 }

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Fri Jan 19 18:53:42 2007
@@ -19,6 +19,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
@@ -29,6 +30,8 @@
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.AxisBindingOperation;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.ListenerManager;
@@ -40,6 +43,11 @@
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.commons.httpclient.Header;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
@@ -54,6 +62,8 @@
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
 
 /**
  * Class AxisServlet
@@ -104,6 +114,7 @@
         msgContext.setProperty(Constants.Configuration.TRANSPORT_IN_URL, req.getRequestURL().toString());
         msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
         msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, req);
+        msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE,resp);
 //        msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, servletConfig.getServletContext());
         return msgContext;
     }
@@ -229,11 +240,20 @@
                 new RESTUtil(configContext).processPostRequest(msgContext,
                         req,
                         res);
+                Object contextWritten =
+                        msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
+                if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten)) {
+                    res.setStatus(HttpServletResponse.SC_ACCEPTED);
+                }
             } catch (Exception e) {
                 log.error(e);
                 if (msgContext != null) {
                     res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-                    handleFault(msgContext, out, new AxisFault(e));
+                    if (e instanceof AxisFault) {
+                        handleFault(msgContext, out, (AxisFault)e);
+                    } else {
+                        handleFault(msgContext, out, new AxisFault(e));
+                    }
                 } else {
                     throw new ServletException(e);
                 }
@@ -251,12 +271,31 @@
                 Object contextWritten =
                         msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
 
+                MessageContext outMsgContext = msgContext.getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                if (outMsgContext != null) {
+                    Object gzip = outMsgContext.getProperty(HTTPConstants.MC_GZIP_RESPONSE);
+                    if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) {
+                        res.addHeader(HTTPConstants.HEADER_TRANSFER_ENCODING,
+                                    HTTPConstants.COMPRESSION_GZIP);
+                    }
+                    List customHheaders = (List) outMsgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+                    if (customHheaders != null) {
+                        Iterator iter = customHheaders.iterator();
+                        while (iter.hasNext()) {
+                            Header header = (Header) iter.next();
+                            if (header != null) {
+                                res.addHeader(header.getName(), header.getValue());
+                            }
+                        }
+                    }
+                }
                 res.setContentType("text/xml; charset="
                         + msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
 
                 if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten)) {
                     res.setStatus(HttpServletResponse.SC_ACCEPTED);
                 }
+
             } catch (AxisFault e) {
                 log.debug(e);
                 if (msgContext != null) {
@@ -265,7 +304,16 @@
                         if (AddressingHelper.isFaultRedirected(msgContext)) {
                             res.setStatus(HttpServletResponse.SC_ACCEPTED);
                         } else {
+
                             res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+                            AxisBindingOperation axisBindingOperation = (AxisBindingOperation) msgContext.getProperty(Constants.AXIS_BINDING_OPERATION);
+                            if (axisBindingOperation != null) {
+                                String code = (String) axisBindingOperation.getFault((String) msgContext.getProperty(Constants.FAULT_NAME)).getProperty(WSDL2Constants.ATTR_WHTTP_CODE);
+                                if (code != null) {
+                                    res.setStatus(Integer.parseInt(code));
+                                }
+                            }
                         }
                         handleFault(msgContext, out, e);
                     } catch (AxisFault e2) {
@@ -283,6 +331,14 @@
                             res.setStatus(HttpServletResponse.SC_ACCEPTED);
                         } else {
                             res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+                            AxisBindingOperation axisBindingOperation = (AxisBindingOperation) msgContext.getProperty(Constants.AXIS_BINDING_OPERATION);
+                            if (axisBindingOperation != null) {
+                                String code = (String) axisBindingOperation.getFault((String) msgContext.getProperty(Constants.FAULT_NAME)).getProperty(WSDL2Constants.ATTR_WHTTP_CODE);
+                                if (code != null) {
+                                    res.setStatus(Integer.parseInt(code));
+                                }
+                            }
                         }
                         handleFault(msgContext, out, new AxisFault(t.toString(), t));
                     } catch (AxisFault e2) {
@@ -300,7 +356,28 @@
         msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
 
         AxisEngine engine = new AxisEngine(configContext);
-        MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgContext, e);
+        MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+
+        // SOAP 1.2 specification mentions that we should send HTTP code 400 in a fault if the
+        // fault code Sender
+        HttpServletResponse response = (HttpServletResponse) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
+         if (response != null) {
+            SOAPFaultCode code = faultContext.getEnvelope().getBody().getFault().getCode();
+            OMElement valueElement = null;
+            if (code != null) {
+                valueElement = code.getFirstChildWithName(new QName(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            }
+
+            if (valueElement != null) {
+                if (valueElement.getText().trim().indexOf(SOAP12Constants.FAULT_CODE_SENDER) >
+                    -1) {
+                    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+                }
+            }
+        }
+
 
         engine.sendFault(faultContext);
     }
@@ -521,9 +598,9 @@
      */
     private boolean isRESTRequest(HttpServletRequest request) {
         String contentType = request.getContentType();
-        String soapActionHeader = request.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
 
-        return ((soapActionHeader == null) ||
-                (contentType != null && contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1));
+        return ((contentType == null || contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1 ||
+        contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 ||
+        contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1));
     }
 }

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Fri Jan 19 18:53:42 2007
@@ -43,8 +43,10 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.StringWriter;
+import java.io.ByteArrayOutputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.zip.GZIPOutputStream;
 
 public class CommonsHTTPTransportSender extends AbstractHandler implements TransportSender {
 
@@ -95,8 +97,7 @@
 
                 if ((transferEncoding != null)
                         &&
-                        HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED.equals(
-                                transferEncoding.getValue())) {
+                        transferEncoding.toString().indexOf(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED) > -1) {
                     chunked = true;
                 }
             } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version.getValue())) {
@@ -195,7 +196,11 @@
              * Figuringout the REST properties/parameters
              */
             if (msgContext.isDoingREST()) {
-                dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+                if (msgContext.getFLOW() == MessageContext.OUT_FAULT_FLOW) {
+                    dataOut = msgContext.getEnvelope().getBody().getFault().getDetail().getFirstElement();
+                } else {
+                    dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+                }
             } else {
                 dataOut = msgContext.getEnvelope();
             }
@@ -246,7 +251,12 @@
                 if (contentTypeObject != null) {
                     contentType = (String) contentTypeObject;
                 } else if (msgContext.isDoingREST() && !(format.isOptimized())) {
-                    contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
+                    String property = (String)msgContext.getProperty(Constants.Configuration.CONTENT_TYPE);
+                    if (property != null) {
+                        contentType = property;
+                    } else {
+                        contentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
+                    }
                 } else {
                     contentType = format.getContentType();
                     format.setSOAP11(msgContext.isSOAP11());
@@ -272,7 +282,23 @@
             MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
                     out, msgContext.getAttachmentMap(), format);
         } else {
-            dataOut.serializeAndConsume(out, format);
+            Object gzip = msgContext.getOptions().getProperty(HTTPConstants.MC_GZIP_RESPONSE);
+            if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) {
+                GZIPOutputStream gzout = null;
+                ByteArrayOutputStream compressed = new ByteArrayOutputStream();
+                try {
+                    gzout = new GZIPOutputStream(compressed);
+                    dataOut.serializeAndConsume(gzout, format);
+                    gzout.flush();
+                    gzout.close();
+                    out.write(compressed.toByteArray());
+                } catch (IOException e) {
+                    throw new AxisFault("Could not compress response");
+                }
+            } else {
+                dataOut.serializeAndConsume(out, format);
+            }
+
         }
     }
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPConstants.java Fri Jan 19 18:53:42 2007
@@ -30,8 +30,10 @@
             "application/x-www-form-urlencoded";
     public static final String MEDIA_TYPE_TEXT_XML = "text/xml";
     public static final String MEDIA_TYPE_MULTIPART_RELATED = "multipart/related";
+    public static final String MEDIA_TYPE_MULTIPART_FORM_DATA = "multipart/form-data";
     public static final String MEDIA_TYPE_APPLICATION_XML = "application/xml";
     public static final String MEDIA_TYPE_APPLICATION_SOAP_XML = "application/soap+xml";
+    public static final String MEDIA_TYPE_APPLICATION_ECHO_XML = "application/echo+xml";
 
     /**
      * Field REQUEST_URI
@@ -446,6 +448,11 @@
      * context property to true to have the request body gzip compressed.
      */
     public static final String MC_GZIP_REQUEST = "transport.http.gzipRequest";
+
+     /* by default the HTTP response body is not compressed. set this message
+     * context property to true to have the response body gzip compressed.
+     */
+    public static final String MC_GZIP_RESPONSE = "gzipResponse";
 
     /**
      * This will allow users to set any custom headers to the message context, which will be picked

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Fri Jan 19 18:53:42 2007
@@ -42,11 +42,13 @@
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
+import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Enumeration;
 import java.util.zip.GZIPInputStream;
 
 public class HTTPTransportUtils {
@@ -164,11 +166,15 @@
         try {
 
             Map headers = (Map) msgContext.getProperty(MessageContext.TRANSPORT_HEADERS);
+
             if (headers != null) {
-                if (HTTPConstants.COMPRESSION_GZIP.equals(headers.get(HTTPConstants.HEADER_CONTENT_ENCODING)) ||
-                    HTTPConstants.COMPRESSION_GZIP.equals(headers.get(HTTPConstants.HEADER_CONTENT_ENCODING.toLowerCase())))
+                String header = (String)headers.get(HTTPConstants.HEADER_TRANSFER_ENCODING);
+                if (header != null) {
+                if (((header.indexOf(HTTPConstants.COMPRESSION_GZIP)) > -1) ||
+                    ((header.toLowerCase().indexOf(HTTPConstants.COMPRESSION_GZIP)) > -1))
                 {
                     in = new GZIPInputStream(in);
+                }
                 }
             }
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/RESTSender.java Fri Jan 19 18:53:42 2007
@@ -23,6 +23,8 @@
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.transport.http.util.ComplexPart;
+import org.apache.axis2.util.UUIDGenerator;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.i18n.Messages;
 import org.apache.commons.httpclient.Header;
@@ -32,6 +34,9 @@
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.RequestEntity;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -41,22 +46,66 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.nio.charset.Charset;
 
 public class RESTSender extends AbstractHTTPSender {
     private static final Log log = LogFactory.getLog(RESTSender.class);
 
+    public Part [] createMultipatFormDataRequest(MessageContext msgContext, OMElement dataOut) {
+        ArrayList parts = new ArrayList();
+        String requestData = "";
+        if (dataOut != null) {
+            Iterator iter1 = dataOut.getChildElements();
+
+            while (iter1.hasNext()) {
+               OMElement ele = (OMElement) iter1.next();
+                // check whether the element is a complex type
+                if (ele.getFirstElement() != null) {
+                    requestData = "<" + ele.getQName().getLocalPart() + ">";
+                    requestData = requestData + processComplexType(ele.getChildElements());
+                    requestData = requestData + "</" + ele.getQName().getLocalPart() + ">";
+                    parts.add(new ComplexPart(ele.getQName().getLocalPart(),requestData));
+                } else {
+                    parts.add(new StringPart(ele.getQName().getLocalPart(),ele.getText()));
+                }
+            }
+        }
+        Part [] partsArray = new Part[parts.size()];
+        return (Part [])parts.toArray(partsArray);
+    }
+
+    private String processComplexType(Iterator iter) {
+        String data = "";
+        while (iter.hasNext()) {
+            OMElement ele = (OMElement) iter.next();
+            data = data + "<" + ele.getQName().getLocalPart() + ">\n";
+            if (ele.getFirstElement() != null) {
+                data = data + processComplexType(ele.getChildElements());
+            } else {
+                data = data + "<" + ele.getQName().getLocalPart() + ">";
+                data = data + ele.getText();
+                data = data + "</" + ele.getQName().getLocalPart() + ">\n";
+            }
+        }
+        return data;
+    }
+
     /*Obtain two strings;one to go in the url and rest to pass in the body
     **when doing POST in application/x-www-form-urlencoded form.
     */
     public RequestData createRequest(MessageContext msgContext, OMElement dataout) {
 
         RequestData data = new RequestData();
+        if (dataout != null) {
         Iterator iter1 = dataout.getChildElements();
         ArrayList paraList = new ArrayList();
         ArrayList urlList = new ArrayList();
@@ -115,6 +164,11 @@
             data.bodyRequest = paraString;
         }
 
+        if (dataout.getFirstOMChild() == null) {
+            dataout.detach();
+        }
+        }
+
         return data;
     }
 
@@ -160,6 +214,7 @@
      * @return - the URL after appending the properties
      */
     protected String appendParametersToURL(MessageContext messageContext, String urlString, String queryPart) {
+        StringBuffer buffer = null;
         try {
             OMElement firstElement = messageContext.getEnvelope().getBody().getFirstElement();
 
@@ -170,16 +225,16 @@
             URL url = new URL(urlString);
             String path = url.getPath();
 
-            if (httpLocationParams != null) {
-                for (int i = 0; i < httpLocationParams.size(); i++) {
-                    String httpLocationParam = (String) httpLocationParams.get(i);
-                    OMElement httpURLParam = firstElement.getFirstChildWithName(new QName(httpLocationParam));
-                    if (httpURLParam != null) {
-                        path += "/" + httpURLParam.getText();
-                        httpURLParam.detach();
-                    }
-                }
-            }
+//            if (httpLocationParams != null) {
+//                for (int i = 0; i < httpLocationParams.size(); i++) {
+//                    String httpLocationParam = (String) httpLocationParams.get(i);
+//                    OMElement httpURLParam = firstElement.getFirstChildWithName(new QName(httpLocationParam));
+//                    if (httpURLParam != null) {
+//                        path += "/" + httpURLParam.getText();
+//                        httpURLParam.detach();
+//                    }
+//                }
+//            }
 
             if (queryPart != null && queryPart.length() > 0) {
                 if (queryPart.startsWith("?")) {
@@ -193,7 +248,7 @@
             String patternString = "\\{[A-Z0-9a-z._%-]+\\}";
             Pattern pattern = Pattern.compile(patternString);
 
-            StringBuffer buffer = new StringBuffer(path);
+            buffer = new StringBuffer(path);
 
             Matcher matcher = pattern.matcher(buffer);
 
@@ -217,6 +272,10 @@
         } catch (MalformedURLException e) {
             log.error("Error in processing POST request", e);
         }
+        catch (StringIndexOutOfBoundsException e) {
+            log.error("Error in processing POST request", e);
+            return buffer.toString();
+        }
 
         return null;
     }
@@ -241,10 +300,21 @@
             getMethod.setDoAuthentication(true);
         }
 
-        String urlString = url.getFile();
-        urlString = appendParametersToURL(msgContext, urlString, param);
+        String urlString = url.toString();
+        int separator = urlString.indexOf('{');
+        if (separator > 0) {
+            String path = urlString.substring(0, separator - 1);
+            String query = urlString.substring(separator - 1);
+            String replacedQuery ;
+                 replacedQuery = applyURITemplating(msgContext, query, false);
+            url = new URL(path + replacedQuery);
+        }
 
-        getMethod.setPath(urlString);
+//        String urlString = url.getFile();
+//        urlString = appendParametersToURL(msgContext, urlString, param);
+
+        getMethod.setPath(url.getPath());
+        getMethod.setQueryString(url.getQuery());
 
         // Serialization as "application/x-www-form-urlencoded"
         String charEncoding =
@@ -311,26 +381,45 @@
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
 
+        String urlString = url.toString();
+        int separator = urlString.indexOf('{');
+        if (separator > 0) {
+            String path = urlString.substring(0, separator - 1);
+            String query = urlString.substring(separator - 1);
+            String replacedQuery ;
+            if (httpContentType.equalsIgnoreCase(HTTPConstants.MEDIA_TYPE_X_WWW_FORM)) {
+            replacedQuery = applyURITemplating(msgContext, query, true);
+            }
+            else {
+                 replacedQuery = applyURITemplating(msgContext, query, false);
+            }
+            url = new URL(path + replacedQuery);
+        }
+
+        postMethod.setPath(url.getPath());
+        postMethod.setQueryString(url.getQuery());
+
         // if POST as application/x-www-form-urlencoded
         RequestData reqData;
 
         if (httpContentType.equalsIgnoreCase(HTTPConstants.MEDIA_TYPE_X_WWW_FORM)) {
             reqData = createRequest(msgContext, dataout);
-            String pathString = url.getPath();
-
-            String urlString = appendParametersToURL(msgContext, pathString, reqData.urlRequest);
-
-            postMethod.setPath(urlString);
-
             if (reqData.bodyRequest == null) {
                 reqData.bodyRequest = "0";
             }
             postMethod.setRequestEntity(new AxisRESTRequestEntity(reqData.bodyRequest, httpContentType));
 
+        } else if (httpContentType.equalsIgnoreCase(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA)) {
+//            String uuid = UUIDGenerator.getUUID();
+//            String uuid = "-------------------------"+System.currentTimeMillis();
+            Part[] parts = createMultipatFormDataRequest(msgContext, dataout);   
+//            postMethod.setRequestEntity(new AxisRESTRequestEntity(bodyData, httpContentType + "; boundry=" + uuid));
+
+//            Part[] parts = {new ComplexPart("param_name", "value"), new StringPart("second param", "second value")};
+            postMethod.setRequestEntity(new MultipartRequestEntity(parts, postMethod.getParams()));
         } else {
-            postMethod.setPath(url.getPath());
             postMethod.setRequestEntity(new AxisRequestEntity(dataout, chunked, msgContext,
-                    charEncoding, soapActionString));
+                    charEncoding, soapActionString, httpContentType));
         }
 
         if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
@@ -425,17 +514,20 @@
         private OMElement element;
         private MessageContext msgCtxt;
         private String soapActionString;
+        private String contentType;
 
         public AxisRequestEntity(OMElement element, boolean chunked,
                                  MessageContext msgCtxt,
                                  String charSetEncoding,
-                                 String soapActionString) {
+                                 String soapActionString,
+                                 String contentType) {
             this.element = element;
             this.chunked = chunked;
             this.msgCtxt = msgCtxt;
             this.doingMTOM = msgCtxt.isDoingMTOM();
             this.charSetEnc = charSetEncoding;
             this.soapActionString = soapActionString;
+            this.contentType = contentType;
         }
 
         private void handleOMOutput(OutputStream out, boolean doingMTOM)
@@ -474,7 +566,7 @@
                 {
                     if (chunked) {
                         this.handleOMOutput(out, doingMTOM);
-                    } else {
+                    } else if (element != null) {
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
@@ -498,13 +590,15 @@
                 {
                     if (chunked) {
                         return -1;
-                    } else {
+                    } else if (element != null) {
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
 
                         return bytes.length;
                     }
+
+                    return 0;
                 }
             } catch (AxisFault e) {
                 return -1;
@@ -513,16 +607,13 @@
 
         public String getContentType() {
             String encoding = format.getCharSetEncoding();
-            String contentType = format.getContentType();
-
             if (encoding != null) {
                 contentType += "; charset=" + encoding;
             }
 
             // action header is not mandated in SOAP 1.2. So putting it, if available
             if (!msgCtxt.isSOAP11() && (soapActionString != null)
-                    && !"".equals(soapActionString.trim()) && ! "\"\"".equals(soapActionString.trim()))
-            {
+                    && !"".equals(soapActionString.trim()) && !"\"\"".equals(soapActionString.trim())) {
                 contentType =
                         contentType + ";action=\"" + soapActionString + "\";";
             }

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java Fri Jan 19 18:53:42 2007
@@ -22,10 +22,15 @@
 import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLEncoder;
 import java.util.zip.GZIPOutputStream;
+import java.util.ArrayList;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
 
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
@@ -53,7 +58,20 @@
         // execute the HtttpMethodBase - a connection manager can be given for
         // handle multiple
         HttpClient httpClient = getHttpClient(msgContext);
-        PostMethod postMethod = new PostMethod(url.toString());
+
+        // Check whther the url has httpLocation
+        String urlString = url.toString();
+        int separator = urlString.indexOf('{');
+        if (separator > 0) {
+            String path = urlString.substring(0, separator - 1);
+            String query = urlString.substring(separator - 1);
+            String replacedQuery ;
+                 replacedQuery = applyURITemplating(msgContext, query, false);
+            url = new URL(path + replacedQuery);
+        }
+        PostMethod postMethod = new PostMethod();
+        postMethod.setPath(url.getPath());
+        postMethod.setQueryString(url.getQuery());
         if (isAuthenticationEnabled(msgContext)) {
             postMethod.setDoAuthentication(true);
         }
@@ -65,7 +83,6 @@
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
 
-        postMethod.setPath(url.getPath());
         postMethod.setRequestEntity(new AxisSOAPRequestEntity(dataout, chunked, msgContext,
                 charEncoding, soapActionString));
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java Fri Jan 19 18:53:42 2007
@@ -37,7 +37,7 @@
 import org.apache.http.HttpRequest;
 
 public class HttpUtils {
-    
+
     private HttpUtils() {
     }
 
@@ -90,5 +90,4 @@
     private static boolean isIP(String hostAddress) {
         return hostAddress.split("[.]").length == 4;
     }
-    
 }

Added: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/ComplexPart.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/ComplexPart.java?view=auto&rev=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/ComplexPart.java (added)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/ComplexPart.java Fri Jan 19 18:53:42 2007
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.transport.http.util;
+
+import org.apache.commons.httpclient.methods.multipart.PartBase;
+import org.apache.commons.httpclient.util.EncodingUtil;
+
+import java.io.OutputStream;
+import java.io.IOException;
+
+public class ComplexPart extends PartBase {
+
+    /** Default content encoding of string parameters. */
+    public static final String DEFAULT_CONTENT_TYPE = "application/xml";
+
+    /** Default charset of string parameters*/
+    public static final String DEFAULT_CHARSET = "US-ASCII";
+
+    /** Default transfer encoding of string parameters*/
+    public static final String DEFAULT_TRANSFER_ENCODING = "8bit";
+
+    /** Contents of this StringPart. */
+    private byte[] content;
+
+    /** The String value of this part. */
+    private String value;
+
+    /**
+     * Constructor.
+     *
+     * @param name The name of the part
+     * @param value the string to post
+     * @param charset the charset to be used to encode the string, if <code>null</code>
+     * the {@link #DEFAULT_CHARSET default} is used
+     */
+    public ComplexPart(String name, String value, String charset) {
+
+        super(
+            name,
+            DEFAULT_CONTENT_TYPE,
+            charset == null ? DEFAULT_CHARSET : charset,
+            DEFAULT_TRANSFER_ENCODING
+        );
+        if (value == null) {
+            throw new IllegalArgumentException("Value may not be null");
+        }
+        if (value.indexOf(0) != -1) {
+            // See RFC 2048, 2.8. "8bit Data"
+            throw new IllegalArgumentException("NULs may not be present in string parts");
+        }
+        this.value = value;
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param name The name of the part
+     * @param value the string to post
+     */
+    public ComplexPart(String name, String value) {
+        this(name, value, null);
+    }
+
+    /**
+     * Gets the content in bytes.  Bytes are lazily created to allow the charset to be changed
+     * after the part is created.
+     *
+     * @return the content in bytes
+     */
+    private byte[] getContent() {
+        if (content == null) {
+            content = EncodingUtil.getBytes(value, getCharSet());
+        }
+        return content;
+    }
+
+    /**
+     * Writes the data to the given OutputStream.
+     * @param out the OutputStream to write to
+     * @throws IOException if there is a write error
+     */
+    protected void sendData(OutputStream out) throws IOException {
+        out.write(getContent());
+    }
+
+    /**
+     * Return the length of the data.
+     * @return The length of the data.
+     * @throws IOException If an IO problem occurs
+     * @see org.apache.commons.httpclient.methods.multipart.Part#lengthOfData()
+     */
+    protected long lengthOfData() throws IOException {
+        return getContent().length;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.commons.httpclient.methods.multipart.BasePart#setCharSet(java.lang.String)
+     */
+    public void setCharSet(String charSet) {
+        super.setCharSet(charSet);
+        this.content = null;
+    }
+
+}

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java Fri Jan 19 18:53:42 2007
@@ -28,9 +28,14 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisMessage;
 import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.AxisBindingOperation;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.engine.RequestURIBasedDispatcher;
 import org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher;
+import org.apache.axis2.engine.RequestURIOperationDispatcher;
 import org.apache.axis2.transport.TransportUtils;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.util.SchemaUtil;
@@ -68,10 +73,12 @@
                 throw new AxisFault("ContentType should be given to proceed," +
                         " according to WSDL 2.0 HTTP binding rules");
             } else if (contentType.indexOf(HTTPConstants.MEDIA_TYPE_TEXT_XML) > -1 ||
-                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED) > -1) {
+                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED) > -1  ||
+                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1) {
                 soapEnvelope = handleNonURLEncodedContentTypes(msgContext, request,
                         OMAbstractFactory.getSOAP11Factory());
-            } else if (contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1) {
+            } else if (contentType.indexOf(HTTPConstants.MEDIA_TYPE_X_WWW_FORM) > -1 ||
+                    contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA) > -1) {
                 // 2. Else, Dispatch and find out the operation and the service.
                 // Dispatching can only be done using the RequestURI, as others can not be run in the REST case
                 dispatchAndVerify(msgContext);
@@ -90,6 +97,7 @@
             } else {
                 throw new AxisFault("Content type should be one of /n " + HTTPConstants.MEDIA_TYPE_TEXT_XML +
                         "/n " + HTTPConstants.MEDIA_TYPE_X_WWW_FORM +
+                        "/n " + HTTPConstants.MEDIA_TYPE_APPLICATION_XML +
                         "/n " + HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED);
             }
 
@@ -161,6 +169,7 @@
     private void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
         RequestURIBasedDispatcher requestDispatcher = new RequestURIBasedDispatcher();
         requestDispatcher.invoke(msgContext);
+        dispatchOperation(msgContext);
 
         // check for the dispatching result
         if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null) {
@@ -169,6 +178,22 @@
         }
     }
 
+    private void dispatchOperation(MessageContext msgContext) {
+        AxisService axisService = msgContext.getAxisService();
+        if (axisService != null) {
+        HttpServletRequest httpServletRequest= (HttpServletRequest)msgContext.getProperty(Constants.HTTP_SERVLET_REQUEST);
+        String url = httpServletRequest.getPathInfo();
+        String pathString = parseRequestURL(httpServletRequest.getPathInfo() + "?" + httpServletRequest.getQueryString());
+        AxisOperation axisOperation = axisService.getOperationFromRequestURL(pathString);
+            if (axisOperation != null) {
+                AxisEndpoint axisEndpoint = axisService.getEndpoint((String) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME));
+                AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint.getBinding().getChild(axisOperation.getName());
+                msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
+                msgContext.setAxisOperation(axisOperation);
+            }
+        }
+    }
+
     private SOAPEnvelope handleNonURLEncodedContentTypes(MessageContext msgCtxt,
                                                          HttpServletRequest request,
                                                          SOAPFactory soapFactory) throws AxisFault {
@@ -183,31 +208,31 @@
             // irrespective of the schema, if the media type is text/xml, all the information
             // should be in the body.
             // I'm assuming here that the user is sending this data according to the schema.
-            if (checkContentType(org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_TEXT_XML, contentType)) {
+            if (checkContentType(org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_TEXT_XML, contentType) ||
+                    checkContentType(org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_APPLICATION_XML, contentType)) {
+
+                // get the type of char encoding
+                String charSetEnc = TransportUtils.getCharSetEncoding(contentType);
 
                 // If charset is not specified
                 XMLStreamReader xmlreader;
-                if (TransportUtils.getCharSetEncoding(contentType) == null) {
-                    xmlreader = StAXUtils.createXMLStreamReader(inputStream, MessageContext.DEFAULT_CHAR_SET_ENCODING);
-
+                if (charSetEnc == null) {
                     // Set the encoding scheme in the message context
-                    msgCtxt.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
-                            MessageContext.DEFAULT_CHAR_SET_ENCODING);
-                } else {
+                    charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+                }
 
-                    // get the type of char encoding
-                    String charSetEnc = TransportUtils.getCharSetEncoding(contentType);
+                // Setting the value in msgCtx
+                msgCtxt.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
 
-                    xmlreader = StAXUtils.createXMLStreamReader(inputStream,
+                // Create documentElement only if the content length is greator than 0
+                if (request.getContentLength() != 0) {
+                xmlreader = StAXUtils.createXMLStreamReader(inputStream,
                             charSetEnc);
-
-                    // Setting the value in msgCtx
-                    msgCtxt.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
-                }
-
                 OMNodeEx documentElement = (OMNodeEx) new StAXOMBuilder(xmlreader).getDocumentElement();
                 documentElement.setParent(null);
                 body.addChild(documentElement);
+                }
+                
 
                 // if the media type is multipart/related, get help from Axis2 :)
             } else
@@ -233,4 +258,34 @@
         }
         return contentTypeStringFromRequest.indexOf(contentType) > -1;
     }
+
+    public static String getConstantFromHTTPLocation(String httpLocation) {
+        if (httpLocation.charAt(0) != '?') {
+                    httpLocation = "/" + httpLocation;
+        }
+        int index = httpLocation.indexOf("{");
+        if (index > -1) {
+            httpLocation =  httpLocation.substring(0,index -1);
+        }
+        return httpLocation;
+    }
+
+    private String parseRequestURL (String path) {
+
+        path = path.substring(1);
+        int index = path.indexOf("/");
+        String service = null;
+
+        if (-1 != index) {
+            service =  path.substring(index);
+        }
+         else {
+            int queryIndex = path.indexOf("?");
+            service = path.substring(queryIndex);
+        }
+         return service;
+    }
+
 }
+
+

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java?view=diff&rev=498050&r1=498049&r2=498050
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java Fri Jan 19 18:53:42 2007
@@ -157,6 +157,11 @@
         // Create a basic response MessageContext with basic fields copied
         MessageContext faultContext = createResponseMessageContext(processingContext);
 
+        String contentType = (String)processingContext.getProperty(Constants.Configuration.CONTENT_TYPE_OF_FAULT);
+        if (contentType != null) {
+            faultContext.setProperty(Constants.Configuration.CONTENT_TYPE,contentType);
+        }
+
         // Register the fault message context
         if (processingContext.getAxisOperation() != null && processingContext.getOperationContext() != null)
         {



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