Web / Apache Axiom Interview questions
What is the difference between SOAP 1.1 and SOAP 1.2 factories in Axiom?
SOAP11Factory and SOAP12Factory both implement SOAPFactory, but each produces structures correct for its respective SOAP version - the two protocol versions differ enough in namespace and fault structure that using the wrong one produces messages real SOAP stacks will reject.
| SOAP 1.1 (SOAP11Factory) | SOAP 1.2 (SOAP12Factory) |
| Envelope ns: http://schemas.xmlsoap.org/soap/envelope/ | Envelope ns: http://www.w3.org/2003/05/soap-envelope |
| Fault uses faultcode / faultstring elements | Fault uses structured Code / Reason elements |
| Header attribute: actor | Header attribute: role (plus additional relay semantics) |
Choosing the correct factory isn't a stylistic preference - a SOAP 1.2 client sending an envelope built with SOAP11Factory (or vice versa) will typically be rejected outright by a compliant endpoint due to the mismatched envelope namespace, since that namespace is effectively the version identifier itself.
In practice, the factory used is usually determined by the binding configured for a given Axis2 service or client, rather than picked ad hoc - but understanding the structural differences matters for correctly interpreting or constructing SOAP faults by hand.
More Related questions...