axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r671127 [4/8] - in /webservices/axis2/trunk/java: ./ modules/addressing/ modules/clustering/ modules/clustering/test/org/apache/axis2/clustering/ modules/integration/ modules/integration/test-resources/deployment/ modules/integration/test/o...
Date Tue, 24 Jun 2008 11:07:10 GMT
Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/AxisServlet.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/AxisServlet.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/AxisServlet.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,853 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingHelper;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.deployment.WarBasedAxisConfigurator;
+import org.apache.axis2.description.AxisBindingMessage;
+import org.apache.axis2.description.AxisBindingOperation;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.Handler.InvocationResponse;
+import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.transport.RequestResponseTransport;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.server.HttpUtils;
+import org.apache.axis2.transport.http.util.RESTUtil;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.MessageContextBuilder;
+import org.apache.axis2.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.SocketException;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * Class AxisServlet
+ */
+public class AxisServlet extends HttpServlet implements TransportListener {
+
+    private static final Log log = LogFactory.getLog(AxisServlet.class);
+    public static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
+    public static final String SESSION_ID = "SessionId";
+    protected transient ConfigurationContext configContext;
+    protected transient AxisConfiguration axisConfiguration;
+
+    protected transient ServletConfig servletConfig;
+
+    protected transient ListingAgent agent;
+    protected transient String contextRoot = null;
+
+    protected boolean disableREST = false;
+    private static final String LIST_SERVICES_SUFFIX = "/services/listServices";
+    private static final String LIST_FAULTY_SERVICES_SUFFIX = "/services/ListFaultyServices";
+    private boolean closeReader = true;
+
+    private static final int BUFFER_SIZE = 1024 * 8;
+
+    /**
+     * Implementaion of POST interface
+     *
+     * @param request
+     * @param response
+     * @throws ServletException
+     * @throws IOException
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        //set the initial buffer for a larger value
+        try {
+        response.setBufferSize(BUFFER_SIZE);
+        } catch (Throwable t){
+            log.info("Old Servlet API :" + t);
+        }
+
+        initContextRoot(request);
+
+        MessageContext msgContext;
+        OutputStream out = response.getOutputStream();
+        String contentType = request.getContentType();
+        if (!HTTPTransportUtils.isRESTRequest(contentType)) {
+            msgContext = createMessageContext(request, response);
+            msgContext.setProperty(Constants.Configuration.CONTENT_TYPE, contentType);
+            try {
+                // adding ServletContext into msgContext;
+                String url;
+                try {
+                    url = request.getRequestURL().toString();
+                } catch (Throwable t){
+                    log.info("Old Servlet API (fallback to HttpServletRequest.getRequestURI) :" + t);    
+                    url = request.getRequestURI();
+                }
+                
+                InvocationResponse pi = HTTPTransportUtils.
+                        processHTTPPostRequest(msgContext,
+                                new BufferedInputStream(request.getInputStream()),
+                                new BufferedOutputStream(out),
+                                contentType,
+                                request.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                                url);
+
+                Boolean holdResponse =
+                        (Boolean) msgContext.getProperty(RequestResponseTransport.HOLD_RESPONSE);
+
+                if (pi.equals(InvocationResponse.SUSPEND) ||
+                        (holdResponse != null && Boolean.TRUE.equals(holdResponse))) {
+                    ((RequestResponseTransport) msgContext
+                            .getProperty(RequestResponseTransport.TRANSPORT_CONTROL))
+                            .awaitResponse();
+                }
+                response.setContentType("text/xml; charset="
+                        + msgContext
+                        .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
+                // if data has not been sent back and this is not a signal response
+                if (!TransportUtils.isResponseWritten(msgContext)  
+                		&& (((RequestResponseTransport) 
+                				msgContext.getProperty(
+                						RequestResponseTransport.TRANSPORT_CONTROL)).
+                						getStatus() != RequestResponseTransport.
+                						RequestResponseTransportStatus.SIGNALLED)) {
+                    response.setStatus(HttpServletResponse.SC_ACCEPTED);
+                }
+
+            } catch (AxisFault e) {
+                setResponseState(msgContext, response);
+                log.debug(e);
+                if (msgContext != null) {
+                    processAxisFault(msgContext, response, out, e);
+                } else {
+                    throw new ServletException(e);
+                }
+            } catch (Throwable t) {
+                log.error(t.getMessage(), t);
+                try {
+                    // If the fault is not going along the back channel we should be 202ing
+                    if (AddressingHelper.isFaultRedirected(msgContext)) {
+                        response.setStatus(HttpServletResponse.SC_ACCEPTED);
+                    } else {
+                        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+                        AxisBindingOperation axisBindingOperation =
+                                (AxisBindingOperation) msgContext
+                                        .getProperty(Constants.AXIS_BINDING_OPERATION);
+                        if (axisBindingOperation != null) {
+                            AxisBindingMessage axisBindingMessage = axisBindingOperation.getFault(
+                                    (String) msgContext.getProperty(Constants.FAULT_NAME));
+                            if(axisBindingMessage != null){
+                                Integer code = (Integer) axisBindingMessage
+                                        .getProperty(WSDL2Constants.ATTR_WHTTP_CODE);
+                                if (code != null) {
+                                    response.setStatus(code.intValue());
+                                }
+                            }
+                        }
+                    }
+                    handleFault(msgContext, out, new AxisFault(t.toString(), t));
+                } catch (AxisFault e2) {
+                    log.info(e2);
+                    throw new ServletException(e2);
+                }
+            } finally {
+                closeStaxBuilder(msgContext);
+                TransportUtils.deleteAttachments(msgContext);
+            }
+        } else {
+            if (!disableREST) {
+                new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_POST, request, response)
+                        .processXMLRequest();
+            } else {
+                showRestDisabledErrorMessage(response);
+            }
+        }
+    }
+
+    /**
+     * Implementation for GET interface
+     *
+     * @param request
+     * @param response
+     * @throws ServletException
+     * @throws IOException
+     */
+
+    protected void doGet(HttpServletRequest request,
+                         HttpServletResponse response) throws ServletException, IOException {
+
+        initContextRoot(request);
+
+        // this method is also used to serve for the listServices request.
+
+        String requestURI = request.getRequestURI();
+        String query = request.getQueryString();
+
+        // There can be three different request coming to this.
+        // 1. wsdl, wsdl2 and xsd requests
+        // 2. list services requests
+        // 3. REST requests.
+        if ((query != null) && (query.indexOf("wsdl2") >= 0 ||
+                query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
+                query.indexOf("policy") >= 0)) {
+            // handling meta data exchange stuff
+            agent.initTransportListener(request);
+            agent.processListService(request, response);
+        } else if (requestURI.endsWith(".xsd") ||
+                requestURI.endsWith(".wsdl")) {
+            agent.processExplicitSchemaAndWSDL(request, response);
+        } else if (requestURI.endsWith(LIST_SERVICES_SUFFIX) ||
+                requestURI.endsWith(LIST_FAULTY_SERVICES_SUFFIX)) {
+            // handling list services request
+            try {
+                agent.handle(request, response);
+            } catch (Exception e) {
+                throw new ServletException(e);
+            }
+        } else if (!disableREST) {
+            new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_GET, request, response)
+                    .processURLRequest();
+        } else {
+            showRestDisabledErrorMessage(response);
+        }
+    }
+
+    /**
+     * Implementation of DELETE interface
+     *
+     * @param request
+     * @param response
+     * @throws ServletException
+     * @throws IOException
+     */
+
+    protected void doDelete(HttpServletRequest request,
+                            HttpServletResponse response) throws ServletException, IOException {
+
+        initContextRoot(request);
+        // this method is also used to serve for the listServices request.
+        if (!disableREST) {
+            new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_DELETE, request, response)
+                    .processURLRequest();
+        } else {
+            showRestDisabledErrorMessage(response);
+        }
+    }
+
+    /**
+     * Implementation of PUT interface
+     *
+     * @param request
+     * @param response
+     * @throws ServletException
+     * @throws IOException
+     */
+    protected void doPut(HttpServletRequest request,
+                         HttpServletResponse response) throws ServletException, IOException {
+
+        initContextRoot(request);
+        // this method is also used to serve for the listServices request.
+        if (!disableREST) {
+            new RestRequestProcessor(Constants.Configuration.HTTP_METHOD_PUT, request, response)
+                    .processXMLRequest();
+        } else {
+            showRestDisabledErrorMessage(response);
+        }
+    }
+
+    /**
+     * Private method that deals with disabling of REST support.
+     *
+     * @param response
+     * @throws IOException
+     */
+    protected void showRestDisabledErrorMessage(HttpServletResponse response) throws IOException {
+        PrintWriter writer = new PrintWriter(response.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();
+        response.setStatus(HttpServletResponse.SC_ACCEPTED);
+    }
+
+    /**
+     * Close the builders.
+     *
+     * @param messageContext
+     * @throws ServletException
+     */
+    private void closeStaxBuilder(MessageContext messageContext) throws ServletException {
+        if (closeReader && messageContext != null) {
+            try {
+                SOAPEnvelope envelope = messageContext.getEnvelope();
+                if(envelope != null) {
+                    StAXBuilder builder = (StAXBuilder) envelope.getBuilder();
+                    if (builder != null) {
+                        builder.close();
+                    }
+                }
+            } catch (Exception e) {
+                log.debug(e.toString(), e);
+            }
+        }
+    }
+
+    /**
+     * Processing for faults
+     *
+     * @param msgContext
+     * @param res
+     * @param out
+     * @param e
+     */
+    private void processAxisFault(MessageContext msgContext, HttpServletResponse res,
+                                  OutputStream out, AxisFault e) {
+        try {
+            // If the fault is not going along the back channel we should be 202ing
+            if (AddressingHelper.isFaultRedirected(msgContext)) {
+                res.setStatus(HttpServletResponse.SC_ACCEPTED);
+            } else {
+
+                String status =
+                        (String) msgContext.getProperty(Constants.HTTP_RESPONSE_STATE);
+                if (status == null) {
+                    res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                } else {
+                    res.setStatus(Integer.parseInt(status));
+                }
+
+                AxisBindingOperation axisBindingOperation =
+                        (AxisBindingOperation) msgContext
+                                .getProperty(Constants.AXIS_BINDING_OPERATION);
+                if (axisBindingOperation != null) {
+                    AxisBindingMessage fault = axisBindingOperation
+                            .getFault((String) msgContext.getProperty(Constants.FAULT_NAME));
+                    if (fault != null) {
+                        Integer code = (Integer) fault.getProperty(WSDL2Constants.ATTR_WHTTP_CODE);
+                        if (code != null) {
+                            res.setStatus(code.intValue());
+                        }
+                    }
+                }
+            }
+            handleFault(msgContext, out, e);
+        } catch (AxisFault e2) {
+            log.info(e2);
+        }
+    }
+
+    protected void handleFault(MessageContext msgContext, OutputStream out, AxisFault e)
+            throws AxisFault {
+        msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+
+        MessageContext faultContext =
+                MessageContextBuilder.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) {
+
+            //TODO : Check for SOAP 1.2!
+            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 (SOAP12Constants.FAULT_CODE_SENDER.equals(valueElement.getTextAsQName().getLocalPart())
+                        && !msgContext.isDoingREST()) {
+                    response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+                }
+            }
+        }
+
+
+        AxisEngine.sendFault(faultContext);
+    }
+
+    /**
+     * Main init method
+     *
+     * @param config
+     * @throws ServletException
+     */
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        try {
+            this.servletConfig = config;
+            ServletContext servletContext = servletConfig.getServletContext();
+            this.configContext =
+                    (ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT);
+            if(configContext == null){
+                configContext = initConfigContext(config);
+                config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext);
+            }
+            axisConfiguration = configContext.getAxisConfiguration();
+
+            ListenerManager listenerManager = new ListenerManager();
+            listenerManager.init(configContext);
+            TransportInDescription transportInDescription = new TransportInDescription(
+                    Constants.TRANSPORT_HTTP);
+            transportInDescription.setReceiver(this);
+            listenerManager.addListener(transportInDescription, true);
+            listenerManager.start();
+            ListenerManager.defaultConfigurationContext = configContext;
+            agent = new ListingAgent(configContext);
+
+            initParams();
+
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+    }
+
+    /**
+     * distroy the ConfigurationContext
+     */
+    public void destroy() {
+        //stoping listner manager
+        try {
+            if (configContext != null) {
+                configContext.terminate();
+            }
+        } catch (AxisFault axisFault) {
+            log.info(axisFault.getMessage());
+        }
+        try {
+            super.destroy();
+        } catch (Exception e) {
+            log.info(e.getMessage());
+        }
+    }
+
+    /**
+     * Initializes the Axis2 parameters.
+     */
+    protected void initParams() {
+        Parameter parameter;
+        // do we need to completely disable REST support
+        parameter = axisConfiguration.getParameter(Constants.Configuration.DISABLE_REST);
+        if (parameter != null) {
+            disableREST = !JavaUtils.isFalseExplicitly(parameter.getValue());
+        }
+
+        // Should we close the reader(s)
+        parameter = axisConfiguration.getParameter("axis2.close.reader");
+        if (parameter != null) {
+            closeReader = JavaUtils.isTrueExplicitly(parameter.getValue());
+        }
+
+    }
+
+    /**
+     * Convenient method to re-initialize the ConfigurationContext
+     *
+     * @throws ServletException
+     */
+    public void init() throws ServletException {
+        if (this.servletConfig != null) {
+            init(this.servletConfig);
+        }
+    }
+
+    /**
+     * Initialize the Axis configuration context
+     *
+     * @param config Servlet configuration
+     * @return ConfigurationContext
+     * @throws ServletException
+     */
+    protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException {
+        try {
+            ConfigurationContext configContext =
+                    ConfigurationContextFactory
+                            .createConfigurationContext(new WarBasedAxisConfigurator(config));
+            configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE);
+            return configContext;
+        } catch (Exception e) {
+            log.info(e);
+            throw new ServletException(e);
+        }
+    }
+
+    /**
+     * Set the context root if it is not set already.
+     *
+     * @param req
+     */
+    public void initContextRoot(HttpServletRequest req) {
+        if (contextRoot != null && contextRoot.trim().length() != 0) {
+            return;
+        }
+        String contextPath = null;
+        // Support older servlet API's
+        try {
+            contextPath = req.getContextPath();
+        } catch (Throwable t) {
+            log.info("Old Servlet API (Fallback to HttpServletRequest.getServletPath) :" + t);    
+            contextPath = req.getServletPath();
+        }
+        //handling ROOT scenario, for servlets in the default (root) context, this method returns ""
+        if (contextPath != null && contextPath.length() == 0) {
+            contextPath = "/";
+        }
+        this.contextRoot = contextPath;
+
+        configContext.setContextRoot(contextRoot);
+    }
+
+    /**
+     * Get all transport headers.
+     *
+     * @param req
+     * @return Map
+     */
+    protected Map getTransportHeaders(HttpServletRequest req) {
+        return new TransportHeaders(req);
+    }
+
+
+    public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
+        return getEPRsForService(serviceName, ip)[0];
+    }
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
+        //RUNNING_PORT
+        String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
+        if (port == null) {
+            port = "8080";
+        }
+        if (ip == null) {
+            try {
+                ip = Utils.getIpAddress(axisConfiguration);
+                if (ip == null) {
+                    ip = "localhost";
+                }
+            } catch (SocketException e) {
+                throw AxisFault.makeFault(e);
+            }
+        }
+
+        String endpointRefernce = "http://" + ip + ":" + port;
+        if (configContext.getServiceContextPath().startsWith("/")) {
+            endpointRefernce = endpointRefernce +
+                    configContext.getServiceContextPath() + "/" + serviceName;
+        } else {
+            endpointRefernce = endpointRefernce + '/' +
+                    configContext.getServiceContextPath() + "/" + serviceName;
+        }
+        EndpointReference endpoint = new EndpointReference(endpointRefernce);
+
+        return new EndpointReference[]{endpoint};
+    }
+
+    /**
+     * init(); start() and stop() wouldn't do anything.
+     *
+     * @param axisConf
+     * @param transprtIn
+     * @throws AxisFault
+     */
+    public void init(ConfigurationContext axisConf,
+                     TransportInDescription transprtIn) throws AxisFault {
+    }
+
+    public void start() throws AxisFault {
+    }
+
+    public void stop() throws AxisFault {
+    }
+
+    /**
+     * @param request
+     * @param response
+     * @param invocationType : If invocationType=true; then this will be used in SOAP message
+     *                       invocation. If invocationType=false; then this will be used in REST message invocation.
+     * @return MessageContext
+     * @throws IOException
+     */
+    protected MessageContext createMessageContext(HttpServletRequest request,
+                                                  HttpServletResponse response,
+                                                  boolean invocationType) throws IOException {
+        MessageContext msgContext = configContext.createMessageContext();
+        String requestURI = request.getRequestURI();
+
+        String trsPrefix = null;
+        int sepindex = -1;
+        // Support older servlet API's
+        try { 
+            trsPrefix = request.getRequestURL().toString();
+        } catch (Throwable t){
+            log.info("Old Servlet API (Fallback to HttpServletRequest.getRequestURI) :" + t);    
+            trsPrefix = request.getRequestURI();
+        }
+        sepindex = trsPrefix.indexOf(':');
+        if (sepindex > -1) {
+            trsPrefix = trsPrefix.substring(0, sepindex);
+            msgContext.setIncomingTransportName(trsPrefix);
+        } else {
+            msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP);
+            trsPrefix = Constants.TRANSPORT_HTTP;
+        }
+        TransportInDescription transportIn =
+                axisConfiguration.getTransportIn(msgContext.getIncomingTransportName());
+        //set the default output description. This will be http
+
+        TransportOutDescription transportOut = axisConfiguration.getTransportOut(trsPrefix);
+        if (transportOut == null) {
+            // if the req coming via https but we do not have a https sender
+            transportOut = axisConfiguration.getTransportOut(Constants.TRANSPORT_HTTP);
+        }
+
+
+        msgContext.setTransportIn(transportIn);
+        msgContext.setTransportOut(transportOut);
+        msgContext.setServerSide(true);
+
+        if (!invocationType) {
+            String query = request.getQueryString();
+            if (query != null) {
+                requestURI = requestURI + "?" + query;
+            }
+        }
+
+        msgContext.setTo(new EndpointReference(requestURI));
+        msgContext.setFrom(new EndpointReference(request.getRemoteAddr()));
+        msgContext.setProperty(MessageContext.REMOTE_ADDR, request.getRemoteAddr());
+        msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
+                new ServletBasedOutTransportInfo(response));
+        // set the transport Headers
+        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(request));
+        msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, request);
+        msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, response);
+        try {
+            ServletContext context = getServletContext();
+            if(context != null) {
+                msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context);
+            }
+        } catch (Exception e){
+            log.debug(e.getMessage(), e);
+        }
+
+        //setting the RequestResponseTransport object
+        msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
+                new ServletRequestResponseTransport(response));
+
+        return msgContext;
+    }
+
+    /**
+     * This method assumes, that the created MessageContext will be used in only SOAP invocation.
+     *
+     * @param req
+     * @param resp
+     * @return MessageContext
+     * @throws IOException
+     */
+
+    protected MessageContext createMessageContext(HttpServletRequest req,
+                                                  HttpServletResponse resp) throws IOException {
+        return createMessageContext(req, resp, true);
+    }
+
+    /**
+     * Transport session management.
+     *
+     * @param messageContext
+     * @return SessionContext
+     */
+    public SessionContext getSessionContext(MessageContext messageContext) {
+        HttpServletRequest req = (HttpServletRequest) messageContext.getProperty(
+                HTTPConstants.MC_HTTP_SERVLETREQUEST);
+        SessionContext sessionContext =
+                (SessionContext) req.getSession(true).getAttribute(
+                        Constants.SESSION_CONTEXT_PROPERTY);
+        String sessionId = req.getSession().getId();
+        if (sessionContext == null) {
+            sessionContext = new SessionContext(null);
+            sessionContext.setCookieID(sessionId);
+            req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
+                    sessionContext);
+        }
+        messageContext.setSessionContext(sessionContext);
+        messageContext.setProperty(SESSION_ID, sessionId);
+        return sessionContext;
+    }
+
+    protected class ServletRequestResponseTransport implements RequestResponseTransport {
+        private HttpServletResponse response;
+        private boolean responseWritten = false;
+        private CountDownLatch responseReadySignal = new CountDownLatch(1);
+		// The initial status must be WAITING, as the main servlet will do some other
+		// work after setting this RequestResponseTransport up, and we don't want to miss
+		// signals that come in before this thread gets to the awaitResponse call.
+        private RequestResponseTransportStatus status = RequestResponseTransportStatus.WAITING;
+        AxisFault faultToBeThrownOut = null;
+
+        ServletRequestResponseTransport(HttpServletResponse response) {
+            this.response = response;
+        }
+
+        public void acknowledgeMessage(MessageContext msgContext) throws AxisFault {
+            status = RequestResponseTransportStatus.ACKED;
+            responseReadySignal.countDown();
+        }
+
+        public void awaitResponse()
+                throws InterruptedException, AxisFault {
+            log.debug("Blocking servlet thread -- awaiting response");
+            responseReadySignal.await();
+
+            if (faultToBeThrownOut != null) {
+                throw faultToBeThrownOut;
+            }
+        }
+
+        public void signalResponseReady() {
+            log.debug("Signalling response available");
+            status = RequestResponseTransportStatus.SIGNALLED;
+            responseReadySignal.countDown();
+        }
+
+        public RequestResponseTransportStatus getStatus() {
+            return status;
+        }
+
+        public void signalFaultReady(AxisFault fault) {
+            faultToBeThrownOut = fault;
+            signalResponseReady();
+        }
+        
+        public boolean isResponseWritten() {
+        	return responseWritten;
+        }
+        
+        public void setResponseWritten(boolean responseWritten) {
+        	this.responseWritten = responseWritten;
+        }
+        
+    }
+
+    private void setResponseState(MessageContext messageContext, HttpServletResponse response) {
+        String state = (String) messageContext.getProperty(Constants.HTTP_RESPONSE_STATE);
+        if (state != null) {
+            int stateInt = Integer.parseInt(state);
+            if (stateInt == HttpServletResponse.SC_UNAUTHORIZED) { // Unauthorized
+                String realm = (String) messageContext.getProperty(Constants.HTTP_BASIC_AUTH_REALM);
+                response.addHeader("WWW-Authenticate",
+                        "basic realm=\"" + realm + "\"");
+            }
+        }
+    }
+
+    /**
+     * Ues in processing REST related Requests.
+     * This is the helper Class use in processing of doGet, doPut , doDelete and doPost.
+     */
+    protected class RestRequestProcessor {
+        protected MessageContext messageContext;
+        private HttpServletRequest request;
+        private HttpServletResponse response;
+
+        public RestRequestProcessor(String httpMethodString,
+                                    HttpServletRequest request,
+                                    HttpServletResponse response) throws IOException {
+            this.request = request;
+            this.response = response;
+            messageContext = createMessageContext(this.request, this.response, false);
+            messageContext.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD,
+                    httpMethodString);
+        }
+
+        public void processXMLRequest() throws IOException, ServletException {
+            try {
+                RESTUtil.processXMLRequest(messageContext, request.getInputStream(),
+                        response.getOutputStream(), request.getContentType());
+                this.checkResponseWritten();
+            } catch (AxisFault axisFault) {
+                processFault(axisFault);
+            }
+            closeStaxBuilder(messageContext);
+        }
+
+        public void processURLRequest() throws IOException, ServletException {
+            try {
+                RESTUtil.processURLRequest(messageContext, response.getOutputStream(),
+                        request.getContentType());
+                this.checkResponseWritten();
+            } catch (AxisFault e) {
+                setResponseState(messageContext, response);
+                processFault(e);
+            }
+            closeStaxBuilder(messageContext);
+
+        }
+
+        private void checkResponseWritten() {
+        	if (!TransportUtils.isResponseWritten(messageContext)) {
+        		response.setStatus(HttpServletResponse.SC_ACCEPTED);
+            }
+        }
+
+        private void processFault(AxisFault e) throws ServletException, IOException {
+            log.debug(e);
+            if (messageContext != null) {
+                processAxisFault(messageContext, response, response.getOutputStream(), e);
+            } else {
+                throw new ServletException(e);
+            }
+
+        }
+
+    }
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,413 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.TransportSender;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.server.AxisHttpResponseImpl;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.stream.FactoryConfigurationError;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.GZIPOutputStream;
+
+public class CommonsHTTPTransportSender extends AbstractHandler implements
+        TransportSender {
+
+    protected static final String PROXY_HOST_NAME = "proxy_host";
+
+    protected static final String PROXY_PORT = "proxy_port";
+
+    int soTimeout = HTTPConstants.DEFAULT_SO_TIMEOUT;
+
+    /**
+     * proxydiscription
+     */
+    protected TransportOutDescription proxyOutSetting = null;
+
+    private static final Log log = LogFactory
+            .getLog(CommonsHTTPTransportSender.class);
+
+    protected String httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+
+    private boolean chunked = false;
+
+    int connectionTimeout = HTTPConstants.DEFAULT_CONNECTION_TIMEOUT;
+
+    public void cleanup(MessageContext msgContext) throws AxisFault {
+        HttpMethod httpMethod = (HttpMethod) msgContext
+                .getProperty(HTTPConstants.HTTP_METHOD);
+
+        if (httpMethod != null) {
+            httpMethod.releaseConnection();
+        }
+    }
+
+    public void init(ConfigurationContext confContext,
+                     TransportOutDescription transportOut) throws AxisFault {
+
+        // <parameter name="PROTOCOL">HTTP/1.0</parameter> or
+        // <parameter name="PROTOCOL">HTTP/1.1</parameter> is
+        // checked
+        Parameter version = transportOut
+                .getParameter(HTTPConstants.PROTOCOL_VERSION);
+        if (version != null) {
+            if (HTTPConstants.HEADER_PROTOCOL_11.equals(version.getValue())) {
+                httpVersion = HTTPConstants.HEADER_PROTOCOL_11;
+
+                Parameter transferEncoding = transportOut
+                        .getParameter(HTTPConstants.HEADER_TRANSFER_ENCODING);
+
+                if ((transferEncoding != null)
+                        && HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED
+                        .equals(transferEncoding.getValue())) {
+                    chunked = true;
+                }
+            } else if (HTTPConstants.HEADER_PROTOCOL_10.equals(version
+                    .getValue())) {
+                httpVersion = HTTPConstants.HEADER_PROTOCOL_10;
+            } else {
+                throw new AxisFault("Parameter "
+                        + HTTPConstants.PROTOCOL_VERSION
+                        + " Can have values only HTTP/1.0 or HTTP/1.1");
+            }
+        }
+
+        // Get the timeout values from the configuration
+        try {
+            Parameter tempSoTimeoutParam = transportOut
+                    .getParameter(HTTPConstants.SO_TIMEOUT);
+            Parameter tempConnTimeoutParam = transportOut
+                    .getParameter(HTTPConstants.CONNECTION_TIMEOUT);
+
+            if (tempSoTimeoutParam != null) {
+                soTimeout = Integer.parseInt((String) tempSoTimeoutParam
+                        .getValue());
+            }
+
+            if (tempConnTimeoutParam != null) {
+                connectionTimeout = Integer
+                        .parseInt((String) tempConnTimeoutParam.getValue());
+            }
+        } catch (NumberFormatException nfe) {
+
+            // If there's a problem log it and use the default values
+            log.error("Invalid timeout value format: not a number", nfe);
+        }
+    }
+
+    public void stop() {
+        // Any code that , need to invoke when sender stop
+    }
+
+    public InvocationResponse invoke(MessageContext msgContext)
+            throws AxisFault {
+        try {
+            OMOutputFormat format = new OMOutputFormat();
+            // if (!msgContext.isDoingMTOM())
+            msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
+            msgContext.setDoingSwA(HTTPTransportUtils.doWriteSwA(msgContext));
+            msgContext.setDoingREST(HTTPTransportUtils.isDoingREST(msgContext));
+            format.setSOAP11(msgContext.isSOAP11());
+            format.setDoOptimize(msgContext.isDoingMTOM());
+            format.setDoingSWA(msgContext.isDoingSwA());
+            format.setCharSetEncoding(HTTPTransportUtils
+                    .getCharSetEncoding(msgContext));
+
+            Object mimeBoundaryProperty = msgContext
+                    .getProperty(Constants.Configuration.MIME_BOUNDARY);
+            if (mimeBoundaryProperty != null) {
+                format.setMimeBoundary((String) mimeBoundaryProperty);
+            }
+
+            TransportOutDescription transportOut = msgContext.getConfigurationContext().
+                    getAxisConfiguration().getTransportOut(Constants.TRANSPORT_HTTP);
+
+            //if a parameter has set been set, we will omit the SOAP action for SOAP 1.2
+            if (transportOut != null) {
+                if (!msgContext.isSOAP11()) {
+                    Parameter param = transportOut.getParameter(HTTPConstants.OMIT_SOAP_12_ACTION);
+                    Object parameterValue = null;
+                    if (param != null) {
+                        parameterValue = param.getValue();
+                    }
+
+                    if (parameterValue != null && JavaUtils.isTrueExplicitly(parameterValue)) {
+                        //Check whether user has already overridden this.
+                        Object propertyValue = msgContext.getProperty(Constants.Configuration.DISABLE_SOAP_ACTION);
+                        if (propertyValue == null || !JavaUtils.isFalseExplicitly(propertyValue)) {
+                            msgContext.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,
+                                    Boolean.TRUE);
+                        }
+                    }
+                }
+            }
+
+            // Transport URL can be different from the WSA-To. So processing
+            // that now.
+            EndpointReference epr = null;
+            String transportURL = (String) msgContext
+                    .getProperty(Constants.Configuration.TRANSPORT_URL);
+
+            if (transportURL != null) {
+                epr = new EndpointReference(transportURL);
+            } else if (msgContext.getTo() != null
+                    && !msgContext.getTo().hasAnonymousAddress()) {
+                epr = msgContext.getTo();
+            }
+
+            // Check for the REST behavior, if you desire rest behavior
+            // put a <parameter name="doREST" value="true"/> at the
+            // server.xml/client.xml file
+            // ######################################################
+            // Change this place to change the wsa:toepr
+            // epr = something
+            // ######################################################
+
+            if (epr != null) {
+                if (!epr.hasNoneAddress()) {
+                    writeMessageWithCommons(msgContext, epr, format);
+                    TransportUtils.setResponseWritten(msgContext, true);
+                }
+            } else {
+                if (msgContext.getProperty(MessageContext.TRANSPORT_OUT) != null) {
+                    sendUsingOutputStream(msgContext, format);
+                    TransportUtils.setResponseWritten(msgContext, true);
+                } else {
+                    throw new AxisFault("Both the TO and MessageContext.TRANSPORT_OUT property " +
+                            "are null, so nowhere to send");
+                }
+            }
+        } catch (FactoryConfigurationError e) {
+            log.debug(e);
+            throw AxisFault.makeFault(e);
+        } catch (IOException e) {
+            log.debug(e);
+            throw AxisFault.makeFault(e);
+        }
+        return InvocationResponse.CONTINUE;
+    }
+
+    /**
+     * Send a message (which must be a response) via the OutputStream sitting in the
+     * MessageContext TRANSPORT_OUT property.  Since this class is used for both requests and
+     * responses, we split the logic - this method always gets called when we're
+     * writing to the HTTP response stream, and sendUsingCommons() is used for requests.
+     *
+     * @param msgContext the active MessageContext
+     * @param format output formatter for our message
+     * @throws AxisFault if a general problem arises
+     */
+    private void sendUsingOutputStream(MessageContext msgContext,
+                                       OMOutputFormat format) throws AxisFault {
+        OutputStream out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT);
+
+        // I Don't think we need this check.. Content type needs to be set in
+        // any case. (thilina)
+        // if (msgContext.isServerSide()) {
+        OutTransportInfo transportInfo = (OutTransportInfo) msgContext
+                .getProperty(Constants.OUT_TRANSPORT_INFO);
+
+        if (transportInfo == null) throw new AxisFault("No transport info in MessageContext");
+
+        ServletBasedOutTransportInfo servletBasedOutTransportInfo = null;
+        if (transportInfo instanceof ServletBasedOutTransportInfo) {
+            servletBasedOutTransportInfo =
+                    (ServletBasedOutTransportInfo) transportInfo;
+            Object customHeaders = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+            if (customHeaders != null) {
+                if (customHeaders instanceof List) {
+                    Iterator iter = ((List) customHeaders).iterator();
+                    while (iter.hasNext()) {
+                        Header header = (Header) iter.next();
+                        if (header != null) {
+                            servletBasedOutTransportInfo
+                                    .addHeader(header.getName(), header.getValue());
+                        }
+                    }
+                } else if (customHeaders instanceof Map) {
+                    Iterator iter = ((Map) customHeaders).entrySet().iterator();
+                    while (iter.hasNext()) {
+                        Map.Entry header = (Map.Entry) iter.next();
+                        if (header != null) {
+                            servletBasedOutTransportInfo
+                                    .addHeader((String) header.getKey(), (String) header.getValue());
+                        }
+                    }
+                }
+            }
+        } else if (transportInfo instanceof AxisHttpResponseImpl) {
+            Object customHeaders = msgContext.getProperty(HTTPConstants.HTTP_HEADERS);
+            if (customHeaders != null) {
+                if (customHeaders instanceof List) {
+                    Iterator iter = ((List) customHeaders).iterator();
+                    while (iter.hasNext()) {
+                        Header header = (Header) iter.next();
+                        if (header != null) {
+                            ((AxisHttpResponseImpl) transportInfo)
+                                    .addHeader(header.getName(), header.getValue());
+                        }
+                    }
+                } else if (customHeaders instanceof Map) {
+                    Iterator iter = ((Map) customHeaders).entrySet().iterator();
+                    while (iter.hasNext()) {
+                        Map.Entry header = (Map.Entry) iter.next();
+                        if (header != null) {
+                            ((AxisHttpResponseImpl) transportInfo)
+                                    .addHeader((String) header.getKey(), (String) header.getValue());
+                        }
+                    }
+                }
+            }
+        }
+
+        format.setAutoCloseWriter(true);
+
+        MessageFormatter messageFormatter = TransportUtils.getMessageFormatter(msgContext);
+        if (messageFormatter == null) throw new AxisFault("No MessageFormatter in MessageContext");
+
+        // Once we get to this point, exceptions should NOT be turned into faults and sent,
+        // because we're already sending!  So catch everything and log it, but don't pass
+        // upwards.
+
+        try {
+            transportInfo.setContentType(
+                messageFormatter.getContentType(msgContext, format, findSOAPAction(msgContext)));
+
+            Object gzip = msgContext.getOptions().getProperty(HTTPConstants.MC_GZIP_RESPONSE);
+            if (gzip != null && JavaUtils.isTrueExplicitly(gzip)) {
+                if (servletBasedOutTransportInfo != null)
+                    servletBasedOutTransportInfo.addHeader(HTTPConstants.HEADER_CONTENT_ENCODING,
+                                                           HTTPConstants.COMPRESSION_GZIP);
+                try {
+                    out = new GZIPOutputStream(out);
+                    out.write(messageFormatter.getBytes(msgContext, format));
+                    ((GZIPOutputStream) out).finish();
+                    out.flush();
+                } catch (IOException e) {
+                    throw new AxisFault("Could not compress response");
+                }
+            } else {
+                messageFormatter.writeTo(msgContext, format, out, false);
+            }
+        } catch (AxisFault axisFault) {
+            log.error(axisFault.getMessage(), axisFault);
+            throw axisFault;
+        }
+    }
+
+    private void writeMessageWithCommons(MessageContext messageContext,
+                                         EndpointReference toEPR, OMOutputFormat format)
+            throws AxisFault {
+        try {
+            URL url = new URL(toEPR.getAddress());
+
+            // select the Message Sender depending on the REST status
+            AbstractHTTPSender sender;
+
+            sender = new HTTPSender();
+
+            if (messageContext.getProperty(HTTPConstants.CHUNKED) != null) {
+                chunked = JavaUtils.isTrueExplicitly(messageContext
+                        .getProperty(HTTPConstants.CHUNKED));
+            }
+
+            if (messageContext.getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION) != null) {
+                httpVersion = (String) messageContext
+                        .getProperty(HTTPConstants.HTTP_PROTOCOL_VERSION);
+            }
+            // Following order needed to be preserved because,
+            // HTTP/1.0 does not support chunk encoding
+            sender.setChunked(chunked);
+            sender.setHttpVersion(httpVersion);
+            sender.setFormat(format);
+
+            sender.send(messageContext, url, findSOAPAction(messageContext));
+        } catch (MalformedURLException e) {
+            log.debug(e);
+            throw AxisFault.makeFault(e);
+        } catch (HttpException e) {
+            log.debug(e);
+            throw AxisFault.makeFault(e);
+        } catch (IOException e) {
+            log.debug(e);
+            throw AxisFault.makeFault(e);
+        }
+    }
+
+    private static String findSOAPAction(MessageContext messageContext) {
+        String soapActionString = null;
+
+        Parameter parameter =
+                messageContext.getTransportOut().getParameter(HTTPConstants.OMIT_SOAP_12_ACTION);
+        if (parameter != null && JavaUtils.isTrueExplicitly(parameter.getValue()) &&
+            !messageContext.isSOAP11()) {
+            return "\"\"";
+        }
+
+        Object disableSoapAction = messageContext.getOptions().getProperty(
+                Constants.Configuration.DISABLE_SOAP_ACTION);
+
+        if (!JavaUtils.isTrueExplicitly(disableSoapAction)) {
+            // first try to get the SOAP action from message context
+            soapActionString = messageContext.getSoapAction();
+            if ((soapActionString == null) || (soapActionString.length() == 0)) {
+                // now let's try to get WSA action
+                soapActionString = messageContext.getWSAAction();
+                if (messageContext.getAxisOperation() != null
+                        && ((soapActionString == null) || (soapActionString
+                        .length() == 0))) {
+                    // last option is to get it from the axis operation
+                    soapActionString = messageContext.getAxisOperation()
+                            .getSoapAction();
+                }
+            }
+        }
+
+        //Since action is optional for SOAP 1.2 we can return null here.
+        if (soapActionString == null && messageContext.isSOAP11()) {
+            soapActionString = "\"\"";
+        }
+
+        return soapActionString;
+    }
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CommonsTransportHeaders.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import org.apache.commons.httpclient.Header;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+public class CommonsTransportHeaders implements Map {
+    private Header[] headers;
+
+    HashMap headerMap = null;
+
+    public CommonsTransportHeaders(Header[] headers) {
+        this.headers = headers;
+    }
+
+    private void init() {
+        headerMap = new HashMap();
+
+        for (int i = 0; i < headers.length; i++) {
+            headerMap.put(headers[i].getName(), headers[i].getValue());
+        }
+    }
+
+    public int size() {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.size();
+    }
+
+    public void clear() {
+        if (headerMap != null) {
+            headerMap.clear();
+        }
+    }
+
+    public boolean isEmpty() {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.isEmpty();
+    }
+
+    public boolean containsKey(Object key) {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.containsKey(key);
+    }
+
+    public boolean containsValue(Object value) {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.containsValue(value);
+    }
+
+    public Collection values() {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.values();
+    }
+
+    public void putAll(Map t) {
+        if (headerMap == null) {
+            init();
+        }
+        headerMap.putAll(t);
+    }
+
+    public Set entrySet() {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.entrySet();
+    }
+
+    public Set keySet() {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.keySet();
+    }
+
+    public Object get(Object key) {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.get(key);
+    }
+
+    public Object remove(Object key) {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.remove(key);
+    }
+
+    public Object put(Object key, Object value) {
+        if (headerMap == null) {
+            init();
+        }
+        return headerMap.put(key, value);
+    }
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CustomListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CustomListener.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CustomListener.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/CustomListener.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * This class is used just to add additional transports at runtime if user sends a request using
+ * alternate schemes, example to handle http/https separately
+ */
+public class CustomListener implements TransportListener {
+
+    private static final Log log = LogFactory.getLog(CustomListener.class);
+    
+    private int port;
+    private String schema;
+    private ConfigurationContext axisConf;
+
+    public CustomListener(int port, String schema) {
+        this.port = port;
+        this.schema = schema;
+    }
+
+    public void init(ConfigurationContext axisConf,
+                     TransportInDescription transprtIn) throws AxisFault {
+        this.axisConf = axisConf;
+        Parameter param = transprtIn.getParameter(PARAM_PORT);
+        if (param != null) {
+            this.port = Integer.parseInt((String) param.getValue());
+        }
+    }
+
+    public void start() throws AxisFault {
+    }
+
+    public void stop() throws AxisFault {
+    }
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip)
+            throws AxisFault {
+        String path = axisConf.getServiceContextPath() + "/" + serviceName;
+        if(path.charAt(0)!='/'){
+            path = '/' + path;
+        }
+        return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":" + port + path )};
+    }
+
+    public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
+        return getEPRsForService(serviceName, ip)[0];
+    }
+
+    public SessionContext getSessionContext(MessageContext messageContext) {
+        HttpServletRequest req = (HttpServletRequest) messageContext.getProperty(
+                HTTPConstants.MC_HTTP_SERVLETREQUEST);
+        SessionContext sessionContext =
+                (SessionContext) req.getSession(true).getAttribute(
+                        Constants.SESSION_CONTEXT_PROPERTY);
+        String sessionId = null;
+        try {
+            sessionId = req.getSession().getId();
+            if (sessionContext == null) {
+            sessionContext = new SessionContext(null);
+            sessionContext.setCookieID(sessionId);
+            req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
+                                          sessionContext);
+        }
+        } catch (Throwable t){
+            log.info("Old Servlet API :" + t);
+            return null;
+        }
+        messageContext.setSessionContext(sessionContext);
+        messageContext.setProperty(AxisServlet.SESSION_ID, sessionId);
+        return sessionContext;
+    }
+
+    public void destroy() {
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPSender.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPSender.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPSender.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,301 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+import java.net.URL;
+
+public class HTTPSender extends AbstractHTTPSender {
+
+    private static final Log log = LogFactory.getLog(HTTPSender.class);
+
+    public void send(MessageContext msgContext, URL url, String soapActionString)
+            throws IOException {
+
+        // execute the HtttpMethodBase - a connection manager can be given for
+        // handle multiple
+
+        String httpMethod =
+                (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
+
+        if ((httpMethod != null)) {
+
+            if (Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
+                this.sendViaGet(msgContext, url, soapActionString);
+
+                return;
+            } else if (Constants.Configuration.HTTP_METHOD_DELETE.equalsIgnoreCase(httpMethod)) {
+                this.sendViaDelete(msgContext, url, soapActionString);
+
+                return;
+            } else if (Constants.Configuration.HTTP_METHOD_PUT.equalsIgnoreCase(httpMethod)) {
+                this.sendViaPut(msgContext, url, soapActionString);
+
+                return;
+            }
+        }
+
+        this.sendViaPost(msgContext, url, soapActionString);
+    }
+
+    /**
+     * Used to send a request via HTTP Get method
+     *
+     * @param msgContext        - The MessageContext of the message
+     * @param url               - The target URL
+     * @param soapActiionString - The soapAction string of the request
+     * @throws AxisFault - Thrown in case an exception occurs
+     */
+    private void sendViaGet(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault {
+
+        GetMethod getMethod = new GetMethod();
+        HttpClient httpClient = getHttpClient(msgContext);
+        MessageFormatter messageFormatter =
+                populateCommonProperties(msgContext, url, getMethod, httpClient, soapActiionString);
+
+        // Need to have this here because we can have soap action when using the soap response MEP
+        String soapAction =
+                messageFormatter.formatSOAPAction(msgContext, format, soapActiionString);
+
+        if (soapAction != null) {
+            getMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+        try {
+            executeMethod(httpClient, msgContext, url, getMethod);
+            handleResponse(msgContext, getMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaGet to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, getMethod);
+        }
+    }
+
+    private void cleanup(MessageContext msgContext, HttpMethod method) {
+        if (msgContext.isPropertyTrue(HTTPConstants.AUTO_RELEASE_CONNECTION)) {
+            method.releaseConnection();
+        }
+    }
+
+    /**
+     * Used to send a request via HTTP Delete Method
+     *
+     * @param msgContext        - The MessageContext of the message
+     * @param url               - The target URL
+     * @param soapActiionString - The soapAction string of the request
+     * @throws AxisFault - Thrown in case an exception occurs
+     */
+    private void sendViaDelete(MessageContext msgContext, URL url, String soapActiionString)
+            throws AxisFault {
+
+        DeleteMethod deleteMethod = new DeleteMethod();
+        HttpClient httpClient = getHttpClient(msgContext);
+        populateCommonProperties(msgContext, url, deleteMethod, httpClient, soapActiionString);
+
+        try {
+            executeMethod(httpClient, msgContext, url, deleteMethod);
+            handleResponse(msgContext, deleteMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaDelete to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, deleteMethod);
+        }
+    }
+
+    /**
+     * Used to send a request via HTTP Post Method
+     *
+     * @param msgContext       - The MessageContext of the message
+     * @param url              - The target URL
+     * @param soapActionString - The soapAction string of the request
+     * @throws AxisFault - Thrown in case an exception occurs
+     */
+    private void sendViaPost(MessageContext msgContext, URL url,
+                             String soapActionString) throws AxisFault {
+
+
+        HttpClient httpClient = getHttpClient(msgContext);
+
+/*  What's up with this, it never gets used anywhere?? --Glen
+        String charEncoding =
+                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
+
+        if (charEncoding == null) {
+            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+        }
+*/
+
+        PostMethod postMethod = new PostMethod();
+        MessageFormatter messageFormatter =
+                populateCommonProperties(msgContext, url, postMethod, httpClient, soapActionString);
+
+        postMethod.setRequestEntity(new AxisRequestEntity(messageFormatter,
+                                                          msgContext, format, soapActionString,
+                                                          chunked, isAllowedRetry));
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
+            postMethod.setContentChunked(true);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
+
+        if (soapAction != null) {
+            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         *   main excecution takes place..
+         */
+        try {
+            executeMethod(httpClient, msgContext, url, postMethod);
+            handleResponse(msgContext, postMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPost to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, postMethod);
+        }
+    }
+
+    /**
+     * Used to send a request via HTTP Put Method
+     *
+     * @param msgContext       - The MessageContext of the message
+     * @param url              - The target URL
+     * @param soapActionString - The soapAction string of the request
+     * @throws AxisFault - Thrown in case an exception occurs
+     */
+    private void sendViaPut(MessageContext msgContext, URL url,
+                            String soapActionString) throws AxisFault {
+
+
+        HttpClient httpClient = getHttpClient(msgContext);
+
+/*  Same deal - this value never gets used, why is it here? --Glen
+        String charEncoding =
+                (String) msgContext.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
+
+        if (charEncoding == null) {
+            charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
+        }
+*/
+
+        PutMethod putMethod = new PutMethod();
+        MessageFormatter messageFormatter =
+                populateCommonProperties(msgContext, url, putMethod, httpClient, soapActionString);
+
+        putMethod.setRequestEntity(new AxisRequestEntity(messageFormatter,
+                                                         msgContext, format, soapActionString,
+                                                         chunked, isAllowedRetry));
+
+        if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) {
+            putMethod.setContentChunked(true);
+        }
+
+        String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString);
+        if (soapAction != null) {
+            putMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction);
+        }
+
+        /*
+         *   main excecution takes place..
+         */
+        try {
+            executeMethod(httpClient, msgContext, url, putMethod);
+            handleResponse(msgContext, putMethod);
+        } catch (IOException e) {
+            log.info("Unable to sendViaPut to url[" + url + "]", e);
+            throw AxisFault.makeFault(e);
+        } finally {
+            cleanup(msgContext, putMethod);
+        }
+    }
+
+    /**
+     * Used to handle the HTTP Response
+     *
+     * @param msgContext - The MessageContext of the message
+     * @param method     - The HTTP method used
+     * @throws IOException - Thrown in case an exception occurs
+     */
+    private void handleResponse(MessageContext msgContext,
+                                HttpMethodBase method) throws IOException {
+
+        int statusCode = method.getStatusCode();
+        if (statusCode == HttpStatus.SC_OK) {
+            processResponse(method, msgContext);
+        } else if (statusCode == HttpStatus.SC_ACCEPTED) {
+        } else if (statusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR ||
+                statusCode == HttpStatus.SC_BAD_REQUEST) {
+            Header contenttypeHeader =
+                    method.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+            String value = null;
+            if (contenttypeHeader != null) {
+                value = contenttypeHeader.getValue();
+            }
+             OperationContext opContext = msgContext.getOperationContext();
+            if(opContext!=null){
+                MessageContext inMessageContext =
+                        opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                if(inMessageContext!=null){
+                    inMessageContext.setProcessingFault(true);
+                }
+            }
+            if (value != null) {
+
+                processResponse(method, msgContext);
+            }
+            Object isTransportNonBlocking = msgContext.getProperty(
+                    MessageContext.TRANSPORT_NON_BLOCKING);
+            if (isTransportNonBlocking != null &&
+                    ((Boolean) isTransportNonBlocking).booleanValue()) {
+                throw new AxisFault(Messages.getMessage("transportError",
+                        String.valueOf(statusCode),
+                        method.getStatusText()));
+            }
+        } else {
+            throw new AxisFault(Messages.getMessage("transportError",
+                                                    String.valueOf(statusCode),
+                                                    method.getStatusText()));
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java?rev=671127&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/transports/src/org/apache/axis2/transport/http/HTTPTransportReceiver.java Tue Jun 24 04:07:03 2008
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Class HTTPTransportReceiver
+ */
+public class HTTPTransportReceiver {
+    public static Map getGetRequestParameters(String requestURI) {
+
+        Map map = new HashMap();
+        if (requestURI == null || "".equals(requestURI)) {
+            return map;
+        }
+        char[]       chars = requestURI.toCharArray();
+        final int NOT_BEGUN = 1500;
+        final int INSIDE_NAME = 1501;
+        final int INSIDE_VALUE = 1502;
+        int state = NOT_BEGUN;
+        StringBuffer name = new StringBuffer();
+        StringBuffer value = new StringBuffer();
+
+        for (int index = 0; index < chars.length; index++) {
+            if (state == NOT_BEGUN) {
+                if (chars[index] == '?') {
+                    state = INSIDE_NAME;
+                }
+            } else if (state == INSIDE_NAME) {
+                if (chars[index] == '=') {
+                    state = INSIDE_VALUE;
+                } else {
+                    name.append(chars[index]);
+                }
+            } else if (state == INSIDE_VALUE) {
+                if (chars[index] == ',') {
+                    state = INSIDE_NAME;
+                    map.put(name.toString(), value.toString());
+                    name.delete(0, name.length());
+                    value.delete(0, value.length());
+                } else {
+                    value.append(chars[index]);
+                }
+            }
+        }
+
+        if (name.length() + value.length() > 0) {
+            map.put(name.toString(), value.toString());
+        }
+
+        return map;
+    }
+
+    /**
+     * Returns the HTML text for the list of services deployed.
+     * This can be delegated to another Class as well
+     * where it will handle more options of GET messages.
+     *
+     * @return Returns String.
+     */
+    public static String getServicesHTML(ConfigurationContext configurationContext) {
+        String temp = "";
+        Map services = configurationContext.getAxisConfiguration().getServices();
+        Hashtable erroneousServices =
+                configurationContext.getAxisConfiguration().getFaultyServices();
+        boolean status = false;
+
+        if ((services != null) && !services.isEmpty()) {
+            status = true;
+
+            Collection serviceCollection = services.values();
+
+            temp += "<h2>" + "Deployed services" + "</h2>";
+
+            for (Iterator it = serviceCollection.iterator(); it.hasNext();) {
+
+                AxisService axisService = (AxisService) it.next();
+
+                Iterator iterator = axisService.getOperations();
+
+                temp += "<h3><a href=\"" + axisService.getName() + "?wsdl\">" +
+                        axisService.getName() + "</a></h3>";
+
+                if (iterator.hasNext()) {
+                    temp += "Available operations <ul>";
+
+                    for (; iterator.hasNext();) {
+                        AxisOperation axisOperation = (AxisOperation) iterator.next();
+
+                        temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
+                    }
+
+                    temp += "</ul>";
+                } else {
+                    temp += "No operations specified for this service";
+                }
+            }
+        }
+
+        if ((erroneousServices != null) && !erroneousServices.isEmpty()) {
+            temp += "<hr><h2><font color=\"blue\">Faulty Services</font></h2>";
+            status = true;
+
+            Enumeration faultyservices = erroneousServices.keys();
+
+            while (faultyservices.hasMoreElements()) {
+                String faultyserviceName = (String) faultyservices.nextElement();
+
+                temp += "<h3><font color=\"blue\">" + faultyserviceName + "</font></h3>";
+            }
+        }
+
+        if (!status) {
+            temp = "<h2>There are no services deployed</h2>";
+        }
+
+        temp = "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
+                + "</body></html>";
+
+        return temp;
+    }
+
+    public static String printServiceHTML(String serviceName,
+                                          ConfigurationContext configurationContext) {
+        String temp = "";
+        try {
+            AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
+            AxisService axisService = axisConfig.getService(serviceName);
+            Iterator iterator = axisService.getOperations();
+            temp += "<h3>" + axisService.getName() + "</h3>";
+            temp += "<a href=\"" + axisService.getName() + "?wsdl\">wsdl</a> <br/> ";
+            temp += "<i>Service Description :  " + axisService.getServiceDescription() +
+                    "</i><br/><br/>";
+            if (iterator.hasNext()) {
+                temp += "Available operations <ul>";
+                for (; iterator.hasNext();) {
+                    AxisOperation axisOperation = (AxisOperation) iterator.next();
+                    temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
+                }
+                temp += "</ul>";
+            } else {
+                temp += "No operations specified for this service";
+            }
+            temp = "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
+                    + "</body></html>";
+        }
+        catch (AxisFault axisFault) {
+            temp = "<html><head><title>Service has a fualt</title></head>" + "<body>"
+                    + "<hr><h2><font color=\"blue\">" + axisFault.getMessage() +
+                    "</font></h2></body></html>";
+        }
+        return temp;
+    }
+}



Mime
View raw message