users@glassfish.java.net

EJB web service and multiple endpoints

From: Danilo Levantesi <danilo.levantesi_at_gmail.com>
Date: Thu, 2 Oct 2008 12:56:47 +0200

Hi to all!
I'd like to deploy an EJB webservice into Glassfish and map this ws to
multiple endpoints.

My ejb looks like:

@WebService
@Stateless
public class HelloBean implements HelloRemote {

    @WebMethod
    public String sayHello() {
        return "Hello!";
    }
}

I've tried to use sun-ejb-jar.xml, putting multiple webservice-endpoint:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application
Server 9.0 EJB
3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
    <enterprise-beans>
        <name>hello</name>
        <ejb>
            <ejb-name>HelloBean</ejb-name>
            <webservice-endpoint>
                <port-component-name>HelloBeanPort</port-component-name>
<endpoint-address-uri>/HelloBeanService/HelloBean1</endpoint-address-uri>
            </webservice-endpoint>
            <webservice-endpoint>
                <port-component-name>HelloBeanPort</port-component-name>
<endpoint-address-uri>/HelloBeanService/HelloBean2</endpoint-address-uri>
            </webservice-endpoint>
        </ejb>
    </enterprise-beans>
</sun-ejb-jar>

This solution leads only to a single endpoint (in this particular case, the
second one).

Can someone telle me if what I'm trying to do is possible?

Many thanks

Danilo