Source Code Cross Referenced for Saaj13Implementation.java in  » Web-Services » spring-ws-1.0.0 » org » springframework » ws » soap » saaj » 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 » spring ws 1.0.0 » org.springframework.ws.soap.saaj 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.ws.soap.saaj;
018:
019:        import java.io.IOException;
020:        import java.io.OutputStream;
021:        import java.util.Iterator;
022:        import java.util.Locale;
023:        import javax.activation.DataHandler;
024:        import javax.xml.namespace.QName;
025:        import javax.xml.soap.AttachmentPart;
026:        import javax.xml.soap.Detail;
027:        import javax.xml.soap.DetailEntry;
028:        import javax.xml.soap.MimeHeader;
029:        import javax.xml.soap.MimeHeaders;
030:        import javax.xml.soap.SOAPBody;
031:        import javax.xml.soap.SOAPConstants;
032:        import javax.xml.soap.SOAPElement;
033:        import javax.xml.soap.SOAPEnvelope;
034:        import javax.xml.soap.SOAPException;
035:        import javax.xml.soap.SOAPFault;
036:        import javax.xml.soap.SOAPHeader;
037:        import javax.xml.soap.SOAPHeaderElement;
038:        import javax.xml.soap.SOAPMessage;
039:        import javax.xml.transform.Result;
040:        import javax.xml.transform.Source;
041:        import javax.xml.transform.dom.DOMResult;
042:        import javax.xml.transform.dom.DOMSource;
043:
044:        import org.springframework.util.ObjectUtils;
045:        import org.springframework.ws.soap.SoapVersion;
046:        import org.springframework.ws.transport.TransportOutputStream;
047:
048:        /**
049:         * SAAJ 1.3 specific implementation of the <code>SaajImplementation</code> interface.
050:         *
051:         * @author Arjen Poutsma
052:         * @since 1.0.0
053:         */
054:        public class Saaj13Implementation implements  SaajImplementation {
055:
056:            private static final Saaj13Implementation INSTANCE = new Saaj13Implementation();
057:
058:            private Saaj13Implementation() {
059:            }
060:
061:            public static Saaj13Implementation getInstance() {
062:                return INSTANCE;
063:            }
064:
065:            public QName getName(SOAPElement element) {
066:                return element.getElementQName();
067:            }
068:
069:            public QName getFaultCode(SOAPFault fault) {
070:                return fault.getFaultCodeAsQName();
071:            }
072:
073:            public boolean isSoap11(SOAPElement element) {
074:                return SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(element
075:                        .getNamespaceURI());
076:            }
077:
078:            public DetailEntry addDetailEntry(Detail detail, QName name)
079:                    throws SOAPException {
080:                return detail.addDetailEntry(name);
081:            }
082:
083:            public SOAPHeaderElement addHeaderElement(SOAPHeader header,
084:                    QName name) throws SOAPException {
085:                return header.addHeaderElement(name);
086:            }
087:
088:            public String getFaultRole(SOAPFault fault) {
089:                return fault.getFaultRole();
090:            }
091:
092:            public void setFaultRole(SOAPFault fault, String role)
093:                    throws SOAPException {
094:                fault.setFaultRole(role);
095:            }
096:
097:            public SOAPHeaderElement addNotUnderstoodHeaderElement(
098:                    SOAPHeader header, QName name) throws SOAPException {
099:                return header.addNotUnderstoodHeaderElement(name);
100:            }
101:
102:            public SOAPHeaderElement addUpgradeHeaderElement(SOAPHeader header,
103:                    String[] supportedSoapUris) throws SOAPException {
104:                return header.addUpgradeHeaderElement(supportedSoapUris);
105:            }
106:
107:            public Iterator getFaultSubcodes(SOAPFault fault) {
108:                return fault.getFaultSubcodes();
109:            }
110:
111:            public void appendFaultSubcode(SOAPFault fault, QName subcode)
112:                    throws SOAPException {
113:                fault.appendFaultSubcode(subcode);
114:            }
115:
116:            public String getFaultNode(SOAPFault fault) {
117:                return fault.getFaultNode();
118:            }
119:
120:            public void setFaultNode(SOAPFault fault, String uri)
121:                    throws SOAPException {
122:                fault.setFaultNode(uri);
123:            }
124:
125:            public String getFaultReasonText(SOAPFault fault, Locale locale)
126:                    throws SOAPException {
127:                return fault.getFaultReasonText(locale);
128:            }
129:
130:            public void setFaultReasonText(SOAPFault fault, Locale locale,
131:                    String text) throws SOAPException {
132:                fault.addFaultReasonText(text, locale);
133:            }
134:
135:            public SOAPFault addFault(SOAPBody body, QName faultCode,
136:                    String faultString, Locale locale) throws SOAPException {
137:                if (locale == null) {
138:                    return body.addFault(faultCode, faultString);
139:                } else {
140:                    return body.addFault(faultCode, faultString, locale);
141:                }
142:            }
143:
144:            public Source getSource(SOAPElement element) {
145:                return new DOMSource(element);
146:            }
147:
148:            public Result getResult(SOAPElement element) {
149:                return new DOMResult(element);
150:            }
151:
152:            public String getText(SOAPElement element) {
153:                return element.getValue();
154:            }
155:
156:            public void setText(SOAPElement element, String content) {
157:                element.setValue(content);
158:            }
159:
160:            public void addAttribute(SOAPElement element, QName name,
161:                    String value) throws SOAPException {
162:                element.addAttribute(name, value);
163:            }
164:
165:            public void removeAttribute(SOAPElement element, QName name)
166:                    throws SOAPException {
167:                element.removeAttribute(name);
168:            }
169:
170:            public String getAttributeValue(SOAPElement element, QName name)
171:                    throws SOAPException {
172:                return element.getAttributeValue(name);
173:            }
174:
175:            public Iterator getAllAttibutes(SOAPElement element) {
176:                return element.getAllAttributesAsQNames();
177:            }
178:
179:            public SOAPEnvelope getEnvelope(SOAPMessage message)
180:                    throws SOAPException {
181:                return message.getSOAPPart().getEnvelope();
182:            }
183:
184:            public SOAPHeader getHeader(SOAPEnvelope envelope)
185:                    throws SOAPException {
186:                return envelope.getHeader();
187:            }
188:
189:            public SOAPBody getBody(SOAPEnvelope envelope) throws SOAPException {
190:                return envelope.getBody();
191:            }
192:
193:            public Iterator examineAllHeaderElements(SOAPHeader header) {
194:                return header.examineAllHeaderElements();
195:            }
196:
197:            public Iterator examineMustUnderstandHeaderElements(
198:                    SOAPHeader header, String actorOrRole) {
199:                return header.examineMustUnderstandHeaderElements(actorOrRole);
200:            }
201:
202:            public String getActorOrRole(SOAPHeaderElement headerElement) {
203:                return headerElement.getActor();
204:            }
205:
206:            public void setActorOrRole(SOAPHeaderElement headerElement,
207:                    String actorOrRole) {
208:                headerElement.setActor(actorOrRole);
209:            }
210:
211:            public boolean getMustUnderstand(SOAPHeaderElement headerElement) {
212:                return headerElement.getMustUnderstand();
213:            }
214:
215:            public void setMustUnderstand(SOAPHeaderElement headerElement,
216:                    boolean mustUnderstand) {
217:                headerElement.setMustUnderstand(mustUnderstand);
218:            }
219:
220:            public boolean hasFault(SOAPBody body) {
221:                return body.hasFault();
222:            }
223:
224:            public SOAPFault getFault(SOAPBody body) {
225:                return body.getFault();
226:            }
227:
228:            public String getFaultActor(SOAPFault fault) {
229:                return fault.getFaultActor();
230:            }
231:
232:            public void setFaultActor(SOAPFault fault, String actorOrRole)
233:                    throws SOAPException {
234:                fault.setFaultActor(actorOrRole);
235:            }
236:
237:            public String getFaultString(SOAPFault fault) {
238:                return fault.getFaultString();
239:            }
240:
241:            public Locale getFaultStringLocale(SOAPFault fault) {
242:                return fault.getFaultStringLocale();
243:            }
244:
245:            public Detail getFaultDetail(SOAPFault fault) {
246:                return fault.getDetail();
247:            }
248:
249:            public Detail addFaultDetail(SOAPFault fault) throws SOAPException {
250:                return fault.addDetail();
251:            }
252:
253:            public void addTextNode(DetailEntry detailEntry, String text)
254:                    throws SOAPException {
255:                detailEntry.addTextNode(text);
256:            }
257:
258:            public Iterator getDetailEntries(Detail detail) {
259:                return detail.getDetailEntries();
260:            }
261:
262:            public SOAPElement getFirstBodyElement(SOAPBody body) {
263:                for (Iterator iterator = body.getChildElements(); iterator
264:                        .hasNext();) {
265:                    Object child = iterator.next();
266:                    if (child instanceof  SOAPElement) {
267:                        return (SOAPElement) child;
268:                    }
269:                }
270:                return null;
271:            }
272:
273:            public void removeContents(SOAPElement element) {
274:                element.removeContents();
275:            }
276:
277:            public void writeTo(SOAPMessage message, OutputStream outputStream)
278:                    throws SOAPException, IOException {
279:                if (message.saveRequired()) {
280:                    message.saveChanges();
281:                }
282:                if (outputStream instanceof  TransportOutputStream) {
283:                    TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream;
284:                    // some SAAJ implementations (Axis 1) do not have a Content-Type header by default
285:                    MimeHeaders headers = message.getMimeHeaders();
286:                    if (ObjectUtils.isEmpty(headers.getHeader("Content-Type"))) {
287:                        SOAPEnvelope envelope = message.getSOAPPart()
288:                                .getEnvelope();
289:                        if (envelope.getElementQName().getNamespaceURI()
290:                                .equals(
291:                                        SoapVersion.SOAP_11
292:                                                .getEnvelopeNamespaceUri())) {
293:                            headers.addHeader("Content-Type",
294:                                    SoapVersion.SOAP_11.getContentType());
295:                        } else {
296:                            headers.addHeader("Content-Type",
297:                                    SoapVersion.SOAP_12.getContentType());
298:                        }
299:                        if (message.saveRequired()) {
300:                            message.saveChanges();
301:                        }
302:                    }
303:                    for (Iterator iterator = headers.getAllHeaders(); iterator
304:                            .hasNext();) {
305:                        MimeHeader mimeHeader = (MimeHeader) iterator.next();
306:                        transportOutputStream.addHeader(mimeHeader.getName(),
307:                                mimeHeader.getValue());
308:                    }
309:                }
310:                message.writeTo(outputStream);
311:
312:            }
313:
314:            public MimeHeaders getMimeHeaders(SOAPMessage message) {
315:                return message.getMimeHeaders();
316:            }
317:
318:            public Iterator getAttachments(SOAPMessage message) {
319:                return message.getAttachments();
320:            }
321:
322:            public Iterator getAttachment(SOAPMessage message,
323:                    MimeHeaders mimeHeaders) {
324:                return message.getAttachments(mimeHeaders);
325:            }
326:
327:            public AttachmentPart addAttachmentPart(SOAPMessage message,
328:                    DataHandler dataHandler) {
329:                AttachmentPart attachmentPart = message
330:                        .createAttachmentPart(dataHandler);
331:                message.addAttachmentPart(attachmentPart);
332:                return attachmentPart;
333:            }
334:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.