I am getting a error " Every method in interface must have a corresponding method have a public method in bean class. Please help what changes should I make in Interface method declaration test1 so that the test1 method works.
package examples.webservices.rpc.MySessionBean;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface TestSession extends EJBObject
{
public
String test1(String str1) throws RemoteException;
}
-------------------------------------------------------
package examples.webservices.rpc.MySessionBean;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.io.*;
import java.net.*;
import java.util.*;
public class TestSessionBean implements SessionBean
{
private static final boolean VERBOSE = true;
private SessionContext ctx;
private int tradeLimit;
private void log(String s) {
if (VERBOSE) System.out.println(s);
}
public void ejbActivate() {
log("ejbActivate called");
}
public void ejbRemove() {
log("ejbRemove called");
}
public void ejbPassivate() {
log("ejbPassivate called");
}
public void setSessionContext(SessionContext ctx) {
log("setSessionContext called");
this.ctx = ctx;
}
public void ejbCreate () throws CreateException {
log("ejbCreate called");
try {
InitialContext ic = new InitialContext();
} catch (NamingException ne) {
throw new CreateException("Failed to find environment value "+ne);
}
}
public String test1(String str1) {
StringBuffer inputLineBuf= new StringBuffer();
try{
String st = str1;
String urlname = "http://localhost:7001/testperl.pl?" ;
char ch = '&';
char nl = '\n';
URL url = new URL(urlname);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
PrintWriter out = new PrintWriter(
connection.getOutputStream());
out.print("cust_num="+ URLEncoder.encode(cust_num));
out.close();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
{
inputLineBuf.append(inputLine);
}
in.close();
}catch(IOException e){ System.out.println("error edit");}
return inputLineBuf.toString() ;
}
}