Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2
-
None
-
Win XP, CXF 2.2, Java 5
-
Moderate
Description
If the service interface is specified to have a parameter style of bare/simple by using the @SOAPBinding annotation, a method that has been annotated with @Oneway does not behave as expected. The method still acts as a two way method in that the client is not free'd up immediately. The client waits for method to finish processing.
Interface:
@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface HelloWorld
{
@WebMethod
@Oneway
void sayHiOneWay(String text);
}
Impl:
@WebService(endpointInterface = "demo.hw.server.HelloWorld", serviceName = "HelloWorld")
public class HelloWorldImpl implements HelloWorld
{
@Oneway
public void sayHiOneWay(String text)
{
System.out.println("sayHiOneWay called");
System.out.println("sleeping for 10 secs");
try
catch (InterruptedException e)
System.out.println("woke up after 10 secs");
System.out.println("accepted: " + text);
}
}
Client:
public final class Client
{
private static final QName SERVICE_NAME = new QName("http://server.hw.demo/", "HelloWorld");
private static final QName PORT_NAME = new QName("http://server.hw.demo/", "HelloWorldPort");
private Client()
{
}
public static void main(String args[]) throws Exception
{ Service service = Service.create(SERVICE_NAME); // Endpoint Address String endpointAddress = "http://localhost:9090/Hello"; // Add a port to the Service service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress); HelloWorld hw = service.getPort(HelloWorld.class); System.out.println("Invoke sayHiOneWay()...."); long startTime = System.currentTimeMillis(); hw.sayHiOneWay(System.getProperty("user.name")); System.out.println("Time taken to call sayHiOneWay(): " + (System.currentTimeMillis()-startTime) + " ms"); }}