I'm developing an CXF web service in ServiceMix 4.2. In the web-service
output need to send an xml output in the body. I created cxf endpoint and
defined the routes to generate the output.
If the result have atleast two child elements under its root tag( CXFOutput
), the output XML will produce in a proper manner in the response soap
message body.
Sample :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
   <soap:Body>
      <getCompleteItemNumberResponse xmlns="
http://postmarque.proiam.com/ivrsnumber/ws/domain";>
         <OUTPUT><![CDATA[<?xml version=”1.0” encoding=”utf-8” ?>
                <CXFOutput Input_No = “123456789” Record_Count = “2”
Return_Code = “000” Return_Msg = “Success”>
                    < Item_No = “ER123456789SG”/>
                    < Item_No = “EA123456789FR”/>
                </CXFOutput>]]>
        </OUTPUT>
      </getCompleteItemNumberResponse>
   </soap:Body>
</soap:Envelope>

But the result XML will encoded as '&lt;' for '<' in the response soap body
when the root (CXFOutput) have zero child elements.

Sample :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
   <soap:Body>
      <getCompleteItemNumberResponse xmlns="
http://postmarque.proiam.com/ivrsnumber/ws/domain";>
         <OUTPUT>&lt;![CDATA[&lt;?xml version=”1.0” encoding=”utf-8” ?>
                &lt;CXFOutput Input_No = “123456789” Record_Count = “2”
Return_Code = “000” Return_Msg = “Success”/>]]>
        </OUTPUT>
      </getCompleteItemNumberResponse>
   </soap:Body>
</soap:Envelope>

How can I solve this unwanted encoding problem in the XML output inside the
soap body. I have tried to Intercept the result and try to format the
output, but that also failed.

-- 
"Never Expect Things To Happen. Struggle And Make Them Happen" - NOTHING IS
IMPOSSIBLE.

http://www.shayanth.info/
http://project-eid.org

Reply via email to