axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r499743 - in /webservices/axis2/branches/java/WSDL_2_0/modules: codegen/src/org/apache/axis2/wsdl/codegen/emitter/ kernel/src/org/apache/axis2/ kernel/src/org/apache/axis2/client/ kernel/src/org/apache/axis2/transport/http/ kernel/src/org/a...
Date Thu, 25 Jan 2007 11:15:19 GMT
Author: keithc
Date: Thu Jan 25 03:15:18 2007
New Revision: 499743

URL: http://svn.apache.org/viewvc?view=rev&rev=499743
Log:
added method to add httpHeaders to ServletBasedOutTransportInfo
implemented doDelete in AxisServlet and RestSender
Updated CommonsHTTPTransportSender to add custom httpHeaders to response
Added Delete and PUT constants  


Modified:
    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/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/RESTSender.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.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/MultipleEntryHashMap.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -1910,7 +1910,7 @@
 
         if (WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) {
             methodElement.appendChild(generateOptionParamComponent(doc, "org.apache.axis2.Constants.Configuration.ENABLE_REST",
"true"));
-            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.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" + "\""));
       }
 
@@ -1922,29 +1922,28 @@
             property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_METHOD,
                         axisOperation.getName());
             if (property != null) {
-            methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_METHOD",
"\"" + property + "\""));
+            methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.Constants.Configuration.HTTP_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 + "\""));
+                        methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.Constants.Configuration.HTTP_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 + "\""));
+                        methodElement.appendChild(generateOptionParamComponent(doc,"org.apache.axis2.Constants.Configuration.HTTP_METHOD",
"\"" + org.apache.axis2.Constants.Configuration.HTTP_METHOD_POST + "\""));
                     }
                 }
             }
 
+            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() + "\""));
+            }
 
             property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_CODE,
                         axisOperation.getName());

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -233,6 +233,8 @@
         public static final String ATTACHMENT_TEMP_DIR = "attachmentDIR";
         public static final String FILE_SIZE_THRESHOLD = "sizeThreshold";
         public static final String HTTP_METHOD_GET = "GET";
+        public static final String HTTP_METHOD_DELETE = "DELETE";
+        public static final String HTTP_METHOD_PUT = "PUT";
         public static final String HTTP_METHOD = "HTTP_METHOD";
         public static final String HTTP_METHOD_POST = "POST";
 

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -21,10 +21,7 @@
 
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.*;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
 import org.apache.axiom.soap.SOAP11Constants;
@@ -227,10 +224,10 @@
        addPropertyToOperationClient(operationClient,propertyKey,new Integer(value));
     }
 
-    protected void setMustUnderstand(OMElement headerElement){
+    protected void setMustUnderstand(OMElement headerElement, OMNamespace omNamespace){
         OMFactory omFactory = OMAbstractFactory.getOMFactory();
         OMAttribute mustUnderstandAttribute =
-                omFactory.createOMAttribute("mustUnderstand",headerElement.getDefaultNamespace(),"true");
+                omFactory.createOMAttribute(SOAP12Constants.ATTR_MUSTUNDERSTAND,omNamespace,
"true");
         headerElement.addAttribute(mustUnderstandAttribute);
     }
 

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -194,9 +194,15 @@
             MessageContext messageContext = null;
             try {
                 messageContext = createMessageContext(req, resp);
+                messageContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_GET);
                 new RESTUtil(configContext).processGetRequest(messageContext,
                         req,
                         resp);
+                Object contextWritten =
+                        messageContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
+                if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten))
{
+                    resp.setStatus(HttpServletResponse.SC_ACCEPTED);
+                }
             } catch (Exception e) {
                 log.error(e);
                 if (messageContext != null) {
@@ -268,24 +274,24 @@
                 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());
-                            }
-                        }
-                    }
-                }
+//                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));
 
@@ -348,6 +354,47 @@
                     throw new ServletException(t);
                 }
             }
+        }
+    }
+
+        protected void doDelete(HttpServletRequest req,
+                         HttpServletResponse resp) throws ServletException, IOException {
+
+        initContextRoot(req);
+
+        // this method is also used to serve for the listServices request.
+
+        String requestURI = req.getRequestURI();
+        String query = req.getQueryString();
+
+            
+        if (!disableREST && enableRESTInAxis2MainServlet) { // if the main servlet
should handle REST also
+            MessageContext messageContext = null;
+            try {
+                messageContext = createMessageContext(req, resp);
+                messageContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_DELETE);
+                new RESTUtil(configContext).processGetRequest(messageContext,
+                        req,
+                        resp);
+                Object contextWritten =
+                        messageContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
+                if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten))
{
+                    resp.setStatus(HttpServletResponse.SC_ACCEPTED);
+                }
+            } catch (Exception e) {
+                log.error(e);
+                if (messageContext != null) {
+                    resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                    handleFault(messageContext, resp.getOutputStream(), new AxisFault(e));
+                } else {
+                    throw new ServletException(e);
+                }
+            }
+        } else {
+            PrintWriter writer = new PrintWriter(resp.getOutputStream());
+            writer.println("<html><body><h2>Please enable REST support
in WEB-INF/conf/axis2.xml and WEB-INF/web.xml</h2></body></html>");
+            writer.flush();
+            resp.setStatus(HttpServletResponse.SC_ACCEPTED);
         }
     }
 

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -35,11 +35,13 @@
 import org.apache.axis2.transport.TransportSender;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.Header;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.StringWriter;
@@ -47,6 +49,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.zip.GZIPOutputStream;
+import java.util.List;
+import java.util.Iterator;
 
 public class CommonsHTTPTransportSender extends AbstractHandler implements TransportSender
{
 
@@ -282,8 +286,21 @@
             MIMEOutputUtils.writeSOAPWithAttachmentsMessage(bufferedSOAPBody,
                     out, msgContext.getAttachmentMap(), format);
         } else {
+            ServletBasedOutTransportInfo transportInfo = (ServletBasedOutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
+            List customHheaders = (List) msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+            if (customHheaders != null) {
+                Iterator iter = customHheaders.iterator();
+                while (iter.hasNext()) {
+                    Header header = (Header) iter.next();
+                    if (header != null) {
+                        transportInfo.addHeader(header.getName(), header.getValue());
+                    }
+                }
+            }
             Object gzip = msgContext.getOptions().getProperty(HTTPConstants.MC_GZIP_RESPONSE);
             if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) {
+                transportInfo.addHeader(HTTPConstants.HEADER_TRANSFER_ENCODING,
+                        HTTPConstants.COMPRESSION_GZIP);
                 GZIPOutputStream gzout = null;
                 ByteArrayOutputStream compressed = new ByteArrayOutputStream();
                 try {

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -36,6 +36,7 @@
 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.DeleteMethod;
 import org.apache.commons.httpclient.methods.multipart.StringPart;
 import org.apache.commons.httpclient.methods.multipart.Part;
 import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
@@ -190,14 +191,17 @@
             String httpMethod =
                     (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
 
-            if ((httpMethod != null)
-                    && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod))
{
-                this.sendViaGet(msgContext, url);
-
-                return;
+            if (httpMethod != null) {
+                if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod))
{
+                    this.sendViaGet(msgContext, url);
+                    return;
+                } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod))
{
+                    this.sendViaDelete(msgContext, url);
+                    return;
+                }
+            } else {
+                this.sendViaPost(msgContext, dataout, url, soapActionString);
             }
-
-            this.sendViaPost(msgContext, dataout, url, soapActionString);
         } catch (Exception e) {
             log.error("Error in extracting transport properties from message context", e);
         }
@@ -292,6 +296,80 @@
 
         return null;
 
+    }
+
+    private void sendViaDelete(MessageContext msgContext, URL url)
+            throws AxisFault, IOException {
+
+        DeleteMethod deleteMethod = new DeleteMethod();
+        if (isAuthenticationEnabled(msgContext)) {
+            deleteMethod.setDoAuthentication(true);
+        }
+        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, true);
+            url = new URL(path + replacedQuery);
+        }
+
+        deleteMethod.setPath(url.getPath());
+        String query = url.getQuery();
+        String ignoreUncited = (String) msgContext.getProperty(WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED);
+        // If ignoreUncited property is true we can ignore the uncited parameters in the
url, If it is not specified it
+        // defaults to false hence we append the additional query parameters.
+        if (ignoreUncited != null && JavaUtils.isTrueExplicitly(ignoreUncited)) {
+            deleteMethod.setQueryString(query);
+        } else {
+            deleteMethod.setQueryString(appendQueryParameters(msgContext, url.getQuery()));
+        }
+        // Serialization as "application/x-www-form-urlencoded"
+        String charEncoding =
+                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
+
+        String contentType = null;
+
+        // Default encoding scheme
+        if (charEncoding == null) {
+            contentType = HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
+                            + MessageContext.DEFAULT_CHAR_SET_ENCODING;
+        } else {
+            contentType = HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
+                            + charEncoding;
+        }
+
+        String action = msgContext.getOptions().getAction();
+
+        if (action != null) {
+            contentType = contentType + ";" + "action=" + action;
+        }
+
+        deleteMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,contentType);
+
+        HttpClient httpClient = getHttpClient(msgContext);
+        executeMethod(httpClient, msgContext, url, deleteMethod);
+
+        if (deleteMethod.getStatusCode() == HttpStatus.SC_OK) {
+            processResponse(deleteMethod, msgContext);
+        } else if (deleteMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
+        } else if (deleteMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
+            Header contenttypeHheader =
+                    deleteMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+            String value = contenttypeHheader.getValue();
+
+            if (value != null) {
+                if ((value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0)
+                        || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0))
{
+                    processResponse(deleteMethod, msgContext);
+                }
+            }
+        } else {
+            throw new AxisFault(Messages.getMessage("transportError",
+                    String.valueOf(deleteMethod.getStatusCode()),
+                    deleteMethod.getResponseBodyAsString()));
+        }
     }
 
     private void sendViaGet(MessageContext msgContext, URL url)

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java?view=diff&rev=499743&r1=499742&r2=499743
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
Thu Jan 25 03:15:18 2007
@@ -31,4 +31,8 @@
     public void setContentType(String contentType) {
         response.setContentType(contentType);
     }
+
+    public void addHeader(String headerName, String headerValue) {
+        response.addHeader(headerName, headerValue);
+    }
 }

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=499743&r1=499742&r2=499743
==============================================================================
--- 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
Thu Jan 25 03:15:18 2007
@@ -75,7 +75,7 @@
                     contentType.indexOf(HTTPConstants.MEDIA_TYPE_MULTIPART_RELATED) >
-1  ||
                     contentType.indexOf(HTTPConstants.MEDIA_TYPE_APPLICATION_XML) > -1)
{
                 soapEnvelope = handleNonURLEncodedContentTypes(msgContext, request,
-                        OMAbstractFactory.getSOAP11Factory());
+                        OMAbstractFactory.getSOAP12Factory());
             } 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.
@@ -92,7 +92,7 @@
                 soapEnvelope = SchemaUtil.handleMediaTypeURLEncoded(msgContext,
                         request,
                         xmlSchemaElement,
-                        OMAbstractFactory.getSOAP11Factory());
+                        OMAbstractFactory.getSOAP12Factory());
             } else {
                 throw new AxisFault("Content type should be one of /n " + HTTPConstants.MEDIA_TYPE_TEXT_XML
+
                         "/n " + HTTPConstants.MEDIA_TYPE_X_WWW_FORM +
@@ -154,7 +154,6 @@
 
             // set the required properties so that even if there is an error during the dispatch
             // phase the response message will be passed to the client well. 
-            msgContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD,
org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_GET);
             msgContext.setDoingREST(true);
             msgContext.setProperty(MessageContext.TRANSPORT_OUT, response.getOutputStream());
 
@@ -174,7 +173,7 @@
             SOAPEnvelope soapEnvelope = SchemaUtil.handleMediaTypeURLEncoded(msgContext,
                     request,
                     xmlSchemaElement,
-                    OMAbstractFactory.getSOAP11Factory());
+                    OMAbstractFactory.getSOAP12Factory());
             msgContext.setEnvelope(soapEnvelope);
 
             invokeAxisEngine(msgContext);

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java?view=diff&rev=499743&r1=499742&r2=499743
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/MultipleEntryHashMap.java
Thu Jan 25 03:15:18 2007
@@ -41,6 +41,9 @@
         if (list != null) {
             Object o = list.get(0);
             list.remove(0);
+            if (list.size() == 0) {
+                table.remove(key);
+            }
             return o;
         }
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java?view=diff&rev=499743&r1=499742&r2=499743
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
Thu Jan 25 03:15:18 2007
@@ -17,6 +17,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
@@ -158,10 +159,10 @@
 
             // we handle only GET and POST methods. Do a sanity check here, first.
 
-            String httpMethod = request.getMethod();
-            if (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_POST.equals(httpMethod)
-                    || (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_GET.equals(httpMethod)))
-            {
+//            String httpMethod = request.getMethod();
+//            if (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_POST.equals(httpMethod)
+//                    || (org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD_GET.equals(httpMethod)))
+//            {
                 // Schema should adhere to the IRI style in this. So assume IRI style and
dive in to
                 // schema
                 XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
@@ -194,6 +195,7 @@
                             XmlSchemaElement innerElement = (XmlSchemaElement) iterator.next();
                             QName qName = innerElement.getQName();
                             long minOccurs = innerElement.getMinOccurs();
+                            boolean nillable = innerElement.isNillable();
                             while (minOccurs != 0) {
                                 String name = qName != null ? qName.getLocalPart() : innerElement.getName();
 
@@ -209,24 +211,38 @@
                                 }
 
                                 if (value == null) {
+
+                                    if (nillable) {
+
+                                        OMNamespace xsi = soapFactory.createOMNamespace(Constants.URI_DEFAULT_SCHEMA_XSI,Constants.NS_PREFIX_SCHEMA_XSI);
+                                        OMAttribute omAttribute = soapFactory.createOMAttribute("nil",xsi,"true");
+                                        OMNamespace ns = (qName == null || qName.getNamespaceURI()
== null || qName.getNamespaceURI().length() == 0) ?
+                                        null :
+                                        soapFactory.createOMNamespace(qName.getNamespaceURI(),
null);
+                                        soapFactory.createOMElement(name, ns,
+                                        bodyFirstChild).addAttribute(omAttribute);      
    
+
+                                    } else {
                                     throw new AxisFault("Required element " + qName +
                                             " defined in the schema can not be found in the
request");
-                                }
+                                    }
+                                } else {
 
                                 OMNamespace ns = (qName == null || qName.getNamespaceURI()
== null || qName.getNamespaceURI().length() == 0) ?
                                         null :
                                         soapFactory.createOMNamespace(qName.getNamespaceURI(),
null);
                                 soapFactory.createOMElement(name, ns,
                                         bodyFirstChild).setText(value);
+                                }
 
                                 minOccurs--;
                             }
                         }
                     }
                 }
-            } else {
-                throw new AxisFault("According to WSDL 2.0 rules, we support complex types
only");
-            }
+//            } else {
+//                throw new AxisFault("According to WSDL 2.0 rules, we support complex types
only");
+//            }
 
         }
         return soapEnvelope;



---------------------------------------------------------------------
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