Creating the async methods can be tricky as the request object gets unwrapped, 
the the wrapper object is used for the callback.   

My suggestion is to create your service, grab the wsdl, and generate a client 
with it enabling the async methods.  (with 2.4.2, you can pass -asyncMethods 
flag).  Use that generated interface as the basis fro your async methods and 
such.

Dan


On Friday, August 26, 2011 9:25:35 AM Kent Närling wrote:
> Now I did some small modifcations to my interfaces so I created a sample
> service with a method declared like:
> @WebMethod(operationName = "doAdd")
> String doAdd(
> @WebParam(name = "a") String a,
> @WebParam(name = "b") String b);
> 
> @WebMethod(operationName = "doAdd")
> @WebEndpoint(name="doAdd")
> Future<?> doAddAsync(
> String a,
> String b,
> AsyncHandler<String> handler);
> 
> 
> The server implements this (with an empty stub for the async call) and
> publishes simply with:
> 
> AdderService service = new AdderService();
> Endpoint.publish("http://localhost:8989/adder";, service);
> 
> The client simply creates the interface connection with:
> AdderInterface adder;
> 
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.setServiceClass(AdderInterface.class);
> factory.setAddress("http://localhost:8989/adder";);
> adder = (AdderInterface)factory.create();
> 
> Now, STILL, if I call the async method I get:
> "javax.xml.ws.WebServiceException: Could not find wsdl:binding operation
> info for web method doAddAsync."
> 
> It seems to me that CXF thinks that the operation name on the server is
> "doAddAsync" despite that I explictly named it as "doAdd" in the annotation?
> 
> There should be a way to tell CXF through annotations that "for this method
> stub X, call SOAP method Y on the server"?
> Or am I missunderstanding what the problem is here?
> 
> I have a full sample code of the above if anyone is interested I can send
> it, I cannot get this to work and I am a bit stuck right now... :-(
> 
> On 18 August 2011 00:48, Kent Närling <kent.narl...@seamless.se> wrote:
> > On 17 August 2011 23:21, Kent Närling <kent.narl...@seamless.se> wrote:
> >> On 17 August 2011 18:08, Daniel Kulp <dk...@apache.org> wrote:
> >>> On Wednesday, August 17, 2011 4:17:58 PM Kent Närling wrote:
> >>> > I tried ad-hoc and just wrote the interface myself as:
> >>> > 
> >>> > @WebService
> >>> > 
> >>> > public interface MyService
> >>> > 
> >>> > {
> >>> > 
> >>> > @WebMethod(operationName = "doSomething")
> >>> > 
> >>> > Future<?> doSomething(
> >>> > 
> >>> > @WebParam(name = "someParam") String someParam,
> >>> > AsyncHandler<DoSomethingResult> asyncHandler);
> >>> > 
> >>> > }
> >>> > But with this I just god the error : "Could not find
> >>> > wsdl:binding
> >>> 
> >>> operation
> >>> 
> >>> > info for web method doSomething"
> >>> > 
> >>> > So I guess this means I would have to annotate some binding
> >>> 
> >>> information? or
> >>> 
> >>> > is this impossible to do with annotations?
> >>> 
> >>> You ALWAYS have to have the non-async versions there.   Thus, put
> >>> your
> >>> original method signature in there.   You can then optionally add
> >>> the
> >>> async
> >>> versions as needed and only for the methods you need.
> >>> 
> >>> Dan
> >>> 
> >>> 
> >>> 
> >>> Does this mean that the server side will have to implement the async
> >> 
> >> version as well?
> >> (would be a bit odd if the server has to implement the same method
> >> twice?
> >> 
> >> Since it has to implement the same interface then it has to implement
> >> the async version...
> >> 
> >> Also, can the method name & SOAP operation name be the same? or should
> >> the methods have different names?
> >> 
> >> 
> >> ie in the above you are saying that I  should declare an interface as:
> >> 
> >> @WebService
> >> 
> >> public interface MyService
> >> 
> >> {
> >> 
> >> @WebMethod(operationName = "doSomething")
> >> 
> >> DoSomethingResult doSomething(
> >> 
> >> @WebParam(name = "someParam") String someParam);
> >> 
> >> @WebMethod(operationName = "doSomething")
> >> 
> >> Future<?> doSomething(
> >> 
> >> @WebParam(name = "someParam") String someParam,
> >> 
> >> AsyncHandler<DoSomethingResult> handler);
> >> 
> >> }
> >> 
> >> 
> >> Or?
> > 
> > I tried to declare it as above, still get the same error as before:
> > "Could not find wsdl:binding operation info for web method doSomething"
> > 
> > Do I have to
-- 
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to