Source Code Cross Referenced for Stub.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » client » 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.client 
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:
020:        package org.apache.axis2.client;
021:
022:        import org.apache.axiom.om.*;
023:        import org.apache.axiom.soap.*;
024:        import org.apache.axis2.AxisFault;
025:        import org.apache.axis2.Constants;
026:        import org.apache.axis2.wsdl.WSDLConstants;
027:        import org.apache.axis2.addressing.EndpointReference;
028:        import org.apache.axis2.context.MessageContext;
029:        import org.apache.axis2.description.AxisService;
030:        import org.apache.axis2.description.WSDL2Constants;
031:        import org.apache.axis2.i18n.Messages;
032:        import org.apache.axis2.transport.http.HTTPConstants;
033:        import org.apache.commons.httpclient.Header;
034:
035:        import java.util.ArrayList;
036:        import java.util.Iterator;
037:
038:        /**
039:         * Base class for generated client stubs. This defines several client API
040:         * (<code>public</code>) methods shared between all types of stubs, along with
041:         * some <code>protected</code> methods intended for use by the actual stub
042:         * implementation code. The client API method names start with a leading
043:         * underscore character to avoid conflicts with actual implementation methods.
044:         */
045:        public abstract class Stub {
046:
047:            protected AxisService _service;
048:            protected ArrayList modules = new ArrayList();
049:
050:            protected ServiceClient _serviceClient;
051:
052:            /**
053:             * Get service client implementation used by this stub.
054:             *
055:             * @return service client
056:             */
057:            public ServiceClient _getServiceClient() {
058:                return _serviceClient;
059:            }
060:
061:            /**
062:             * Set service client implementation used by this stub. Once set, the
063:             * service client is owned by this stub and will automatically be removed
064:             * from the configuration when use of the stub is done.
065:             *
066:             * @param _serviceClient
067:             */
068:            public void _setServiceClient(ServiceClient _serviceClient) {
069:                this ._serviceClient = _serviceClient;
070:            }
071:
072:            /**
073:             * Create a SOAP message envelope using the supplied options.
074:             * TODO generated stub code should use this method, or similar method taking
075:             * an operation client
076:             *
077:             * @param options
078:             * @return generated
079:             * @throws SOAPProcessingException
080:             */
081:            protected static SOAPEnvelope createEnvelope(Options options)
082:                    throws SOAPProcessingException {
083:                return getFactory(options.getSoapVersionURI())
084:                        .getDefaultEnvelope();
085:            }
086:
087:            /**
088:             * Get Axiom factory appropriate to selected SOAP version.
089:             *
090:             * @param soapVersionURI
091:             * @return factory
092:             */
093:            protected static SOAPFactory getFactory(String soapVersionURI) {
094:
095:                if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
096:                        .equals(soapVersionURI)) {
097:                    return OMAbstractFactory.getSOAP11Factory();
098:                } else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
099:                        .equals(soapVersionURI)) {
100:                    return OMAbstractFactory.getSOAP12Factory();
101:                } else {
102:                    throw new RuntimeException(Messages
103:                            .getMessage("unknownsoapversion"));
104:                }
105:            }
106:
107:            /**
108:             * Finalize method called by garbage collection. This is overridden to
109:             * support cleanup of any associated resources.
110:             *
111:             * @throws Throwable
112:             */
113:            protected void finalize() throws Throwable {
114:                super .finalize();
115:                cleanup();
116:            }
117:
118:            /**
119:             * Cleanup associated resources. This removes the axis service from the
120:             * configuration.
121:             *
122:             * @throws AxisFault
123:             */
124:            public void cleanup() throws AxisFault {
125:                _service.getAxisConfiguration().removeService(
126:                        _service.getName());
127:            }
128:
129:            /**
130:             * sets the epr of the service client to given value
131:             *
132:             * @param address
133:             */
134:
135:            protected void setServiceClientEPR(String address) {
136:                EndpointReference toEPRFromServiceClient = _serviceClient
137:                        .getOptions().getTo();
138:                toEPRFromServiceClient.setAddress(address);
139:            }
140:
141:            /**
142:             * add an http header with name and value to message context
143:             *
144:             * @param messageContext
145:             * @param name
146:             * @param value
147:             */
148:            protected void addHttpHeader(MessageContext messageContext,
149:                    String name, String value) {
150:                java.lang.Object headersObj = messageContext
151:                        .getProperty(HTTPConstants.HTTP_HEADERS);
152:                if (headersObj == null) {
153:                    headersObj = new java.util.ArrayList();
154:                }
155:                java.util.List headers = (java.util.List) headersObj;
156:                Header header = new Header();
157:                header.setName(name);
158:                header.setValue(value);
159:                headers.add(header);
160:                messageContext.setProperty(HTTPConstants.HTTP_HEADERS, headers);
161:            }
162:
163:            /**
164:             * sets the propertykey and propertyValue as a pair to operation client
165:             *
166:             * @param operationClient
167:             * @param propertyKey
168:             * @param propertyValue
169:             */
170:
171:            protected void addPropertyToOperationClient(
172:                    OperationClient operationClient, String propertyKey,
173:                    Object propertyValue) {
174:                operationClient.getOptions().setProperty(propertyKey,
175:                        propertyValue);
176:            }
177:
178:            protected void addPropertyToOperationClient(
179:                    OperationClient operationClient, String propertyKey,
180:                    boolean value) {
181:                addPropertyToOperationClient(operationClient, propertyKey,
182:                        new Boolean(value));
183:            }
184:
185:            protected void addPropertyToOperationClient(
186:                    OperationClient operationClient, String propertyKey,
187:                    int value) {
188:                addPropertyToOperationClient(operationClient, propertyKey,
189:                        new Integer(value));
190:            }
191:
192:            protected void setMustUnderstand(OMElement headerElement,
193:                    OMNamespace omNamespace) {
194:                OMFactory omFactory = OMAbstractFactory.getOMFactory();
195:                OMAttribute mustUnderstandAttribute = omFactory
196:                        .createOMAttribute(SOAP12Constants.ATTR_MUSTUNDERSTAND,
197:                                omNamespace, "true");
198:                headerElement.addAttribute(mustUnderstandAttribute);
199:            }
200:
201:            protected void addHeader(OMElement omElementToadd,
202:                    SOAPEnvelope envelop, boolean mustUnderstand) {
203:                SOAPHeaderBlock soapHeaderBlock = envelop.getHeader()
204:                        .addHeaderBlock(omElementToadd.getLocalName(),
205:                                omElementToadd.getNamespace());
206:                soapHeaderBlock.setMustUnderstand(mustUnderstand);
207:                OMNode omNode = null;
208:                for (Iterator iter = omElementToadd.getChildren(); iter
209:                        .hasNext();) {
210:                    omNode = (OMNode) iter.next();
211:                    soapHeaderBlock.addChild(omNode);
212:                }
213:
214:            }
215:
216:            protected void addHeader(OMElement omElementToadd,
217:                    SOAPEnvelope envelop) {
218:                addHeader(omElementToadd, envelop, false);
219:            }
220:
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.