Package jakarta.xml.soap
Class SOAPFactory
- java.lang.Object
-
- jakarta.xml.soap.SOAPFactory
-
public abstract class SOAPFactory extends Object
SOAPFactoryis a factory for creating various objects that exist in the SOAP XML tree.SOAPFactorycan be used to create XML fragments that will eventually end up in the SOAP part. These fragments can be inserted as children of theSOAPHeaderElementorSOAPBodyElementorSOAPEnvelopeor otherSOAPElementobjects.SOAPFactoryalso has methods to createjakarta.xml.soap.Detailobjects as well asjava.xml.soap.Nameobjects.- Since:
- 1.6
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSOAPFactory()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DetailcreateDetail()Creates a newDetailobject which serves as a container forDetailEntryobjects.abstract SOAPElementcreateElement(Name name)Creates aSOAPElementobject initialized with the givenNameobject.abstract SOAPElementcreateElement(String localName)Creates aSOAPElementobject initialized with the given local name.abstract SOAPElementcreateElement(String localName, String prefix, String uri)Creates a newSOAPElementobject with the given local name, prefix and uri.SOAPElementcreateElement(QName qname)Creates aSOAPElementobject initialized with the givenQNameobject.SOAPElementcreateElement(Element domElement)Creates aSOAPElementobject from an existing DOMElement.abstract SOAPFaultcreateFault()Creates a new defaultSOAPFaultobjectabstract SOAPFaultcreateFault(String reasonText, QName faultCode)Creates a newSOAPFaultobject initialized with the givenreasonTextandfaultCodeabstract NamecreateName(String localName)Creates a newNameobject initialized with the given local name.abstract NamecreateName(String localName, String prefix, String uri)Creates a newNameobject initialized with the given local name, namespace prefix, and namespace URI.static SOAPFactorynewInstance()Creates a newSOAPFactoryobject that is an instance of the default implementation (SOAP 1.1).static SOAPFactorynewInstance(String protocol)Creates a newSOAPFactoryobject that is an instance of the specified implementation, this method uses the SAAJMetaFactory to locate the implementation class and create the SOAPFactory instance.
-
-
-
Method Detail
-
createElement
public SOAPElement createElement(Element domElement) throws SOAPException
Creates aSOAPElementobject from an existing DOMElement. If the DOMElementthat is passed in as an argument is already aSOAPElementthen this method must return it unmodified without any further work. Otherwise, a newSOAPElementis created and a deep copy is made of thedomElementargument. The concrete type of the return value will depend on the name of thedomElementargument. If any part of the tree rooted indomElementviolates SOAP rules, aSOAPExceptionwill be thrown.- Parameters:
domElement- theElementto be copied.- Returns:
- a new
SOAPElementthat is a copy ofdomElement. - Throws:
SOAPException- if there is an error in creating theSOAPElementobject- Since:
- 1.6, SAAJ 1.3
-
createElement
public abstract SOAPElement createElement(Name name) throws SOAPException
Creates aSOAPElementobject initialized with the givenNameobject. The concrete type of the return value will depend on the name given to the newSOAPElement. For instance, a newSOAPElementwith the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause aSOAPEnvelopethat supports SOAP 1.2 behavior to be created.- Parameters:
name- aNameobject with the XML name for the new element- Returns:
- the new
SOAPElementobject that was created - Throws:
SOAPException- if there is an error in creating theSOAPElementobject- See Also:
createElement(javax.xml.namespace.QName)
-
createElement
public SOAPElement createElement(QName qname) throws SOAPException
Creates aSOAPElementobject initialized with the givenQNameobject. The concrete type of the return value will depend on the name given to the newSOAPElement. For instance, a newSOAPElementwith the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause aSOAPEnvelopethat supports SOAP 1.2 behavior to be created.- Parameters:
qname- aQNameobject with the XML name for the new element- Returns:
- the new
SOAPElementobject that was created - Throws:
SOAPException- if there is an error in creating theSOAPElementobject- Since:
- 1.6, SAAJ 1.3
- See Also:
createElement(Name)
-
createElement
public abstract SOAPElement createElement(String localName) throws SOAPException
Creates aSOAPElementobject initialized with the given local name.- Parameters:
localName- aStringgiving the local name for the new element- Returns:
- the new
SOAPElementobject that was created - Throws:
SOAPException- if there is an error in creating theSOAPElementobject
-
createElement
public abstract SOAPElement createElement(String localName, String prefix, String uri) throws SOAPException
Creates a newSOAPElementobject with the given local name, prefix and uri. The concrete type of the return value will depend on the name given to the newSOAPElement. For instance, a newSOAPElementwith the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause aSOAPEnvelopethat supports SOAP 1.2 behavior to be created.- Parameters:
localName- aStringgiving the local name for the new elementprefix- the prefix for thisSOAPElementuri- aStringgiving the URI of the namespace to which the new element belongs- Returns:
- the new
SOAPElementobject that was created - Throws:
SOAPException- if there is an error in creating theSOAPElementobject
-
createDetail
public abstract Detail createDetail() throws SOAPException
Creates a newDetailobject which serves as a container forDetailEntryobjects.This factory method creates
Detailobjects for use in situations where it is not practical to use theSOAPFaultabstraction.- Returns:
- a
Detailobject - Throws:
SOAPException- if there is a SOAP errorUnsupportedOperationException- if the protocol specified for the SOAPFactory wasDYNAMIC_SOAP_PROTOCOL
-
createFault
public abstract SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException
Creates a newSOAPFaultobject initialized with the givenreasonTextandfaultCode- Parameters:
reasonText- the ReasonText/FaultString for the faultfaultCode- the FaultCode for the fault- Returns:
- a
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP errorIllegalArgumentException- ifreasonTextorfaultCodeis null- Since:
- 1.6, SAAJ 1.3
-
createFault
public abstract SOAPFault createFault() throws SOAPException
Creates a new defaultSOAPFaultobject- Returns:
- a
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error- Since:
- 1.6, SAAJ 1.3
-
createName
public abstract Name createName(String localName, String prefix, String uri) throws SOAPException
Creates a newNameobject initialized with the given local name, namespace prefix, and namespace URI.This factory method creates
Nameobjects for use in situations where it is not practical to use theSOAPEnvelopeabstraction.- Parameters:
localName- aStringgiving the local nameprefix- aStringgiving the prefix of the namespaceuri- aStringgiving the URI of the namespace- Returns:
- a
Nameobject initialized with the given local name, namespace prefix, and namespace URI - Throws:
SOAPException- if there is a SOAP error
-
createName
public abstract Name createName(String localName) throws SOAPException
Creates a newNameobject initialized with the given local name.This factory method creates
Nameobjects for use in situations where it is not practical to use theSOAPEnvelopeabstraction.- Parameters:
localName- aStringgiving the local name- Returns:
- a
Nameobject initialized with the given local name - Throws:
SOAPException- if there is a SOAP error
-
newInstance
public static SOAPFactory newInstance() throws SOAPException
Creates a newSOAPFactoryobject that is an instance of the default implementation (SOAP 1.1). This method uses the lookup procedure specified injakarta.xml.soapto locate and load theSOAPFactoryclass.- Returns:
- a new instance of a
SOAPFactory - Throws:
SOAPException- if there was an error creating the defaultSOAPFactory- See Also:
SAAJMetaFactory
-
newInstance
public static SOAPFactory newInstance(String protocol) throws SOAPException
Creates a newSOAPFactoryobject that is an instance of the specified implementation, this method uses the SAAJMetaFactory to locate the implementation class and create the SOAPFactory instance.- Parameters:
protocol- a string constant representing the protocol of the specified SOAP factory implementation. May be eitherDYNAMIC_SOAP_PROTOCOL,DEFAULT_SOAP_PROTOCOL(which is the same as)SOAP_1_1_PROTOCOL, orSOAP_1_2_PROTOCOL.- Returns:
- a new instance of a
SOAPFactory - Throws:
SOAPException- if there was an error creating the specifiedSOAPFactory- Since:
- 1.6, SAAJ 1.3
- See Also:
SAAJMetaFactory
-
-