camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hutao722 <hutao...@163.com>
Subject splitting xml failed when running on tomcat
Date Sun, 29 Sep 2013 05:56:41 GMT
Hi,

i wish to split the big xml to the small one. So I tried to use tokenizeXML
or Stax method to implement it. The two ways both work when i did the unit
test. But when i deployed the war to Tomcat. I found they both failed to
split the xml. It seems when split failed, the following process handler is
skipped and the entire xml will be response to the the browser. I didn't
find any errors in tomcat or in my browser. The code is:


JaxbDataFormat jaxb = new JaxbDataFormat(false);
jaxb.setContextPath(GetDetailInfoByTrainCode.class.getPackage().getName());
			
from("restlet:/pacs/{trainCode}?restletMethods=post,get")
.process(new Processor() {
	public void process(Exchange exchange) throws Exception {
		String trainCode = exchange.getIn().getHeader("trainCode", String.class);
		GetDetailInfoByTrainCode gd = new GetDetailInfoByTrainCode();
		gd.setTrainCode(trainCode);
		gd.setUserID("");
		exchange.getIn().setBody(gd, GetDetailInfoByTrainCode.class);
	}
})
.marshal(jaxb)
.to("spring-ws:http://www.webxml.com.cn/WebServices/TrainTimeWebService.asmx?soapAction=http://WebXml.com.cn/getDetailInfoByTrainCode")
.split().tokenizeXML("getDetailInfo").streaming()
// or using stax 	
//.split(StAXBuilder.stax(GetDetailInfo.class, true)).streaming()
.process(new Processor() {
	@Override
	public void process(Exchange exchange) throws Exception {					
		String content = exchange.getIn().getBody(String.class);
		Response response =
exchange.getIn().getHeader(RestletConstants.RESTLET_RESPONSE,
Response.class);
		response.setStatus(Status.SUCCESS_OK);
		response.setEntity(content, MediaType.TEXT_XML);
		exchange.getOut().setBody(response);
	}
});   

Why? Do i need to do something when running on Tomcat?

Thanks!




--
View this message in context: http://camel.465427.n5.nabble.com/splitting-xml-failed-when-running-on-tomcat-tp5740407.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message