Source Code Cross Referenced for WSDL11ActionHelper.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » addressing » wsdl » 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 » Web Services AXIS2 » kernal » org.apache.axis2.addressing.wsdl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:        package org.apache.axis2.addressing.wsdl;
020:
021:        import org.apache.axis2.addressing.AddressingConstants;
022:        import org.apache.commons.logging.Log;
023:        import org.apache.commons.logging.LogFactory;
024:
025:        import javax.wsdl.Definition;
026:        import javax.wsdl.Fault;
027:        import javax.wsdl.Input;
028:        import javax.wsdl.Operation;
029:        import javax.wsdl.Output;
030:        import javax.wsdl.PortType;
031:        import javax.wsdl.extensions.AttributeExtensible;
032:        import javax.xml.namespace.QName;
033:        import java.util.List;
034:
035:        /**
036:         * The WSDL11ActionHelper provides 3 static methods to determine the correct wsa:Action value from
037:         * a wsdl4j Input/Output/Fault object. It first attempts to access the wsaw:Action attribute and if
038:         * that is not found uses the WSDL11DefaultActionPatternHelper to generate and Action based on the
039:         * Default Action Pattern for WSDL1.1 at http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#defactionwsdl11
040:         */
041:        public class WSDL11ActionHelper {
042:
043:            private static final Log log = LogFactory
044:                    .getLog(WSDL11ActionHelper.class);
045:            private static final QName submissionWSAWNS = new QName(
046:                    AddressingConstants.Submission.WSA_NAMESPACE,
047:                    AddressingConstants.WSA_ACTION);
048:            private static final QName finalWSANS = new QName(
049:                    AddressingConstants.Final.WSA_NAMESPACE,
050:                    AddressingConstants.WSA_ACTION);
051:            private static final QName finalWSAWNS = new QName(
052:                    AddressingConstants.Final.WSAW_NAMESPACE,
053:                    AddressingConstants.WSA_ACTION);
054:
055:            /**
056:             * getActionFromInputElement
057:             *
058:             * @param def            the wsdl:definitions which contains the wsdl:portType
059:             * @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation
060:             * @param op             the wsdl:operation which contains the input element
061:             * @param input          the input element to be examined to generate the wsa:Action
062:             * @return either the wsaw:Action from the input element or an action generated using the DefaultActionPattern
063:             */
064:            public static String getActionFromInputElement(Definition def,
065:                    PortType wsdl4jPortType, Operation op, Input input) {
066:                String result = getWSAWActionExtensionAttribute(input);
067:                if (result == null) {
068:                    result = WSDL11DefaultActionPatternHelper
069:                            .generateActionFromInputElement(def,
070:                                    wsdl4jPortType, op, input);
071:                }
072:                log.trace(result);
073:                return result;
074:            }
075:
076:            /**
077:             * getActionFromOutputElement
078:             *
079:             * @param def            the wsdl:definitions which contains the wsdl:portType
080:             * @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation
081:             * @param op             the wsdl:operation which contains the output element
082:             * @param output         the input element to be examined to generate the wsa:Action
083:             * @return either the wsaw:Action from the output element or an action generated using the DefaultActionPattern
084:             */
085:            public static String getActionFromOutputElement(Definition def,
086:                    PortType wsdl4jPortType, Operation op, Output output) {
087:                String result = getWSAWActionExtensionAttribute(output);
088:                if (result == null) {
089:                    result = WSDL11DefaultActionPatternHelper
090:                            .generateActionFromOutputElement(def,
091:                                    wsdl4jPortType, op, output);
092:                }
093:                log.trace(result);
094:                return result;
095:            }
096:
097:            /**
098:             * getActionFromFaultElement
099:             *
100:             * @param def            the wsdl:definitions which contains the wsdl:portType
101:             * @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation
102:             * @param op             the wsdl:operation which contains the fault element
103:             * @param fault          the fault element to be examined to generate the wsa:Action
104:             * @return either the wsaw:Action from the fault element or an action generated using the DefaultActionPattern
105:             */
106:            public static String getActionFromFaultElement(Definition def,
107:                    PortType wsdl4jPortType, Operation op, Fault fault) {
108:                String result = getWSAWActionExtensionAttribute(fault);
109:                if (result == null) {
110:                    result = WSDL11DefaultActionPatternHelper
111:                            .generateActionFromFaultElement(def,
112:                                    wsdl4jPortType, op, fault);
113:                }
114:                log.trace(result);
115:                return result;
116:            }
117:
118:            private static String getWSAWActionExtensionAttribute(
119:                    AttributeExtensible ae) {
120:                // Search first for a wsaw:Action using the submission namespace
121:                Object attribute = ae.getExtensionAttribute(submissionWSAWNS);
122:                // Then if that did not exist one using the w3c namespace
123:                if (attribute == null) {
124:                    attribute = ae.getExtensionAttribute(finalWSAWNS);
125:                }
126:                // Then finally if that did not exist, try the 2005/08 NS
127:                // (Included here because it's needed for Apache Muse)
128:                if (attribute == null) {
129:                    attribute = ae.getExtensionAttribute(finalWSANS);
130:                }
131:
132:                // wsdl4j may return a String, QName or a List of either
133:                // If it is a list, extract the first element
134:                if (attribute instanceof  List) {
135:                    List l = (List) attribute;
136:                    if (l.size() > 0) {
137:                        attribute = l.get(0);
138:                    } else {
139:                        attribute = null;
140:                    }
141:                }
142:
143:                // attribute must now be a QName or String or null
144:                // If it is a QName, take the LocalPart as a String
145:                if (attribute instanceof  QName) {
146:                    QName qn = (QName) attribute;
147:                    attribute = qn.getLocalPart();
148:                }
149:
150:                if ((attribute instanceof  String)) {
151:                    String result = (String) attribute;
152:                    log.trace(result);
153:                    return result;
154:                } else {
155:                    if (log.isTraceEnabled()) {
156:                        log.trace("No wsaw:Action attribute found");
157:                    }
158:                    return null;
159:                }
160:            }
161:
162:            public static String getInputActionFromStringInformation(
163:                    String messageExchangePattern, String targetNamespace,
164:                    String portTypeName, String operationName, String inputName) {
165:                return WSDL11DefaultActionPatternHelper
166:                        .getInputActionFromStringInformation(
167:                                messageExchangePattern, targetNamespace,
168:                                portTypeName, operationName, inputName);
169:            }
170:
171:            public static String getOutputActionFromStringInformation(
172:                    String messageExchangePattern, String targetNamespace,
173:                    String portTypeName, String operationName, String outputName) {
174:                return WSDL11DefaultActionPatternHelper
175:                        .getOutputActionFromStringInformation(
176:                                messageExchangePattern, targetNamespace,
177:                                portTypeName, operationName, outputName);
178:            }
179:
180:            public static String getFaultActionFromStringInformation(
181:                    String targetNamespace, String portTypeName,
182:                    String operationName, String faultName) {
183:                return WSDL11DefaultActionPatternHelper
184:                        .getFaultActionFromStringInformation(targetNamespace,
185:                                portTypeName, operationName, faultName);
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.