Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Today, the EJB developers on NetWeaver need to do the development of EJB and create a Client for test it remotely.

With NetWeaver CE 7.2 a great tool is available, the EJB Explorer.

With EJB Explorer the methods of an EJB can be tested through the browser in similar way to WS Navigator.

The use EJB Explorer has some advantages like the eliminate the necessity of create a client just to test remotely and eliminate the necessity of update the Remote interface on client to reflect the new methods and so.

With this tool you can write your client just when you have finished the server development.

To this demonstration I'll use the following objects:

Remote Interface</p><p><textarea cols="80" rows="8">package sdn.ejbexplorer.service;

import javax.ejb.Remote;

import sdn.ejbexplorer.model.SearchResponse;

import java.util.List;

import sdn.ejbexplorer.model.SearchRequest;

@Remote

public interface SDNServiceRemote {

     public List<SearchResponse> findProduct (SearchRequest searchRequest);

}</textarea></p><p>Local Interface</p><p>*<textarea cols="80" rows="9">package sdn.ejbexplorer.service;

import javax.ejb.Local;

import sdn.ejbexplorer.model.SearchResponse;

import java.util.List;

import sdn.ejbexplorer.model.SearchRequest;

@Local

public interface SDNServiceLocal {

     public List<SearchResponse> findProduct (SearchRequest searchRequest);

}</textarea></p><p>Bean Implementation</p><p>package sdn.ejbexplorer.service;

import java.util.ArrayList;

import java.util.List;

import javax.ejb.Stateless;

import sdn.ejbexplorer.model.SearchRequest;

import sdn.ejbexplorer.model.SearchResponse;

/**

  • Session Bean implementation class SDNServiceBean

*/

@Stateless

public class SDNServiceBean implements SDNServiceRemote, SDNServiceLocal {

     public List</p><p>Request Model</p><p>package sdn.ejbexplorer.model;import java.io.Serializable;public class SearchRequest implements Serializable { private static final long serialVersionUID = 1L;  private String description; private String status;  public String getDescription() {  return description; } public void setDescription(String description) {  this.description = description; } public String getStatus() {  return status; } public void setStatus(String status) {  this.status = status; }}

</p><p>Response Model</p><p>To find it just select the Remote Interface and see Lookup String, to example is: ejb:/appName=demo.sap.com/sdnejbexplorerapp, jarName=demo.sap.comsdnejbexplorer~ejb.jar, beanName=SDNServiceBean, interfaceName=sdn.ejbexplorer.service.SDNServiceRemote

!https://weblogs.sdn.sap.com/weblogs/images/251907834/ejb-explorer-6.png|height=149|alt=image|width=7...!</body>

8 Comments