OpenEJB ApplicationComposer and WebServices (SOAP/REST)


A quick tip to show you ApplicationComposer of OpenEJB can be used to test WebServices too.

In standalone to get the small OpenEJB http layer and be able to test webservices you simply need to add the property openejb.embedded.remotable to true to your properties.

Since last release of OpenEJB you can do the same! Just add this property in your @Configuration.

@Configuration
public Properties config() {
    return new Properties() {{
        setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true");
    }};
}

Then to avoid to build the whole application manually you can simply return the classes you want to deploy:

@Module
public static Class<?>[] myApp() throws Exception {
    return new Class<?>[] { Foo.class, Bar.class, MyWebService.class };
}

Then simply add some test methods:

The default base url will be: http://127.0.0.1:4204/<your test simple name>

For instance:  http://127.0.0.1:4204/MySuperWebServiceTest

If you want to customize the context simply add to @Configuration properties the property <your test simple name>.moduleId.

Advertisement

2 thoughts on “OpenEJB ApplicationComposer and WebServices (SOAP/REST)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s