Código PHP:
package test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import tu.interfaces.MySesion;
import tu.interfaces.MySesionHome;
/**
* EJB Test Client
*/
public class Cliente {
public static void main(String [] args)
{
InputStreamReader rd= new InputStreamReader(System.in);
BufferedReader bf=new BufferedReader(rd);
Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL,"192.x.x.x:1099");
try {
InitialContext jndicon=new InitialContext(prop);
System.out.println("Obteniendo Contexto");
Object ref=jndicon.lookup("ejb/MySesion");
System.out.println("Obtenida la referencia del Bean");
MySesionHome ejbp=(MySesionHome) PortableRemoteObject.narrow(ref,MySesionHome.class);
MySesion remoto=ejbp.create();
System.out.println("dame numero: ");
double f=Double.parseDouble(bf.readLine());
System.out.println("suma :"+remoto.suma(f,120));
System.out.println("absolute :"+Math.abs(f));
}
catch (Exception err)
{
err.getStackTrace();
}
}
}