## Uses of Class
javax.xml.soap.SOAPException

- Packages that use SOAPException
  Package | Description
  --- | ---
  javax.xml.soap | Provides the API for creating and building SOAP messages.

- - ### Uses of SOAPException in javax.xml.soap

    Methods in javax.xml.soap that throw SOAPException
    Modifier and Type | Method | Description
    --- | --- | ---
    `SOAPElement` | SOAPElement.`addAttribute(Name name, String value)` Adds an attribute with the specified name and value to this `SOAPElement` object.
    `SOAPElement` | SOAPElement.`addAttribute(QName qname, String value)` Adds an attribute with the specified name and value to this `SOAPElement` object.
    `SOAPBody` | SOAPEnvelope.`addBody()` Creates a `SOAPBody` object and sets it as the `SOAPBody` object for this `SOAPEnvelope` object.
    `SOAPBodyElement` | SOAPBody.`addBodyElement(Name name)` Creates a new `SOAPBodyElement` object with the specified name and adds it to this `SOAPBody` object.
    `SOAPBodyElement` | SOAPBody.`addBodyElement(QName qname)` Creates a new `SOAPBodyElement` object with the specified QName and adds it to this `SOAPBody` object.
    `SOAPElement` | SOAPElement.`addChildElement(Name name)` Creates a new `SOAPElement` object initialized with the given `Name` object and adds the new element to this `SOAPElement` object.
    `SOAPElement` | SOAPElement.`addChildElement(QName qname)` Creates a new `SOAPElement` object initialized with the given `QName` object and adds the new element to this `SOAPElement` object.
    `SOAPElement` | SOAPElement.`addChildElement(SOAPElement element)` Add a `SOAPElement` as a child of this `SOAPElement` instance.
    `SOAPElement` | SOAPElement.`addChildElement(String localName)` Creates a new `SOAPElement` object initialized with the specified local name and adds the new element to this `SOAPElement` object.
    `SOAPElement` | SOAPElement.`addChildElement(String localName, String prefix)` Creates a new `SOAPElement` object initialized with the specified local name and prefix and adds the new element to this `SOAPElement` object.
    `SOAPElement` | SOAPElement.`addChildElement(String localName, String prefix, String uri)` Creates a new `SOAPElement` object initialized with the specified local name, prefix, and URI and adds the new element to this `SOAPElement` object.
    `Detail` | SOAPFault.`addDetail()` Creates an optional `Detail` object and sets it as the `Detail` object for this `SOAPFault` object.
    `DetailEntry` | Detail.`addDetailEntry(Name name)` Creates a new `DetailEntry` object with the given name and adds it to this `Detail` object.
    `DetailEntry` | Detail.`addDetailEntry(QName qname)` Creates a new `DetailEntry` object with the given QName and adds it to this `Detail` object.
    `SOAPBodyElement` | SOAPBody.`addDocument(Document document)` Adds the root node of the DOM ``Document`` to this `SOAPBody` object.
    `SOAPFault` | SOAPBody.`addFault()` Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
    `SOAPFault` | SOAPBody.`addFault(Name faultCode, String faultString)` Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
    `SOAPFault` | SOAPBody.`addFault(Name faultCode, String faultString, Locale locale)` Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
    `SOAPFault` | SOAPBody.`addFault(QName faultCode, String faultString)` Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
    `SOAPFault` | SOAPBody.`addFault(QName faultCode, String faultString, Locale locale)` Creates a new `SOAPFault` object and adds it to this `SOAPBody` object.
    `void` | SOAPFault.`addFaultReasonText(String text, Locale locale)` Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived from `locale`.
    `SOAPHeader` | SOAPEnvelope.`addHeader()` Creates a `SOAPHeader` object and sets it as the `SOAPHeader` object for this `SOAPEnvelope` object.
    `SOAPHeaderElement` | SOAPHeader.`addHeaderElement(Name name)` Creates a new `SOAPHeaderElement` object initialized with the specified name and adds it to this `SOAPHeader` object.
    `SOAPHeaderElement` | SOAPHeader.`addHeaderElement(QName qname)` Creates a new `SOAPHeaderElement` object initialized with the specified qname and adds it to this `SOAPHeader` object.
    `SOAPElement` | SOAPElement.`addNamespaceDeclaration(String prefix, String uri)` Adds a namespace declaration with the specified prefix and URI to this `SOAPElement` object.
    `SOAPHeaderElement` | SOAPHeader.`addNotUnderstoodHeaderElement(QName name)` Creates a new NotUnderstood `SOAPHeaderElement` object initialized with the specified name and adds it to this `SOAPHeader` object.
    `SOAPElement` | SOAPElement.`addTextNode(String text)` Creates a new `Text` object initialized with the given `String` and adds it to this `SOAPElement` object.
    `SOAPHeaderElement` | SOAPHeader.`addUpgradeHeaderElement(Iterator supportedSOAPURIs)` Creates a new Upgrade `SOAPHeaderElement` object initialized with the specified List of supported SOAP URIs and adds it to this `SOAPHeader` object.
    `SOAPHeaderElement` | SOAPHeader.`addUpgradeHeaderElement(String supportedSoapUri)` Creates a new Upgrade `SOAPHeaderElement` object initialized with the specified supported SOAP URI and adds it to this `SOAPHeader` object.
    `SOAPHeaderElement` | SOAPHeader.`addUpgradeHeaderElement(String[] supportedSoapUris)` Creates a new Upgrade `SOAPHeaderElement` object initialized with the specified array of supported SOAP URIs and adds it to this `SOAPHeader` object.
    `void` | SOAPFault.`appendFaultSubcode(QName subcode)` Adds a Subcode to the end of the sequence of Subcodes contained by this `SOAPFault`.
    `abstract SOAPMessage` | SOAPConnection.`call(SOAPMessage request, Object to)` Sends the given message to the specified endpoint and blocks until it has returned the response.
    `abstract void` | SOAPConnection.`close()` Closes this `SOAPConnection` object.
    `SOAPElement` | SOAPElementFactory.`create(Name name)` Deprecated. Use javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name) instead
    `SOAPElement` | SOAPElementFactory.`create(String localName)` Deprecated. Use javax.xml.soap.SOAPFactory.createElement(String localName) instead
    `SOAPElement` | SOAPElementFactory.`create(String localName, String prefix, String uri)` Deprecated. Use javax.xml.soap.SOAPFactory.createElement(String localName, String prefix, String uri) instead
    `abstract SOAPConnection` | SOAPConnectionFactory.`createConnection()` Create a new `SOAPConnection`.
    `abstract Detail` | SOAPFactory.`createDetail()` Creates a new `Detail` object which serves as a container for `DetailEntry` objects.
    `SOAPElement` | SOAPFactory.`createElement(Element domElement)` Creates a `SOAPElement` object from an existing DOM `Element`.
    `abstract SOAPElement` | SOAPFactory.`createElement(Name name)` Creates a `SOAPElement` object initialized with the given `Name` object.
    `SOAPElement` | SOAPFactory.`createElement(QName qname)` Creates a `SOAPElement` object initialized with the given `QName` object.
    `abstract SOAPElement` | SOAPFactory.`createElement(String localName)` Creates a `SOAPElement` object initialized with the given local name.
    `abstract SOAPElement` | SOAPFactory.`createElement(String localName, String prefix, String uri)` Creates a new `SOAPElement` object with the given local name, prefix and uri.
    `abstract SOAPFault` | SOAPFactory.`createFault()` Creates a new default `SOAPFault` object
    `abstract SOAPFault` | SOAPFactory.`createFault(String reasonText, QName faultCode)` Creates a new `SOAPFault` object initialized with the given `reasonText` and `faultCode`
    `abstract SOAPMessage` | MessageFactory.`createMessage()` Creates a new `SOAPMessage` object with the default `SOAPPart`, `SOAPEnvelope`, `SOAPBody`, and `SOAPHeader` objects.
    `abstract SOAPMessage` | MessageFactory.`createMessage(MimeHeaders headers, InputStream in)` Internalizes the contents of the given `InputStream` object into a new `SOAPMessage` object and returns the `SOAPMessage` object.
    `abstract Name` | SOAPFactory.`createName(String localName)` Creates a new `Name` object initialized with the given local name.
    `Name` | SOAPEnvelope.`createName(String localName)` Creates a new `Name` object initialized with the given local name.
    `abstract Name` | SOAPFactory.`createName(String localName, String prefix, String uri)` Creates a new `Name` object initialized with the given local name, namespace prefix, and namespace URI.
    `Name` | SOAPEnvelope.`createName(String localName, String prefix, String uri)` Creates a new `Name` object initialized with the given local name, namespace prefix, and namespace URI.
    `QName` | SOAPElement.`createQName(String localName, String prefix)` Creates a `QName` whose namespace URI is the one associated with the parameter, `prefix`, in the context of this `SOAPElement`.
    `Document` | SOAPBody.`extractContentAsDocument()` Creates a new DOM ``Document`` and sets the first child of this `SOAPBody` as it's document element.
    `SOAPMessage` | SOAPConnection.`get(Object to)` Gets a message from a specific endpoint and blocks until it receives,
    `abstract AttachmentPart` | SOAPMessage.`getAttachment(SOAPElement element)` Returns an `AttachmentPart` object that is associated with an attachment that is referenced by this `SOAPElement` or `null` if no such attachment exists.
    `abstract InputStream` | AttachmentPart.`getBase64Content()` Returns an `InputStream` which can be used to obtain the content of `AttachmentPart` as Base64 encoded character data, this method would base64 encode the raw bytes of the attachment and return.
    `SOAPBody` | SOAPEnvelope.`getBody()` Returns the `SOAPBody` object associated with this `SOAPEnvelope` object.
    `abstract Object` | AttachmentPart.`getContent()` Gets the content of this `AttachmentPart` object as a Java object.
    `abstract Source` | SOAPPart.`getContent()` Returns the content of the SOAPEnvelope as a JAXP `Source` object.
    `abstract DataHandler` | AttachmentPart.`getDataHandler()` Gets the `DataHandler` object for this `AttachmentPart` object.
    `abstract SOAPEnvelope` | SOAPPart.`getEnvelope()` Gets the `SOAPEnvelope` object associated with this `SOAPPart` object.
    `Iterator` | SOAPFault.`getFaultReasonLocales()` Returns an `Iterator` over a distinct sequence of `Locale`s for which there are associated Reason Text items.
    `String` | SOAPFault.`getFaultReasonText(Locale locale)` Returns the Reason Text associated with the given `Locale`.
    `Iterator` | SOAPFault.`getFaultReasonTexts()` Returns an `Iterator` over a sequence of `String` objects containing all of the Reason Text items for this `SOAPFault`.
    `SOAPHeader` | SOAPEnvelope.`getHeader()` Returns the `SOAPHeader` object for this `SOAPEnvelope` object.
    `Object` | SOAPMessage.`getProperty(String property)` Retrieves value of the specified property.
    `abstract InputStream` | AttachmentPart.`getRawContent()` Gets the content of this `AttachmentPart` object as an InputStream as if a call had been made to `getContent` and no `DataContentHandler` had been registered for the `content-type` of this `AttachmentPart`.
    `abstract byte[]` | AttachmentPart.`getRawContentBytes()` Gets the content of this `AttachmentPart` object as a byte[] array as if a call had been made to `getContent` and no `DataContentHandler` had been registered for the `content-type` of this `AttachmentPart`.
    `abstract int` | AttachmentPart.`getSize()` Returns the number of bytes in this `AttachmentPart` object.
    `SOAPBody` | SOAPMessage.`getSOAPBody()` Gets the SOAP Body contained in this `SOAPMessage` object.
    `SOAPHeader` | SOAPMessage.`getSOAPHeader()` Gets the SOAP Header contained in this `SOAPMessage` object.
    `static SOAPElementFactory` | SOAPElementFactory.`newInstance()` Deprecated. Creates a new instance of `SOAPElementFactory`.
    `static SOAPConnectionFactory` | SOAPConnectionFactory.`newInstance()` Creates an instance of the default `SOAPConnectionFactory` object.
    `static SOAPFactory` | SOAPFactory.`newInstance()` Creates a new `SOAPFactory` object that is an instance of the default implementation (SOAP 1.1), This method uses the following ordered lookup procedure to determine the SOAPFactory implementation class to load: Use the javax.xml.soap.SOAPFactory system property.
    `static MessageFactory` | MessageFactory.`newInstance()` Creates a new `MessageFactory` object that is an instance of the default implementation (SOAP 1.1), This method uses the following ordered lookup procedure to determine the MessageFactory implementation class to load: Use the javax.xml.soap.MessageFactory system property.
    `static SOAPFactory` | SOAPFactory.`newInstance(String protocol)` Creates a new `SOAPFactory` object that is an instance of the specified implementation, this method uses the SAAJMetaFactory to locate the implementation class and create the SOAPFactory instance.
    `static MessageFactory` | MessageFactory.`newInstance(String protocol)` Creates a new `MessageFactory` object that is an instance of the specified implementation.
    `protected abstract MessageFactory` | SAAJMetaFactory.`newMessageFactory(String protocol)` Creates a `MessageFactory` object for the given `String` protocol.
    `protected abstract SOAPFactory` | SAAJMetaFactory.`newSOAPFactory(String protocol)` Creates a `SOAPFactory` object for the given `String` protocol.
    `abstract void` | SOAPMessage.`saveChanges()` Updates this `SOAPMessage` object with all the changes that have been made to it.
    `abstract void` | AttachmentPart.`setBase64Content(InputStream content, String contentType)` Sets the content of this attachment part from the Base64 source `InputStream` and sets the value of the `Content-Type` header to the value contained in `contentType`, This method would first decode the base64 input and write the resulting raw bytes to the attachment.
    `abstract void` | SOAPPart.`setContent(Source source)` Sets the content of the `SOAPEnvelope` object with the data from the given `Source` object.
    `SOAPElement` | SOAPElement.`setElementQName(QName newName)` Changes the name of this `Element` to `newName` if possible.
    `void` | SOAPElement.`setEncodingStyle(String encodingStyle)` Sets the encoding style for this `SOAPElement` object to one specified.
    `void` | SOAPFault.`setFaultActor(String faultActor)` Sets this `SOAPFault` object with the given fault actor.
    `void` | SOAPFault.`setFaultCode(Name faultCodeQName)` Sets this `SOAPFault` object with the given fault code.
    `void` | SOAPFault.`setFaultCode(QName faultCodeQName)` Sets this `SOAPFault` object with the given fault code.
    `void` | SOAPFault.`setFaultCode(String faultCode)` Sets this `SOAPFault` object with the give fault code.
    `void` | SOAPFault.`setFaultNode(String uri)` Creates or replaces any existing Node element value for this `SOAPFault` object.
    `void` | SOAPFault.`setFaultRole(String uri)` Creates or replaces any existing Role element value for this `SOAPFault` object.
    `void` | SOAPFault.`setFaultString(String faultString)` Sets the fault string for this `SOAPFault` object to the given string.
    `void` | SOAPFault.`setFaultString(String faultString, Locale locale)` Sets the fault string for this `SOAPFault` object to the given string and localized to the given locale.
    `void` | Node.`setParentElement(SOAPElement parent)` Sets the parent of this `Node` object to the given `SOAPElement` object.
    `void` | SOAPMessage.`setProperty(String property, Object value)` Associates the specified value with the specified property.
    `abstract void` | AttachmentPart.`setRawContent(InputStream content, String contentType)` Sets the content of this attachment part to that contained by the `InputStream` `content` and sets the value of the `Content-Type` header to the value contained in `contentType`.
    `abstract void` | AttachmentPart.`setRawContentBytes(byte[] content, int offset, int len, String contentType)` Sets the content of this attachment part to that contained by the `byte[]` array `content` and sets the value of the `Content-Type` header to the value contained in `contentType`.
    `void` | SOAPHeaderElement.`setRelay(boolean relay)` Sets the relay attribute for this `SOAPHeaderElement` to be either true or false.
    `void` | SOAPHeaderElement.`setRole(String uri)` Sets the `Role` associated with this `SOAPHeaderElement` object to the specified `Role`.
    `abstract void` | SOAPMessage.`writeTo(OutputStream out)` Writes this `SOAPMessage` object to the given output stream.

    Constructors in javax.xml.soap that throw SOAPException
    Constructor | Description
    --- | ---
    `SAAJResult()` Creates a `SAAJResult` that will present results in the form of a SAAJ tree that supports the default (SOAP 1.1) protocol.
    `SAAJResult(String protocol)` Creates a `SAAJResult` that will present results in the form of a SAAJ tree that supports the specified protocol.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.