cancel
Showing results for 
Search instead for 
Did you mean: 

Error while exposing EJB as a webservice

Former Member
0 Kudos

Hi all,

I am writing a session bean in which i am trying to access sql database and retrieve data from it.

I have written one java bean class where i have written all getter setter methods.

I am using that bean class in my session bean to set the values retreived from database and then adding those beans in an arrayList.

I am returning this arrayList in the exposed method.

I created a webservice out of this EJB and deployed it.

when i am trying to test my webservice, i get this error

<b>Application error occurred during request processing.

Details: com.sap.engine.services.webservices.wsnavigator.WSNavigatorException: null</b>

Thanks,

Arch

Accepted Solutions (1)

Accepted Solutions (1)

ankur_garg5
Active Contributor

Hi Siva,

If your question has been answered, please close the thread.

If you have any other query, do let me know.

Bye

Ankur

Reward appropriate points to helpful as well as solved answers!!

Answers (2)

Answers (2)

ankur_garg5
Active Contributor
0 Kudos

Hi Siva,

Lets see if this helps...

First of all, here's the link to my article which explains how to make a web service using EJB, which accesses the MS SQL Server:

<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10</a>

Now for the ArrayList problem, I have earlier used ArrayList in the EJB code and made a web service out of it, but for confirmation, I tried the same thing just now.

I used a stateless session bean. Then i declared a method named <b>test</b> and gave its return type as <b>java.util.ArrayList</b>. Then i gave an input parameter of <b>String</b> data type. I am pasting the code of this method which i wrote:

<i> public ArrayList test(String name) {

ArrayList material = new ArrayList();

material.add(name);

material.add("Hi "+name);

return material;

}</i>

Now I created a web service out of it, and deployed it to my server.

I tested the web service in my web service navigator, and it was working perfectly. I entered my name, and I was able to see the result.

Please again check what exactly are you trying to add in your ArrayList which you are returning. It might be that the code is correct, and you don't get any errors. But at runtime, when the web service is tested, the problem comes up.

See if anything of the above helps....

Bye

Ankur

Do reward points for helpful as well as solved answers!!

Former Member
0 Kudos

Hai,

Make the Session bean return type is Array of Cutom java bean , not arraylist.

make sure that the java bean is serializable.

Regards,

Naga