Java Doc for SOAPEnvelope.java in  » Web-Services-AXIS2 » saaj » javax » xml » soap » 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 » saaj » javax.xml.soap 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.xml.soap.SOAPEnvelope

All known Subclasses:   org.apache.axis2.saaj.SOAPEnvelopeImpl,
SOAPEnvelope
public interface SOAPEnvelope extends SOAPElement(Code)
The container for the SOAPHeader and SOAPBody portions of a SOAPPart object. By default, a SOAPMessage object is created with a SOAPPart object that has a SOAPEnvelope object. The SOAPEnvelope object by default has an empty SOAPBody object and an empty SOAPHeader object. The SOAPBody object is required, and the SOAPHeader object, though optional, is used in the majority of cases. If the SOAPHeader object is not needed, it can be deleted, which is shown later.

A client can access the SOAPHeader and SOAPBody objects by calling the methods SOAPEnvelope.getHeader and SOAPEnvelope.getBody. The following lines of code use these two methods after starting with the SOAPMessage object message to get the SOAPPart object sp, which is then used to get the SOAPEnvelope object se.

 SOAPPart sp =
 message.getSOAPPart(); SOAPEnvelope se = sp.getEnvelope(); SOAPHeader sh = se.getHeader();
 SOAPBody sb = se.getBody(); 

It is possible to change the body or header of a SOAPEnvelope object by retrieving the current one, deleting it, and then adding a new body or header. The javax.xml.soap.Node method detachNode detaches the XML element (node) on which it is called. For example, the following line of code deletes the SOAPBody object that is retrieved by the method getBody.

 se.getBody().detachNode(); 
To create a SOAPHeader object to replace the one that was removed, a client uses the method SOAPEnvelope.addHeaderBlock, which creates a new header and adds it to the SOAPEnvelope object. Similarly, the method addBody creates a new SOAPBody object and adds it to the SOAPEnvelope object. The following code fragment retrieves the current header, removes it, and adds a new one. Then it retrieves the current body, removes it, and adds a new one.
 SOAPPart sp = message.getSOAPPart(); SOAPEnvelope se = sp.getEnvelope();
 se.getHeader().detachNode(); SOAPHeader sh = se.addHeaderBlock(); se.getBody().detachNode();
 SOAPBody sb = se.addBody(); 
It is an error to add a SOAPBody or SOAPHeader object if one already exists.

The SOAPEnvelope interface provides three methods for creating Name objects. One method creates Name objects with a local name, a namespace prefix, and a namesapce URI. The second method creates Name objects with a local name and a namespace prefix, and the third creates Name objects with just a local name. The following line of code, in which se is a SOAPEnvelope object, creates a new Name object with all three.

 Name name = se.createName("GetLastTradePrice",
 "WOMBAT", "http://www.wombat.org/trader"); 




Method Summary
abstract public  SOAPBodyaddBody()
     Creates a SOAPBody object and sets it as the SOAPBody object for this SOAPEnvelope object.

It is illegal to add a body when the envelope already contains a body.

abstract public  SOAPHeaderaddHeader()
     Creates a SOAPHeader object and sets it as the SOAPHeader object for this SOAPEnvelope object.

It is illegal to add a header when the envelope already contains a header.

abstract public  NamecreateName(String localName, String prefix, String uri)
     Creates a new Name object initialized with the given local name, namespace prefix, and namespace URI.
abstract public  NamecreateName(String localName)
     Creates a new Name object initialized with the given local name.
abstract public  SOAPBodygetBody()
     Returns the SOAPBody object associated with this SOAPEnvelope object.

A new SOAPMessage object is by default created with a SOAPEnvelope object that contains an empty SOAPBody object.

abstract public  SOAPHeadergetHeader()
     Returns the SOAPHeader object for this SOAPEnvelope object.

A new SOAPMessage object is by default created with a SOAPEnvelope object that contains an empty SOAPHeader object.




Method Detail
addBody
abstract public SOAPBody addBody() throws SOAPException(Code)
Creates a SOAPBody object and sets it as the SOAPBody object for this SOAPEnvelope object.

It is illegal to add a body when the envelope already contains a body. Therefore, this method should be called only after the existing body has been removed. the new SOAPBody object
throws:
  SOAPException - if this SOAPEnvelope object already contains a validSOAPBody object




addHeader
abstract public SOAPHeader addHeader() throws SOAPException(Code)
Creates a SOAPHeader object and sets it as the SOAPHeader object for this SOAPEnvelope object.

It is illegal to add a header when the envelope already contains a header. Therefore, this method should be called only after the existing header has been removed. the new SOAPHeader object
throws:
  SOAPException - if this SOAPEnvelope object already contains a validSOAPHeader object




createName
abstract public Name createName(String localName, String prefix, String uri) throws SOAPException(Code)
Creates a new Name object initialized with the given local name, namespace prefix, and namespace URI.

This factory method creates Name objects for use in the SOAP/XML document.
Parameters:
  localName - a String giving the local name
Parameters:
  prefix - a String giving the prefix of the namespace
Parameters:
  uri - a String giving the URI of the namespace a Name object initialized with the given local name, namespace prefix,and namespace URI
throws:
  SOAPException - if there is a SOAP error




createName
abstract public Name createName(String localName) throws SOAPException(Code)
Creates a new Name object initialized with the given local name.

This factory method creates Name objects for use in the SOAP/XML document.
Parameters:
  localName - a String giving the local name a Name object initialized with the given local name
throws:
  SOAPException - if there is a SOAP error




getBody
abstract public SOAPBody getBody() throws SOAPException(Code)
Returns the SOAPBody object associated with this SOAPEnvelope object.

A new SOAPMessage object is by default created with a SOAPEnvelope object that contains an empty SOAPBody object. As a result, the method getBody will always return a SOAPBody object unless the body has been removed and a new one has not been added. the SOAPBody object for this SOAPEnvelope object ornull if there is none
throws:
  SOAPException - if there is a problem obtaining the SOAPBody object




getHeader
abstract public SOAPHeader getHeader() throws SOAPException(Code)
Returns the SOAPHeader object for this SOAPEnvelope object.

A new SOAPMessage object is by default created with a SOAPEnvelope object that contains an empty SOAPHeader object. As a result, the method getHeader will always return a SOAPHeader object unless the header has been removed and a new one has not been added. the SOAPHeader object or null if there is none
throws:
  SOAPException - if there is a problem obtaining the SOAPHeader object




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.