Source Code Cross Referenced for JAxisServlet.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » ws » axis » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.ws.axis 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2004-2005 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: JAxisServlet.java 7679 2005-11-17 17:10:03Z sauthieg $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.ws.axis;
025:
026:        import java.io.PrintWriter;
027:        import java.util.ArrayList;
028:        import java.util.Iterator;
029:        import javax.naming.InitialContext;
030:        import javax.naming.NamingException;
031:        import javax.servlet.http.HttpServletRequest;
032:        import javax.servlet.http.HttpServletResponse;
033:        import javax.xml.namespace.QName;
034:        import org.apache.axis.AxisEngine;
035:        import org.apache.axis.AxisFault;
036:        import org.apache.axis.ConfigurationException;
037:        import org.apache.axis.description.OperationDesc;
038:        import org.apache.axis.description.ServiceDesc;
039:        import org.apache.axis.server.AxisServer;
040:        import org.apache.axis.transport.http.AxisServlet;
041:
042:        import org.objectweb.jonas_ws.deployment.api.PortComponentDesc;
043:        import org.objectweb.jonas_ws.deployment.api.WSDeploymentDescException;
044:
045:        /**
046:         * JOnAS AxisServlet version.
047:         * When displaying the port list, This class set the right URL.
048:         * @author Guillaume Sauthier
049:         */
050:        public class JAxisServlet extends AxisServlet {
051:
052:            /**
053:             * This method lists the available services; it is called when there is
054:             * nothing to execute on a GET
055:             * @param response HTTP response
056:             * @param writer writer
057:             * @param request HTTP request
058:             * @throws ConfigurationException cannot find axis WSDDConfiguration
059:             * @throws AxisFault cannot find endpoint URL
060:             */
061:            protected void reportAvailableServices(
062:                    HttpServletResponse response, PrintWriter writer,
063:                    HttpServletRequest request) throws ConfigurationException,
064:                    AxisFault {
065:                AxisEngine engine = getEngine();
066:
067:                response.setContentType("text/html; charset=utf-8");
068:                writer.println("<h2>And now... Some Services</h2>");
069:
070:                Iterator i;
071:                try {
072:                    i = engine.getConfig().getDeployedServices();
073:                } catch (ConfigurationException configException) {
074:                    //turn any internal configuration exceptions back into axis faults
075:                    //if that is what they are
076:                    if (configException.getContainedException() instanceof  AxisFault) {
077:                        throw (AxisFault) configException
078:                                .getContainedException();
079:                    } else {
080:                        throw configException;
081:                    }
082:                }
083:
084:                // Before calling  super method, add the WSDL in ServletContext
085:                InitialContext iCtx;
086:                AxisServer axisServer = getEngine();
087:                org.objectweb.jonas_ws.deployment.api.ServiceDesc serviceDesc = null;
088:                try {
089:                    iCtx = new InitialContext();
090:                    serviceDesc = (org.objectweb.jonas_ws.deployment.api.ServiceDesc) iCtx
091:                            .lookup("java:comp/jonas/" + axisServer.getName()
092:                                    + "/dd");
093:                } catch (NamingException e) {
094:                    log.debug(
095:                            "Cannot find ServiceDesc in context 'java:comp/jonas/"
096:                                    + axisServer.getName() + "/dd'", e);
097:                    throw new AxisFault("Servlet name not found : "
098:                            + axisServer.getName(), e);
099:                }
100:
101:                writer.println("<ul>");
102:                while (i.hasNext()) {
103:                    ServiceDesc sd = (ServiceDesc) i.next();
104:                    StringBuffer sb = new StringBuffer();
105:                    sb.append("<li>");
106:                    String name = sd.getName();
107:                    sb.append(name);
108:                    sb.append(" <a href=\"");
109:                    String endpointURL = null;
110:                    QName portName = getWsdlPortName(serviceDesc, name);
111:                    try {
112:                        endpointURL = serviceDesc.getWSDL().getLocation(
113:                                portName).toExternalForm();
114:                    } catch (WSDeploymentDescException e) {
115:                        throw new AxisFault(
116:                                "Cannot find endpoint URL for server "
117:                                        + axisServer.getName() + " and port "
118:                                        + name, e);
119:                    }
120:                    sb.append(endpointURL);
121:                    sb.append("?jwsdl\"><i>(wsdl)</i></a></li>");
122:                    writer.println(sb.toString());
123:                    ArrayList operations = sd.getOperations();
124:                    if (!operations.isEmpty()) {
125:                        writer.println("<ul>");
126:                        for (Iterator it = operations.iterator(); it.hasNext();) {
127:                            OperationDesc desc = (OperationDesc) it.next();
128:                            writer.println("<li>" + desc.getName());
129:                        }
130:                        writer.println("</ul>");
131:                    }
132:                }
133:                writer.println("</ul>");
134:            }
135:
136:            /**
137:             * @param serviceDesc JOnAS ServiceDesc
138:             * @param axisServiceName the axis service name is linked to the J2EE port-component name
139:             * @return Returns the wsdl:port name
140:             */
141:            private QName getWsdlPortName(
142:                    org.objectweb.jonas_ws.deployment.api.ServiceDesc serviceDesc,
143:                    String axisServiceName) {
144:                QName wsdlPortName = null;
145:                for (Iterator p = serviceDesc.getPortComponents().iterator(); p
146:                        .hasNext()
147:                        || wsdlPortName == null;) {
148:                    PortComponentDesc pcd = (PortComponentDesc) p.next();
149:                    if (axisServiceName.equals(pcd.getServiceName())) {
150:                        wsdlPortName = pcd.getQName();
151:                    }
152:                }
153:                return wsdlPortName;
154:            }
155:
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.