Gary D. Gregory created CXF-4535:
------------------------------------
Summary: SOAP fault XML is invalid when a details element exists
Key: CXF-4535
URL: https://issues.apache.org/jira/browse/CXF-4535
Project: CXF
Issue Type: Bug
Affects Versions: 2.6.2
Environment: 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"
Reporter: Gary D. Gregory
If you add a details element to a SOAP fault, you will get invalid XML.
For example, this code:
{code:java}
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);
{code}
Produces XML like:
{code:xml}
<?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>
{code}
Instead of:
{code:xml}
<?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>
{code}
The {{detail}} element MUST be last.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira