You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/02/18 16:44:14 UTC
svn commit: r154317 - in webservices/axis/trunk/java/modules/core/src:
html/HappyAxis.jsp html/listServices.jsp html/listSingleService.jsp
html/upload.jsp java/org/apache/axis/Constants.java
java/org/apache/axis/transport/http/AxisServlet.java
Author: ajith
Date: Fri Feb 18 07:44:12 2005
New Revision: 154317
URL: http://svn.apache.org/viewcvs?view=rev&rev=154317
Log:
Modified the webapp slightly to list a single service
Added:
webservices/axis/trunk/java/modules/core/src/html/listServices.jsp
webservices/axis/trunk/java/modules/core/src/html/listSingleService.jsp
Modified:
webservices/axis/trunk/java/modules/core/src/html/HappyAxis.jsp
webservices/axis/trunk/java/modules/core/src/html/upload.jsp
webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/Constants.java
webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java
Modified: webservices/axis/trunk/java/modules/core/src/html/HappyAxis.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/html/HappyAxis.jsp?view=diff&r1=154316&r2=154317
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/html/HappyAxis.jsp (original)
+++ webservices/axis/trunk/java/modules/core/src/html/HappyAxis.jsp Fri Feb 18 07:44:12 2005
@@ -34,8 +34,10 @@
%>
<head>
<title>Axis2 Happiness Page</title>
+ <link href="css/axis-style.css" rel="stylesheet" type="text/css">
</head>
-<body bgcolor='#ffffff'>
+<body>
+ <jsp:include page="include/header.inc"></jsp:include>
<%port =request.getServerPort();%>
<%!
/*
@@ -488,23 +490,10 @@
}
%>
<h2>Examining Application Server</h2>
- <%
- String servletVersion=getServletVersion();
- String xmlParser=getParserName();
- String xmlParserLocation = getParserLocation(out);
-
- %>
- <table>
- <tr><td>Servlet version</td><td><%= servletVersion %></td></tr>
- <tr><td>XML Parser</td><td><%= xmlParser %></td></tr>
- <tr><td>XML ParserLocation</td><td><%= xmlParserLocation %></td></tr>
+ <table>
+ <tr><td>Servlet version</td><td><%=getServletVersion()%></td></tr>
+ <tr><td>Platform</td><td><%=getServletConfig().getServletContext().getServerInfo()%></td></tr>
</table>
-<% if(xmlParser.indexOf("crimson")>=0) { %>
- <p>
- <b>We recommend <a href="http://xml.apache.org/xerces2-j/">Xerces 2</a>
- over Crimson as the XML parser for Axis</b>
- </p>
-<% } %>
<h2>Examining System Properties</h2>
<%
@@ -527,8 +516,9 @@
out.write("System properties are not accessible<p>");
}
%>
- <hr>
- Platform: <%= getServletConfig().getServletContext().getServerInfo() %>
+
+ <jsp:include page="include/link-footer.inc"></jsp:include>
+ <jsp:include page="include/footer.inc"></jsp:include>
</body>
</html>
Added: webservices/axis/trunk/java/modules/core/src/html/listServices.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/html/listServices.jsp?view=auto&rev=154317
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/html/listServices.jsp (added)
+++ webservices/axis/trunk/java/modules/core/src/html/listServices.jsp Fri Feb 18 07:44:12 2005
@@ -0,0 +1,67 @@
+<%@ page import="java.util.Collection,
+ java.util.HashMap,
+ java.util.Iterator,
+ org.apache.axis.description.AxisService,
+ org.apache.axis.Constants,
+ org.apache.axis.description.AxisOperation"%>
+ <%--
+ /*
+ * Copyright 2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+ <head><title>List Services</title>
+ <link href="css/axis-style.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+ <jsp:include page="include/header.inc"></jsp:include>
+ <h1>Available services</h1>
+ <br/><a href="<%=Constants.LISTSERVICES%>"> Refresh </a><br/>
+ <%
+ HashMap serviceMap = (HashMap)request.getSession().getAttribute(Constants.SERVICE_MAP);
+ if (serviceMap!=null && !serviceMap.isEmpty()){
+ HashMap operations;
+ String serviceName = "";
+ Collection servicecol = serviceMap.values();
+ Collection operationsList;
+
+ for (Iterator iterator = servicecol.iterator(); iterator.hasNext();) {
+ AxisService axisService = (AxisService) iterator.next();
+ operations = axisService.getOperations();
+ operationsList = operations.values();
+ serviceName = axisService.getName().getLocalPart();
+ %><hr><h3><font color="blue"><%=serviceName%></font></h3><%
+ if (operationsList.size() > 0) {
+ %><i>Available operations</i><%
+ } else {
+ %><i> There are no any opeartions specified</i><%
+ }
+ %><ul><%
+ for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
+ AxisOperation axisOperation = (AxisOperation) iterator1.next();
+ %><li><%=axisOperation.getName().getLocalPart()%></li><%
+ }
+ %></ul><%
+ }
+ request.getSession().removeAttribute(Constants.SERVICE_MAP);
+ }else{
+ %> There seems to be no services listed! Try hitting refresh <%
+ }
+ %>
+ <jsp:include page="include/link-footer.inc"></jsp:include>
+ <jsp:include page="include/footer.inc"></jsp:include>
+ </body>
+</html>
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/core/src/html/listSingleService.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/html/listSingleService.jsp?view=auto&rev=154317
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/html/listSingleService.jsp (added)
+++ webservices/axis/trunk/java/modules/core/src/html/listSingleService.jsp Fri Feb 18 07:44:12 2005
@@ -0,0 +1,69 @@
+<%@ page import="java.util.Iterator,
+ org.apache.axis.description.AxisOperation,
+ java.util.HashMap,
+ java.util.Collection,
+ org.apache.axis.description.AxisService,
+ org.apache.axis.Constants"%>
+ <%--
+ Created by IntelliJ IDEA.
+ User: Ajith
+ Date: Feb 17, 2005
+ Time: 8:47:13 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+ <head>
+ <title>Single Service List</title>
+ <link href="css/axis-style.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+ <jsp:include page="include/header.inc"></jsp:include>
+
+ <%
+ AxisService service = (AxisService)request.getSession().getAttribute(Constants.SINGLE_SERVICE);
+ //System.out.println("service = " + service);
+ if (service!=null){
+ %> <h2>This location contains a web service</h2><%
+ HashMap operations;
+ Collection operationsList;
+
+
+ operations = service.getOperations();
+ operationsList = operations.values();
+
+
+ %>
+ <hr><h3><font color="blue"><%=service.getName().getLocalPart()%></font></h3>
+ <%
+
+ if (operationsList.size() > 0) {
+ %>
+ <i>Available operations</i>
+ <%
+ } else {
+ %>
+ <i> There are no opeartions specified!!</i>
+ <%
+ }
+ %><ul><%
+ for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
+ AxisOperation axisOperation = (AxisOperation) iterator1.next();
+ %><li>
+<%=axisOperation.getName().getLocalPart()%></li>
+<%
+ }
+ %>
+ </ul>
+ <%
+ request.getSession().removeAttribute(Constants.SINGLE_SERVICE);
+ }else{
+ %> Oh! this place seems to be empty!!! <%
+}
+ %>
+
+
+ <jsp:include page="include/link-footer.inc"></jsp:include>
+ <jsp:include page="include/footer.inc"></jsp:include>
+</body>
+</html>
\ No newline at end of file
Modified: webservices/axis/trunk/java/modules/core/src/html/upload.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/html/upload.jsp?view=diff&r1=154316&r2=154317
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/html/upload.jsp (original)
+++ webservices/axis/trunk/java/modules/core/src/html/upload.jsp Fri Feb 18 07:44:12 2005
@@ -54,7 +54,7 @@
%>
<head>
<title> Upload a service </title>
- <link href="css/axis-style.css" rel="stylesheet" type="text/css">
+ <link href="css/axis-style.css" rel="stylesheet" type="text/css">
</head>
<body>
<jsp:include page="include/header.inc"></jsp:include>
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/Constants.java?view=diff&r1=154316&r2=154317
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/Constants.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/Constants.java Fri Feb 18 07:44:12 2005
@@ -1,37 +1,42 @@
-/*
- * Copyright 2003,2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.axis;
-
-public class Constants {
- public static final int SOAP_STYLE_RPC_ENCODED = 1000;
- public static final int SOAP_STYLE_RPC_LITERAL = 1001;
- public static final int SOAP_STYLE_DOC_LITRAL_WRAPPED = 1002;
-
- public static final String APPLICATION_SCOPE = "application";
- public static final String SESSION_SCOPE = "session";
- public static final String GLOBAL_SCOPE = "global";
-
- public static final String PHASE_SERVICE = "service";
- public static final String PHASE_TRANSPORT = "transport";
- public static final String PHASE_GLOBAL = "global";
-
- public static final String SESSION_CONTEXT_PROPERTY = "SessionContext";
-
- public static final String TRANSPORT_TCP = "tcp";
- public static final String TRANSPORT_HTTP = "http";
- public static final String TRANSPORT_SMTP= "smtp";
-
-}
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis;
+
+public class Constants {
+ public static final int SOAP_STYLE_RPC_ENCODED = 1000;
+ public static final int SOAP_STYLE_RPC_LITERAL = 1001;
+ public static final int SOAP_STYLE_DOC_LITRAL_WRAPPED = 1002;
+
+ public static final String APPLICATION_SCOPE = "application";
+ public static final String SESSION_SCOPE = "session";
+ public static final String GLOBAL_SCOPE = "global";
+
+ public static final String PHASE_SERVICE = "service";
+ public static final String PHASE_TRANSPORT = "transport";
+ public static final String PHASE_GLOBAL = "global";
+
+ public static final String SESSION_CONTEXT_PROPERTY = "SessionContext";
+
+ public static final String TRANSPORT_TCP = "tcp";
+ public static final String TRANSPORT_HTTP = "http";
+ public static final String TRANSPORT_SMTP= "smtp";
+
+public static final String LISTSERVICES = "listServices";
+ public static final String SERVICE_MAP = "servicemap";
+ public static final String SINGLE_SERVICE = "singleservice";
+
+
+}
Modified: webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java?view=diff&r1=154316&r2=154317
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/java/org/apache/axis/transport/http/AxisServlet.java Fri Feb 18 07:44:12 2005
@@ -1,167 +1,166 @@
-/*
-* Copyright 2003,2004 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.axis.transport.http;
-
-
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-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.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axis.Constants;
-import org.apache.axis.addressing.AddressingConstants;
-import org.apache.axis.addressing.EndpointReference;
-import org.apache.axis.context.MessageContext;
-import org.apache.axis.context.SessionContext;
-import org.apache.axis.context.SimpleSessionContext;
-import org.apache.axis.description.AxisOperation;
-import org.apache.axis.description.AxisService;
-import org.apache.axis.engine.AxisEngine;
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.engine.EngineRegistry;
-import org.apache.axis.engine.EngineRegistryFactory;
-import org.apache.axis.om.OMFactory;
-import org.apache.axis.om.SOAPEnvelope;
-import org.apache.axis.om.impl.llom.builder.StAXBuilder;
-import org.apache.axis.om.impl.llom.builder.StAXSOAPModelBuilder;
-
-
-public class AxisServlet extends HttpServlet {
- private EngineRegistry engineRegistry;
- private final String LISTSERVICES = "listServices";
-
-
- public void init(ServletConfig config) throws ServletException {
- try {
- ServletContext context = config.getServletContext();
- String repoDir = context.getRealPath("/WEB-INF");
- Class erClass = Class.forName("org.apache.axis.deployment.EngineRegistryFactoryImpl");
- EngineRegistryFactory erfac = (EngineRegistryFactory)erClass.newInstance();
- this.engineRegistry = erfac.createEngineRegistry(repoDir);
- } catch (Exception e) {
- throw new ServletException(e);
- }
- }
-
- protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
- doPost(httpServletRequest,httpServletResponse);
- }
-
- /* (non-Javadoc)
- * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
- */
- protected void doPost(HttpServletRequest req, HttpServletResponse res)
- throws ServletException, IOException {
- try {
- res.setContentType("text/xml; charset=utf-8");
- AxisEngine engine = new AxisEngine(engineRegistry);
-
-
- Object sessionContext = req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
- if(sessionContext == null){
- sessionContext = new SimpleSessionContext();
- req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,sessionContext);
- }
-
- MessageContext msgContext = new MessageContext(engineRegistry, null,(SessionContext)sessionContext);
-
- msgContext.setServerSide(true);
- String filePart = req.getRequestURL().toString();
- if (filePart != null && filePart.endsWith(LISTSERVICES)) {
- listServices(res);
- return;
- }
- msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, filePart));
-
- String soapActionString = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
-
- if (soapActionString != null) {
- msgContext.setProperty(MessageContext.SOAP_ACTION, soapActionString);
- }
-
- XMLStreamReader reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new InputStreamReader(req.getInputStream()));
- StAXBuilder builder =
- new StAXSOAPModelBuilder(OMFactory.newInstance(), reader);
- msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
-
- msgContext.setProperty(MessageContext.TRANSPORT_TYPE,
- Constants.TRANSPORT_HTTP);
- msgContext.setProperty(MessageContext.TRANSPORT_WRITER,
- res.getWriter());
-
- engine.receive(msgContext);
- } catch (AxisFault e) {
- throw new ServletException(e);
- } catch (XMLStreamException e) {
- throw new ServletException(e);
- } catch (FactoryConfigurationError e) {
- throw new ServletException(e);
- }
-
- }
-
- //todo this neeeds to be re-written as a JSP
- private void listServices(HttpServletResponse res) throws IOException {
- HashMap services = engineRegistry.getServices();
- HashMap operations;
- String serviceName = "";
- Collection servicecol = services.values();
- Collection operationsList;
- PrintWriter out = res.getWriter();
- res.setContentType("text/html");
- String html = "<HTML>\n" +
- "<HEAD><TITLE>Avalilable services</TITLE>" +
- "<link href=\"css/axis-style.css\" rel=\"stylesheet\" type=\"text/css\">" +
- "</HEAD>\n" +
- "<BODY>\n" +
- "<H1>Avalilable services</H1>\n";
-
-
- for (Iterator iterator = servicecol.iterator(); iterator.hasNext();) {
- AxisService axisService = (AxisService) iterator.next();
- operations = axisService.getOperations();
- operationsList = operations.values();
- serviceName = axisService.getName().getLocalPart();
- html += "<hr><h3><font color=\"blue\">" + serviceName + "</font><h3>";
- if (operationsList.size() > 0) {
- html += "<i> Availble operations</i>";
- } else {
- html += "<i> There is no any opeartion specified</i>";
- }
- for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
- AxisOperation axisOperation = (AxisOperation) iterator1.next();
- html += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
- }
- }
- out.println(html + "</BODY></HTML>");
- }
-
-
-}
+/*
+* Copyright 2003,2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.axis.transport.http;
+
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+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.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.context.SessionContext;
+import org.apache.axis.context.SimpleSessionContext;
+import org.apache.axis.description.AxisOperation;
+import org.apache.axis.description.AxisService;
+import org.apache.axis.engine.AxisEngine;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.engine.EngineRegistry;
+import org.apache.axis.engine.EngineRegistryFactory;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.impl.llom.builder.StAXBuilder;
+import org.apache.axis.om.impl.llom.builder.StAXSOAPModelBuilder;
+
+
+public class AxisServlet extends HttpServlet {
+ private EngineRegistry engineRegistry;
+
+ private static final String LIST_MULTIPLE_SERVICE_JSP_NAME = "listServices.jsp";
+ private static final String LIST_SINGLE_SERVICE_JSP_NAME = "listSingleService.jsp";
+
+ private final boolean allowListServices = true;
+ private final boolean allowListSingleService = true;
+
+ public void init(ServletConfig config) throws ServletException {
+ try {
+ ServletContext context = config.getServletContext();
+ String repoDir = context.getRealPath("/WEB-INF");
+ Class erClass = Class.forName("org.apache.axis.deployment.EngineRegistryFactoryImpl");
+ EngineRegistryFactory erfac = (EngineRegistryFactory)erClass.newInstance();
+ this.engineRegistry = erfac.createEngineRegistry(repoDir);
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ }
+
+
+ protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
+
+ String filePart = httpServletRequest.getRequestURL().toString();
+
+ if (allowListServices && filePart != null && filePart.endsWith(Constants.LISTSERVICES)) {
+ listServices(httpServletRequest,httpServletResponse);
+ return;
+ }else{
+ if (allowListSingleService){
+ listService(httpServletRequest,httpServletResponse,filePart);
+ return;
+ }
+
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+ */
+ protected void doPost(HttpServletRequest req, HttpServletResponse res)
+ throws ServletException, IOException {
+ try {
+ res.setContentType("text/xml; charset=utf-8");
+ AxisEngine engine = new AxisEngine(engineRegistry);
+
+
+ Object sessionContext = req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
+ if(sessionContext == null){
+ sessionContext = new SimpleSessionContext();
+ req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,sessionContext);
+ }
+
+ MessageContext msgContext = new MessageContext(engineRegistry, null,(SessionContext)sessionContext);
+
+ msgContext.setServerSide(true);
+ String filePart = req.getRequestURL().toString();
+ msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, filePart));
+ String soapActionString = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
+
+ if (soapActionString != null) {
+ msgContext.setProperty(MessageContext.SOAP_ACTION, soapActionString);
+ }
+
+ XMLStreamReader reader =
+ XMLInputFactory.newInstance().createXMLStreamReader(new InputStreamReader(req.getInputStream()));
+ StAXBuilder builder =
+ new StAXSOAPModelBuilder(OMFactory.newInstance(), reader);
+ msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
+
+ msgContext.setProperty(MessageContext.TRANSPORT_TYPE,
+ Constants.TRANSPORT_HTTP);
+ msgContext.setProperty(MessageContext.TRANSPORT_WRITER,
+ res.getWriter());
+
+ engine.receive(msgContext);
+ } catch (AxisFault e) {
+ throw new ServletException(e);
+ } catch (XMLStreamException e) {
+ throw new ServletException(e);
+ } catch (FactoryConfigurationError e) {
+ throw new ServletException(e);
+ }
+
+ }
+
+ private void listServices(HttpServletRequest req,HttpServletResponse res) throws IOException {
+ HashMap services = engineRegistry.getServices();
+ req.getSession().setAttribute(Constants.SERVICE_MAP,services);
+ res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
+ }
+
+ private void listService (HttpServletRequest req,HttpServletResponse res,String filePart) throws IOException {
+ String serviceName =filePart.substring(filePart.lastIndexOf("/")+1,filePart.length());
+ HashMap services = engineRegistry.getServices();
+ if (services!=null && !services.isEmpty()){
+ Object serviceObj = services.get(new QName(serviceName));
+ if (serviceObj!=null){
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE,serviceObj);
+ }
+ }
+ String URI = req.getRequestURI();
+ URI = URI.substring(0,URI.indexOf("services"));
+
+ res.sendRedirect(URI + LIST_SINGLE_SERVICE_JSP_NAME);
+ }
+
+
+
+}