Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

CXF Endpoint accepts invalid SOAP-Envelope in POJO-Mode

$
0
0
Hello,

we developed a webservice with cxf and camel. Everything works fine, except
the fact that the cxf-endpoint accepts invalid SOAP-Messages.

For example we have a SOAP-Message:

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
...
</SOAP-ENV:Header>

<SOAP-ENV:Body>
...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But we observed that it isn't necessery to spell the "SOAP-ENV:Envelope"-Tag
correctly.

CXF accepts every combination like: <SOAP-ENV:foo ..., > <SOAP-ENV:bar...>,
<SOAP-ENV:blabla...> . In addition the start and end tag doesn't have to
match eachother, it's also possible to type:

<SOAP-ENV:foo xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<SOAP-ENV:Header>
...
</SOAP-ENV:Header>

<SOAP-ENV:Body>
...
</SOAP-ENV:Body>

</SOAP-ENV:bar>

Here is the code:

Servlet:

public class CXFServlet extends CXFNonSpringServlet {

@Override
protected void loadBus(ServletConfig sc) {

setBus(BusFactory.getDefaultBus());

Camel:

public class CamelRoute extends RouteBuilder {

private static final Logger logger = Logger.getLogger(CamelRoute.class);

private final String uri = "cxf:/rrv?dataFormat=PAYLOAD";

@Override
public void configure() throws Exception {

from(uri)
.process(new Processor() {

@Override
public void process(Exchange exchange) throws Exception {
processSOAP(exchange);

});

The processSOAP method just prints the SOAP-Message and create a response.

Do we miss some configuration? Or is there a workaround for this problem? In
the end we always get a SOAP-Response instead of a SOAP-Fault.

It might be funny but this time i really looking forward to see an exception
thrown.

PS: We don't want to use spring, so i would prefer a non-spring solution.

thank you for your time.

Viewing all articles
Browse latest Browse all 5648

Trending Articles