Your question is basically meaningless. There is no such concept as "length" for a SOAP body, or more generally for an XML element. Here is one reason (among many others):
The Body
element in a SOAP message is in the namespace http://schemas.xmlsoap.org/soap/envelope/
(for SOAP 1.1) or http://www.w3.org/2003/05/soap-envelope
(for SOAP 1.2). If you use the toString
method to serialize the SOAPBody
instance to a string, Axiom will therefore generate a namespace declaration on the Body
element, so that the result is well formed with respect to namespaces. However, when the message is sent over the wire, the SOAP body will be the child of an Envelope
element which is in the same namespace. In that case, the namespace declaration will be generated on the Envelope
element and not repeated on the Body
element.
That means that the number of characters effectively taken by the Body
element depends on the context in which it is serialized.