Using wsdl2java to create a stub with PROPER async support

Suppose that I have a service is only one method: int generateRandomNumbers().

Can wsdl2java be used to create stubs with proper async support?

For example, the generated class should have the following methods / messages:

int generateRandomNumbers()
int generateRandomNumbers_Async(callback)

I know how to use wsdl2java to create stubs with asynchronous messages. However, this only works if the service understands asynchronous messages.

What I mean by async native support is that

  • generateRandomNumbers_Asyncis not a new message because the service only understands generateRandomNumbers, notgenerateRandomNumbers_Async
  • generateRandomNumbers_Async= calls generateRandomNumbersin another thread and invokes a callback when generateRandomNumbersterminated behind the scenes.

Any idea?

What about other web services?

+3
2

CXF , "" . "generateRandomNumbers" , , - , . ( jaxws spec) .

wsdl2java jaxws, - :

<bindings
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  wsdlLocation="hello_world_async.wsdl"
  xmlns="http://java.sun.com/xml/ns/jaxws">
  <bindings node="wsdl:definitions">
    <enableAsyncMapping>true</enableAsyncMapping>
  </bindings>
</bindings>

-B. . .

+1

. Annotation @UseAsyncMethod . Servlet 3.0 . true web.xml:

<servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
        <!-- Enable asynchronous requests -->
        <async-supported>true</async-supported>
</servlet>
0

All Articles