I'm running into some trouble when I use asyncInvocation with void return
types. In my case I'm hitting a problem with the client interface.
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:352)
at
org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSAsyncInterfaceProcessor.isJAXWSAsyncPoolingOperation(JAXWSAsyncInterfaceProcessor.java:104)
at
org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSAsyncInterfaceProcessor.visitInterface(JAXWSAsyncInterfaceProcessor.java:57)
at
org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceIntrospectorImpl.introspectInterface(JavaInterfaceIntrospectorImpl.java:145)
...
The failing statement in JAXWSAsyncInterfaceProcessor is:
//a return type of Response<R> where R is the return type of M
DataType<?> operationOutputType =
operation.getOutputType().getLogical().get(0);
I think that operations with void return types don't have a normal output
DataType and some alternate logic is needed here. I can give it a shot.
What happened to the async sample which tested this? It seems to be gone.
I assume the proper async mapping is to use Void as had been done for the
sample....
+ // Aysnc Poll
+ public Response<Void> printAsync(Integer i1);
+
+ // Async Callback
+ public Future<Void> printAsync(Integer i1, AsyncHandler<Void> handler);
Out of curiosity I tried running wsimport with enableAsyncMapping in the
WSDL to see what JAX-WS does and I couldn't get it to do this. Instead of
using Void, it used a wrapper type (xxxResponse) with no member variables.
But http://axis.apache.org/axis2/java/core/docs/jaxws-guide.html claims
that wsimport has some issues with enableAsyncMapping and void response
type. Using Void makes sense to me.
On Mon, May 23, 2011 at 6:40 AM, Simon Laws (JIRA)
<[email protected]>wrote:
>
> [
> https://issues.apache.org/jira/browse/TUSCANY-3757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Simon Laws resolved TUSCANY-3757.
> ---------------------------------
>
> Resolution: Fixed
>
> I believe it does now
>
> > Asynch programming model doesn't support Void return types.
> > ------------------------------------------------------------
> >
> > Key: TUSCANY-3757
> > URL: https://issues.apache.org/jira/browse/TUSCANY-3757
> > Project: Tuscany
> > Issue Type: Bug
> > Affects Versions: Java-SCA-2.x
> > Environment: All
> > Reporter: Simon Laws
> > Fix For: Java-SCA-2.x
> >
> >
> > I believe that it should be possible to define an asynchronous service
> interface with an operation that returns a void, for example,
> > @AsyncInvocation
> > public interface CalculatorServiceAsync {
> > void calculateAsync(Integer n1, ResponseDispatch<String> response);
> > void printAsync(Integer n1, ResponseDispatch<Void> response);
> > }
> > However this doesn't work with Tuscany (various NPEs while parsing the
> interface).
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>