How to format a List correctly in CXF Response ?
Issue
- User is using
CXFcxf:cxfEndpointcomponent for service invocation. User response object contains List of error data which is not getting marshaled correctly in XML response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:sfdcAccountGetResponse xmlns:ns1="http://xxx.yyy.zzz.com/">
<ns2:return xmlns:ns2="http://xxx.yyy.zzz.com/">
<status>Failure</status>
<irinaErrorList>
<errorMessage>MALFORMED_ID: bad id 001S000000hJ@NLc</errorMessage>
<errorLevel>Error</errorLevel>
<errorComponent>salesforceIntegration</errorComponent>
<errorCode>7000</errorCode>
</irinaErrorList>
<irinaErrorList>
<errorMessage>MALFORMED_ID: bad id 001S000000hJ@NLc</errorMessage>
<errorLevel>Error</errorLevel>
<errorComponent>salesforceIntegration</errorComponent>
<errorCode>7000</errorCode>
</irinaErrorList>
</ns2:return>
</ns1:sfdcAccountGetResponse>
</soap:Body>
</soap:Envelope>
- Expected result is
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:sfdcAccountGetResponse xmlns:ns1="http://xxx.yyy.zzz.com/">
<ns2:return xmlns:ns2="http://xxx.yyy.zzz.com/">
<status>Failure</status>
<irinaErrorList>
<esbErrorData>
<errorMessage>MALFORMED_ID: bad id 001S000000hJ@NLc</errorMessage>
<errorLevel>Error</errorLevel>
<errorComponent>salesforceIntegration</errorComponent>
<errorCode>7000</errorCode>
</esbErrorData>
<esbErrorData>
<errorMessage>MALFORMED_ID: bad id 001S000000hJ@NLc</errorMessage>
<errorLevel>Error</errorLevel>
<errorComponent>salesforceIntegration</errorComponent>
<errorCode>7000</errorCode>
</esbErrorData>
</irinaErrorList>
</ns2:return>
</ns1:sfdcAccountGetResponse>
</soap:Body>
</soap:Envelope>
- CXF component configuration
<cxf:cxfEndpoint id="salesforceEndpoint" address="/salesforce/" serviceClass="xxx.yyy.zzz.SalesforceService" >
<cxf:properties>
<entry key="faultStackTraceEnabled" value="true" />
<entry key="loggingFeatureEnabled" value="true" />
<entry key="wrapped" value="true" />
<entry key="dataFormat" value="POJO"/>
</cxf:properties>
</cxf:cxfEndpoint>
Environment
- Red Hat JBoss Fuse
- 6.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
