
Full Answer
What is an element in DOM?
An element has a collection of children, attributes, and namespace declarations. In contrast with DOM, this interface exposes namespace declarations separately from the attributes.
What is Axiom serialization?
During serialization, Axi om will automatically repair any namespace inconsistencies. It will add necessary namespace declarations to the output document where they are missing in the object model and generate modified namespace declarations where the original ones in the object model are inconsistent. It will also omit redundant namespace declarations. Axiom guarantees that in the output document, every element and attribute (and OMText instance with a QName value) will have the same namespace URI as in the object model, thus preserving the intended semantics of the document. On the other hand, the namespace prefixes used in the output document may differ from the ones in the object model.
What does changing the namespace URI and prefix of the element information item do?
In addition to changing the namespace URI and prefix of the element information item, this method ensures that a corresponding namespace declaration exists. If no corresponding namespace declaration is already in scope, then a new one will be added to this element.
What is QName in XML?
Resolves a QName literal in the namespace context defined by this element and produces a corresponding QName object. The implementation uses the algorithm defined by the XML Schema specification. In particular, the namespace for an unprefixed QName is the default namespace (not the null namespace), i.e. QNames are resolved in the same way as element names.
What happens if an element is created with a namespace?
If the element is created with a namespace and no matching namespace declaration is in scope in the location in the tree where the element is created, then an appropriate namespace declaration will be automatically added to the newly created element. The exact rules depend on the method chosen to create the element; see for example OMFactory.createOMElement (QName) .
Does Axiom enforce namespace well formedness?
Thus, creating a new element or adding an attribute preserves the consistency of the object model with respect to namespaces. However, Axiom does not enforce namespace well-formedness for all possible operations on the object model. E.g. moving an element from one location in the tree to another one may cause the object model to loose its namespace well-formedness. In that case it is possible that the object model contains elements or attributes with namespaces for which no corresponding namespace declarations are in scope.
Does loosing namespace well-formedness have a limited impact?
Fortunately, loosing namespace well-formedness has only very limited impact:
How does Axis2 work?
Axis2 automatically identifies SwA messages based on the content type. Axis2 stores the references on the received attachment parts (MIME parts) in the Message Context. Axis2 preserves the order of the received attachments when storing them in the MessageContext. Users can access binary attachments using the attachement API given in the Message Context using the content-id of the mime part as the key. Care needs be taken to rip off the "cid" prefix when content-id is taken from the "Href" attributes. Users can access the message context from whithin a service implementation class using the "setOperationContext ()" method as shown in the following example.
What is Axis2 data handler?
Axis2 uses javax.activation.DataHandler to handle the binary data. All the optimized binary content nodes will be serialized as Base64 Strings if "MTOM is not enabled". You can also create binary content nodes, which will not be optimized at any case. They will be serialized and sent as Base64 Strings.
What is a MTOM?
MTOM (SOAP Message Transmission Optimization Mechanism) is another specification that focuses on solving the "Attachments" problem. MTOM tries to leverage the advantages of the above two techniques by trying to merge the two techniques. MTOM is actually a "by reference" method. The wire format of a MTOM optimized message is the same as the SOAP with Attachments message, which also makes it backward compatible with SwA endpoints. The most notable feature of MTOM is the use of the XOP:Include element, which is defined in the XML Binary Optimized Packaging (XOP) specification to reference the binary attachments (external unparsed general entities) of the message. With the use of this exclusive element, the attached binary content logically becomes inline (by value) with the SOAP document even though it is actually attached separately. This merges the two realms by making it possible to work only with one data model. This allows the applications to process and describe by only looking at the XML part, making the reliance on DTDs obsolete. On a lighter note, MTOM has standardized the referencing mechanism of SwA. The following is an extract from the XOP specification.
What is MTOM in SOAP?
MTOM allows to selectively encode portions of the message, which allows us to send base64encoded data as well as externally attached raw binary data referenced by the "XOP" element (optimized content) to be sent in a SOAP message . You can specify whether an OMText node that contains raw binary data or base64encoded binary data is qualified to be optimized at the time of construction of that node or later. For optimum efficiency of MTOM, a user is advised to send smaller binary attachments using base64encoding (non-optimized) and larger attachments as optimized content.
How to enable mtm globally?
To enableMTOM globally for all services, users can set the "enableMTOM" parameter to True in the Axis2.xml. When it is set, all outgoing messages will be serialized and sent as MTOM optimized MIME messages. If it is not set, all the binary data in the binary content nodes will be serialized as Base64 encoded strings. This configuration can be overriden in services.xml on the basis of per service and per operation.
What is opaque XML?
XML supports opaque data as content through the use of either base64 or hexadecimal text encoding. Both techniques bloat the size of the data. For UTF-8 underlying text encoding, base64 encoding increases the size of the binary data by a factor of 1.33x of the original size, while hexadecimal encoding expands data by a factor of 2x. The above factors will be doubled if UTF-16 text encoding is used. Also of concern is the overhead in processing costs (both real and perceived) for these formats, especially when decoding back into raw binary.
Does Axis2 have to specify anything?
The user does not have to specify anything in order for Axis2 to receive MTOM optimised messages. Axis2 will automatically identify and de-serialize accordingly, as and when an MTOM message arrives.
