Source Code Cross Referenced for HeaderExample.java in  » IDE-Netbeans » usersguide » mypackage » 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 » IDE Netbeans » usersguide » mypackage 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2005 Sun Microsystems, Inc.  All rights reserved.  U.S.
003:         * Government Rights - Commercial software.  Government users are subject
004:         * to the Sun Microsystems, Inc. standard license agreement and
005:         * applicable provisions of the FAR and its supplements.  Use is subject
006:         * to license terms.
007:         *
008:         * This distribution may include materials developed by third parties.
009:         * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks
010:         * or registered trademarks of Sun Microsystems, Inc. in the U.S. and
011:         * other countries.
012:         *
013:         * Copyright (c) 2005 Sun Microsystems, Inc. Tous droits reserves.
014:         *
015:         * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel
016:         * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de
017:         * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions
018:         * en vigueur de la FAR (Federal Acquisition Regulations) et des
019:         * supplements a celles-ci.  Distribue par des licences qui en
020:         * restreignent l'utilisation.
021:         *
022:         * Cette distribution peut comprendre des composants developpes par des
023:         * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE
024:         * sont des marques de fabrique ou des marques deposees de Sun
025:         * Microsystems, Inc. aux Etats-Unis et dans d'autres pays.
026:         */
027:
028:        package mypackage;
029:
030:        import javax.xml.soap.*;
031:        import java.net.*;
032:        import java.util.*;
033:        import java.io.*;
034:
035:        public class HeaderExample {
036:            public static void main(String[] args) {
037:                try {
038:                    // two arguments are passed in from build.xml
039:                    if (args.length != 0) {
040:                        System.err.println("Usage: asant run");
041:                        System.exit(1);
042:                    }
043:
044:                    // Create message factory and SOAP factory
045:                    MessageFactory messageFactory = MessageFactory
046:                            .newInstance();
047:                    SOAPFactory soapFactory = SOAPFactory.newInstance();
048:
049:                    // Create a message
050:                    SOAPMessage message = messageFactory.createMessage();
051:
052:                    // Get the SOAP header from the message and 
053:                    //  add headers to it
054:                    SOAPHeader header = message.getSOAPHeader();
055:
056:                    String nameSpace = "ns";
057:                    String nameSpaceURI = "http://gizmos.com/NSURI";
058:
059:                    Name order = soapFactory.createName("orderDesk", nameSpace,
060:                            nameSpaceURI);
061:                    SOAPHeaderElement orderHeader = header
062:                            .addHeaderElement(order);
063:                    orderHeader.setActor("http://gizmos.com/orders");
064:
065:                    Name shipping = soapFactory.createName("shippingDesk",
066:                            nameSpace, nameSpaceURI);
067:                    SOAPHeaderElement shippingHeader = header
068:                            .addHeaderElement(shipping);
069:                    shippingHeader.setActor("http://gizmos.com/shipping");
070:
071:                    Name confirmation = soapFactory.createName(
072:                            "confirmationDesk", nameSpace, nameSpaceURI);
073:                    SOAPHeaderElement confirmationHeader = header
074:                            .addHeaderElement(confirmation);
075:                    confirmationHeader
076:                            .setActor("http://gizmos.com/confirmations");
077:
078:                    Name billing = soapFactory.createName("billingDesk",
079:                            nameSpace, nameSpaceURI);
080:                    SOAPHeaderElement billingHeader = header
081:                            .addHeaderElement(billing);
082:                    billingHeader.setActor("http://gizmos.com/billing");
083:
084:                    // Add header with mustUnderstand attribute
085:                    Name tName = soapFactory.createName("Transaction", "t",
086:                            "http://gizmos.com/orders");
087:
088:                    SOAPHeaderElement transaction = header
089:                            .addHeaderElement(tName);
090:                    transaction.setMustUnderstand(true);
091:                    transaction.addTextNode("5");
092:
093:                    // Get the SOAP body from the message but leave
094:                    // it empty
095:                    SOAPBody body = message.getSOAPBody();
096:
097:                    message.saveChanges();
098:
099:                    // Display the message that would be sent
100:                    System.out.println("\n----- Request Message ----\n");
101:                    message.writeTo(System.out);
102:
103:                    // Look at the headers
104:                    Iterator allHeaders = header.examineAllHeaderElements();
105:
106:                    while (allHeaders.hasNext()) {
107:                        SOAPHeaderElement headerElement = (SOAPHeaderElement) allHeaders
108:                                .next();
109:                        Name headerName = headerElement.getElementName();
110:                        System.out.println("\nHeader name is "
111:                                + headerName.getQualifiedName());
112:                        System.out.println("Actor is "
113:                                + headerElement.getActor());
114:                        System.out.println("mustUnderstand is "
115:                                + headerElement.getMustUnderstand());
116:                    }
117:                } catch (Exception ex) {
118:                    ex.printStackTrace();
119:                }
120:            }
121:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.