Source Code Cross Referenced for SwaBindingImpl.java in  » J2EE » enhydra » samples » swa » 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 » enhydra » samples.swa 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * SwaBindingImpl.java
003:         *
004:         * This file was auto-generated from WSDL
005:         * by the Apache Axis 1.2alpha Dec 07, 2003 (08:01:12 EST) WSDL2Java emitter.
006:         */package samples.swa;
007:
008:        import org.apache.axis.AxisFault;
009:        import org.apache.axis.Message;
010:        import org.apache.axis.MessageContext;
011:        import org.apache.axis.attachments.AttachmentPart;
012:        import org.apache.axis.attachments.Attachments;
013:
014:        import javax.activation.DataHandler;
015:        import javax.mail.internet.MimeBodyPart;
016:        import java.util.Iterator;
017:
018:        /**
019:         * Class SwaBindingImpl
020:         * 
021:         * @version %I%, %G%
022:         */
023:        public class SwaBindingImpl implements  samples.swa.SwaPort {
024:
025:            /**
026:             * Method swaSend
027:             * 
028:             * @param applicationName 
029:             * @param content         
030:             * @return 
031:             * @throws java.rmi.RemoteException 
032:             */
033:            public java.lang.String swaSend(java.lang.String applicationName,
034:                    javax.mail.internet.MimeMultipart content)
035:                    throws java.rmi.RemoteException {
036:
037:                MimeBodyPart mpb = null;
038:
039:                System.out.println("Application: " + applicationName);
040:
041:                /*
042:                 * Now do some printing to get information about the multipart
043:                 * content and the associated attachments.  Axis performs
044:                 * several steps during deserialization of this SOAP
045:                 * call. Only the steps of interesst are described here.
046:                 *
047:                 * The MIME multipart that contains the other parts (because
048:                 * it's multipart/mixed or multipart/related) is handled as
049:                 * ONE Axis attachment during the first part of
050:                 * deserialization. This attachment is identified by the CID:
051:                 * prefixed string generated during serialization.
052:                 *
053:                 * The next step (see
054:                 * MimeMultipartDataHandlerDeserializer.java) gets the data
055:                 * handler of the Axis attachment and creates a MimeMultipart
056:                 * object using the data source as input of the new
057:                 * MimeMultipart object. The MimeMultipart object parses the
058:                 * input (on demand? -> this need to be clarified) and builds
059:                 * the associated body parts.
060:                 *
061:                 * The Axis attachment part is not disposed or otherwise
062:                 * managed after it was serialized into the MimeMultipart
063:                 * object. Therefore it is a good idea to call the dispose()
064:                 * method of the Axis attachment part after processing is
065:                 * complete.  Doing so releases all used resources, also
066:                 * deleting disk cache files if necessary, of this attachment
067:                 * part.
068:                 */
069:                try {
070:                    int contCount = content.getCount();
071:
072:                    System.out.println("Number of Mimeparts: " + contCount);
073:
074:                    for (int i = 0; i < contCount; i++) {
075:                        mpb = (MimeBodyPart) content.getBodyPart(i);
076:
077:                        DataHandler dh = mpb.getDataHandler();
078:
079:                        System.out.println("Mime data type: "
080:                                + dh.getContentType());
081:                    }
082:                } catch (javax.mail.MessagingException ex) {
083:                }
084:
085:                /*
086:                 * the next prints are just for information only
087:                 */
088:                AttachmentPart[] attParts = getMessageAttachments();
089:
090:                System.out
091:                        .println("Number of attachements: " + attParts.length);
092:
093:                if (attParts.length > 0) {
094:                    try {
095:                        System.out.println("Att[0] type: "
096:                                + attParts[0].getContentType());
097:                        System.out
098:                                .println("Att[0] dh type: "
099:                                        + attParts[0].getDataHandler()
100:                                                .getContentType());
101:                        System.out.println("Att[0] file: "
102:                                + attParts[0].getAttachmentFile());
103:                    } catch (javax.xml.soap.SOAPException ex) {
104:                    }
105:                }
106:
107:                /*
108:                 * Now process the parametes including the MimeMultipart
109:                 */
110:
111:                /*
112:                 * Processing is done, now dispose the attachements. This is not done
113:                 * by Axis, should be done by service.
114:                 */
115:                MessageContext msgContext = MessageContext.getCurrentContext();
116:                Message reqMsg = msgContext.getRequestMessage();
117:                Attachments messageAttachments = reqMsg.getAttachmentsImpl();
118:
119:                messageAttachments.dispose();
120:
121:                return null;
122:            }
123:
124:            /**
125:             * extract attachments from the current request
126:             * 
127:             * @return a list of attachmentparts or
128:             *         an empty array for no attachments support in this axis
129:             *         buid/runtime
130:             * @throws AxisFault 
131:             */
132:            private AttachmentPart[] getMessageAttachments() throws AxisFault {
133:
134:                MessageContext msgContext = MessageContext.getCurrentContext();
135:                Message reqMsg = msgContext.getRequestMessage();
136:                Attachments messageAttachments = reqMsg.getAttachmentsImpl();
137:                int attachmentCount = messageAttachments.getAttachmentCount();
138:                AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
139:                Iterator it = messageAttachments.getAttachments().iterator();
140:                int count = 0;
141:
142:                while (it.hasNext()) {
143:                    AttachmentPart part = (AttachmentPart) it.next();
144:                    attachments[count++] = part;
145:                }
146:                return attachments;
147:            }
148:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.