PDA

View Full Version : From error to error. - Endpoint invocation resulted in exception


salva
Jul 6th, 2006, 06:41 AM
The web service is invoked, an return an ELEMENT type, the I have a SOAP Exception. I'm using the new Snapshot version.


2006-07-06 11:28:44,129 INFO [STDOUT] 2006-07-06 11:28:44,129 INFO [xxx.controlservidores.ws.ReceptorFtpEndPoint] - Devolvemos como resultado OK
2006-07-06 11:28:44,145 INFO [STDOUT] 2006-07-06 11:28:44,145 DEBUG [org.springframework.ws.soap.SoapMessageDispatcher] - Testing endpoint exception resolver [org.springframework.ws.soap.endpoint.SimpleSoapExc eptionResolver@131ebb3]
2006-07-06 11:28:44,160 INFO [STDOUT] 2006-07-06 11:28:44,160 WARN [org.springframework.ws.soap.SoapMessageDispatcher] - Endpoint invocation resulted in exception - responding with SOAP Fault
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)


This is the EndPoint code. I introduce a try--catch just before the return code... as you can see the Exception goes after the return code...


protected Element invokeInternal(Element requestElement, Document document) throws Exception {
logger.info("invokeInternal. " + requestElement.getNamespaceURI() + " - " + requestElement.getLocalName());
Assert.isTrue(NAMESPACE_URI.equals(requestElement. getNamespaceURI()), "Invalid namespace");
Assert.isTrue(ECHO_REQUEST_LOCAL_NAME.equals(reque stElement.getLocalName()), "Invalid local name");

NodeList children = requestElement.getChildNodes();
Text requestText = null;
for (int i = 0; i < children.getLength(); i++) {
if (children.item(i).getNodeType() == Node.TEXT_NODE) {
requestText = (Text) children.item(i);
break;
}
}
if (requestText == null) {
throw new IllegalArgumentException("Could not find request text node");
}
try {
String servidor = requestText.getNodeValue();

logger.info("Se invocó el servicio con valor " + servidor);
String resultado = receptorFtpService.setAlive(servidor);

Element responseElement = document.createElementNS(NAMESPACE_URI, ECHO_RESPONSE_LOCAL_NAME);
Text responseText = document.createTextNode(resultado);
responseElement.appendChild(responseText);
logger.info("Devolvemos como resultado " + resultado);
return responseElement;
}
catch (Exception e) {
logger.fatal(e.getMessage());
return null;
}


Thanks in advance...

Arjen Poutsma
Jul 7th, 2006, 05:39 AM
It's just a hunch, but are you using JBoss by any chance?

salva
Jul 11th, 2006, 04:12 AM
Yes, I'm using JBoss 4.0.3SP1 and 4.0.4GA.

Arjen Poutsma
Jul 11th, 2006, 10:52 AM
Yeah, that's what I thought. I think it's a bug in JBoss's implementation of SAAJ. I've notified the JBoss developers: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=86580, so let's hope it gets fixed soon.

As a workaround, you can override JBoss's SAAJ implementation with the reference implementation. I'm not a JBoss expert, so I don't know how this is done, but I think you can find resources on the web that tell you how.

salva
Jul 11th, 2006, 02:30 PM
Thank you very much...