Monday, June 14, 2010

OSB and EJB: the secret to get some result back from the EJB

I use a BS to expose an EJB in OSB.

As long as I was returning simple data types (String, Long), no problem.

When you return a POJO (Java Bean), you must know that:

a) the POJO must implement Serializable - this makes perfectly sense

b) the attributes that you expect back in OSB MUST be accompanied by getter AND setter - a getter is not enough

c) the namespace of the response incorporates as namespace the package of the Response class:

<m:getMessageResponse xmlns:m="">
<java:Message xmlns:java="java:com.acme.geoosb.ejb">hello this is Pierre</java:Message>
<java:Age xmlns:java="java:com.acme.geoosb.ejb">13</java:Age>

(com.acme.geoosb.ejb.HelloMessage is the Class name of my return parameter)

and the POJO I am returning has attributes

String message;
int age;

No comments: