tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird Nelson <>
Subject More webservice woes
Date Mon, 13 Apr 2009 19:02:57 GMT
I finally understand the problem that David brought up several messages ago
(the specification anomaly regarding mixing @Remote and @WebService).

I *hope* that my latest problem has moved on past that.

David had confirmed that on the interface side of the house I can do this:

public interface SayHello {
  public String sayHello();

public interface SayHelloRemote extends SayHello { }

public interface SayHelloWebService extends SayHello { }

...and that that is guaranteed to be portable across containers.

I am thinking that on the class side of the house I should be able,
therefore, to do this:

  portName = "SayHelloPort",
  serviceName = "SayHelloService",
  targetNamespace = "",
  endpointInterface = "net.foobar.SayHelloWebService"
public class SayHelloImpl implements SayHelloRemote, SayHelloWebService {

  public String sayHello() {
    return "Hello!";


...and that such a beast could therefore be exposed as both a stateless
session bean and a web service.

But when I then try to write one test case to exercise both of these
functions, like this:

  public void testSLSB() throws Exception {
    final Object o = this.context.lookup("SayHelloImplRemote");
    assertTrue(o instanceof SayHello);
    final SayHello sh = (SayHello)PortableRemoteObject.narrow(o,
    assertEquals("Hello!", sh.sayHello());

  public void testWebService() throws Exception {
    final Service sayHelloService = Service.create(new URL(""), null);

    final Iterator<QName> ports = sayHelloService.getPorts();
    while (ports.hasNext()) {

    final SayHello sayHello =
sayHelloService.getPort(SayHelloWebService.class); // KABOOM
    assertEquals("Hello!", sayHello.sayHello());

...the second test fails at the line marked KABOOM.  The failure in this
case is:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
definition for service {}SayHelloWebServiceService.

The System.out.println() output is:

...suggesting that the portName attribute of the @WebService annotation is
being used, which is good--so why is OpenEJB trying to look up {}SayHelloWebServiceService instead?  I've just spun
through the documentation on the website and found nothing relevant.

Thanks (again, as always),

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message