I managed to set up a simple proxy between a cxf web service and its client.
The proxy is made with jetty and has two classes
public class HttpServer {
private static String url = "http://localhost:8765/jtrouter";
public static void main(String[] args) throws Exception {
HttpServer server = new HttpServer();
System.out.println("Starting HttpServer... press ctrl + c to stop
it");
server.server();
System.out.println("... started and listening on: " + url);
Thread.sleep(999999999);
}
public void server() throws Exception {
CamelContext camel = new DefaultCamelContext();
camel.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("jetty:" + url)
.bean(RecipientListJetty.class);
}
});
camel.start();
}
}
public class RecipientListJetty {
@RecipientList
public String[] route(Exchange exchange) throws
ParserConfigurationException, SAXException, IOException
{
int size = exchange.getIn().getAttachments().size();
System.out.println("size attachments ==> " + size);
String rec =
"http://localhost:8080/cxf-ws-order/services/OrderService?bridgeEndpoint=true";
return new String[] {rec};
}
}
The problem is this doesn't work when the ws has an MTOM attachment. The
server responds with the following stack trace
[ qtp19297865-14] DefaultErrorHandler ERROR Failed
delivery for exchangeId: ID-AVON-DELL-2237-1299157873703-0-3. Exhausted
after delivery attempt: 1 caught:
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://localhost:8080/cxf-ws-raggi/services/raggiPort with
statusCode: 500
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://localhost:8080/cxf-ws-raggi/services/raggiPort with
statusCode: 500
at
org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:166)[camel-http-2.5.0.jar:2.5.0]
at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:108)[camel-http-2.5.0.jar:2.5.0]
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[camel-core-2.5.0.jar:2.5.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.5.0.jar:2.5.0]
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[camel-core-2.5.0.jar:2.5.0]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[camel-core-2.5.0.jar:2.5.0]
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)[camel-core-2.5.0.jar:2.5.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[camel-core-2.5.0.jar:2.5.0]
...
Is this my mistake or an expected behaviour? What to do to workaround this?
I think i need a pure http proxy (jetty or servlet), a cxf one should not be
suitable to my needs.
Thanks.
--
View this message in context:
http://camel.465427.n5.nabble.com/http-proxy-and-mtom-attachments-tp3407911p3407911.html
Sent from the Camel - Users mailing list archive at Nabble.com.