Thank you Willem for your reply.
I defined the route as follows.
<osgi:camelContext xmlns="http://camel.apache.org/schema/spring">
<routeBuilder ref="ivrsGetNumbersRoute" />
</osgi:camelContext>
<cxf:cxfEndpoint id="getIVRSNumbersRouteServiceEndpoint"
address="http://
${inquery.ivrsnumber.ws.address}:${inquery.ivrsnumber.ws.port}/GetCompleteItemNumbers"
serviceClass="com.proiam.postmarque.ivrsnumber.ws.GetCompleteItemNumberServiceImp">
</cxf:cxfEndpoint>
<!-- Router Bean-->
<bean name="ivrsGetNumbersRoute" id="ivrsGetNumbersRoute"
class="com.proiam.postmarque.ivrsnumber.route.IVRSGetNumbersRoute">
</bean>
Further, in the DSL
from("cxf:bean:getIVRSNumbersRouteServiceEndpoint?Bus=#cxf").to("direct:getIVRSNumbersRouteServiceEndpoint");
/**
* Log the income message and send the income message to the
Validator
*/
from("direct:getIVRSNumbersRouteServiceEndpoint").wireTap("direct:logMessage")
.to("direct:processIncomeMessage");
from("direct:processIncomeMessage").process(new Processor() {
..... some processing here
... and finally
StringWriter sw = new StringWriter();
JAXBContext jaxbContext =
JAXBContext.newInstance("com.my.testcamel.ivrsnumber.domain",
com.proiam.postmarque.ivrsnumber.domain.ObjectFactory.class.getClassLoader());
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
Boolean.valueOf(true));
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
marshaller.marshal(cxfOutput, sw); // Here I'm marshallising
my CXFOutput Object to XML string.
String outValue = sw.toString();
GetCompleteItemNumberResponse response = new
GetCompleteItemNumberResponse();
response.setOUTPUT(outValue); // Assgning my XML String to
output response
LOG.info("Final Output Value : " + outValue);
exchange.getOut().setBody(response); // Set the output
message to exchange out message.
}
})
.end();
And,
In the WSDL, I defined the data type as String
<xs:element name="getCompleteItemNumberResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="OUTPUT" type="xs:string"
minOccurs="1"
maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
On Sat, Sep 24, 2011 at 5:35 PM, Willem Jiang <[email protected]>wrote:
> Can I have a look at your camel route ?
> Which data format did you choice for the CXF endpoint ?
>
>
>
> On Sat Sep 24 15:29:05 2011, Shayanthan Kanaganayagham wrote:
>
>> 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/<http://schemas.xmlsoap.org/soap/envelope/>
>> ">
>> <soap:Body>
>> <getCompleteItemNumberResponse xmlns="
>> http://postmarque.proiam.com/**ivrsnumber/ws/domain<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 '<' 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/<http://schemas.xmlsoap.org/soap/envelope/>
>> ">
>> <soap:Body>
>> <getCompleteItemNumberResponse xmlns="
>> http://postmarque.proiam.com/**ivrsnumber/ws/domain<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”/>]]>
>> </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.
>>
>>
>
>
> --
> Willem
> ------------------------------**----
> FuseSource
> Web: http://www.fusesource.com
> Blog:
> http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English)
> http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang Weibo: willemjiang
>
--
"Never Expect Things To Happen. Struggle And Make Them Happen" - NOTHING IS
IMPOSSIBLE.
http://www.shayanth.info/
http://project-eid.org