Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6.2
-
None
-
None
-
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\Java\apache-maven-3.0.4\bin\..
Java version: 1.6.0_35, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_35\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500) Maven home: C:\Java\apache-maven-3.0.4\bin\.. Java version: 1.6.0_35, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_35\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
-
Unknown
Description
If you add a details element to a SOAP fault, you will get invalid XML.
For example, this code:
final SoapFault fault = new SoapFault(shortMessage, Soap11.getInstance().getReceiver()); fault.setRole(operationName); final org.w3c.dom.Element detailElt = fault.getOrCreateDetail(); final Document ownerDocument = detailElt.getOwnerDocument(); final org.w3c.dom.Element longDescElt = ownerDocument.createElementNS(_TARGET_NAMESPACE, "longDescription"); final org.w3c.dom.Element errorCodeElt = ownerDocument.createElementNS(_TARGET_NAMESPACE, "ErrorCode"); longDescElt.setTextContent(longMessage);
Produces XML like:
<?xml version='1.0' encoding='UTF-8'?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <ais:requestID xmlns:ais="http://com.seagullsw.appinterface/AppInterfaceServer">{c0a80102-00ce16ad0000010e75da25398002}</ais:requestID> </soap:Header> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>blah.</faultstring> <detail> <longDescription xmlns="http://com.seagullsw.appinterface/AppInterfaceServer">blah blah.</longDescription> <ErrorCode xmlns="http://com.seagullsw.appinterface/AppInterfaceServer">-7</ErrorCode> </detail> <faultactor>test.exception</faultactor> </soap:Fault> </soap:Body> </soap:Envelope>
Instead of:
<?xml version='1.0' encoding='UTF-8'?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <ais:requestID xmlns:ais="http://com.seagullsw.appinterface/AppInterfaceServer">{c0a80102-00ce16ad0000010e75da25398002}</ais:requestID> </soap:Header> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>blah.</faultstring> <faultactor>test.exception</faultactor> <detail> <longDescription xmlns="http://com.seagullsw.appinterface/AppInterfaceServer">blah blah.</longDescription> <ErrorCode xmlns="http://com.seagullsw.appinterface/AppInterfaceServer">-7</ErrorCode> </detail> </soap:Fault> </soap:Body> </soap:Envelope>
The detail element MUST be last.