×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

communication bet. corba servlet program to server corba program

communication bet. corba servlet program to server corba program

communication bet. corba servlet program to server corba program

(OP)
Dear Friends,
I am getting a very serious problem.If possible please help me as soon as possible.My problem is---

1.Whenever I am trying to make the commuicatio between my servlet corba client to server corba via visibroker(4.5).I am getting a org.omg.CORBA.BAD_PARAM error at runtime.
I also know that this error is coming due to narrow method.
But I am not able to rectify it.Below ,I am giving my corba client servlet,server corba ,servant file with the idl.Plzz help me.

//Corba Client Servlet

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class JokeClientServlet1 extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
super.init(config);
String str1="10";
String str2="aftab";
String str[]=new String[2];
str[0]=str1;
str[1]=str2;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(str,null);
try
{
byte[] JokeId= "JokeObject".getBytes();
chapter3.joke manager = chapter3.jokeHelper.bind(orb,"Joke_poa",JokeId);
int R = Integer.parseInt(str1);
long Dollar = manager.convert(R);
String show = manager.welcome(str2);
System.out.println(show);
System.out.println(R+" Us Dollars are Equals to Indian Rupees"+Dollar);
System.out.println("AFTABY");
}
catch(Exception ex)
{
System.out.println(ex);
}
}

public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
{
try
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("<html>");
out.println("<body>");
out.println("hi");
out.println("</body>");
out.println("</html>");
}catch(Exception ex)
{}
}
}

//Corba Server Program

import org.omg.PortableServer.*;
import org.omg.CORBA.*;

public class JokeServer1
{
public static void main(String[] args)
{
try
{
ORB orb = ORB.init(args,null);
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

//Create policies for our persistent POA
org.omg.CORBA.Policy[] policies={rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT)};
POA myPOA = rootPOA.create_POA("Joke_poa",rootPOA.the_POAManager(),policies);
JokeImpl JokeServant = new JokeImpl();
byte[] JokeId = "JokeObject".getBytes();
myPOA.activate_object_with_id(JokeId,JokeServant);
rootPOA.the_POAManager().activate();

System.out.println(myPOA.servant_to_reference(JokeServant)+" is ready.");
orb.run();
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}

//Servant Program

import org.omg.PortableServer.*;
import java.awt.*;
import java.net.URL.*;
import java.sql.*;
import java.util.*;

public class JokeImpl extends chapter3.jokePOA
{
public int convert(int Dollar)
{
int R = Dollar;
int Dollar1=45*R;
return Dollar1;
}
public String welcome(String Name)
{
String joke="Hi "+Name+" Welcome to the USA";
return joke;
}
}

// joke.IDL FILE
module chapter3
{
interface joke
{
long convert (in long Dollars);
string welcome(in string Name);
};
};



RE: communication bet. corba servlet program to server corba program

Hi,
 I got 2 doubts on seeing your code
1. In the server code do you need ORB::Init ?
2.Also resolve_initial_references call must be made on the BootStrap object and not on ORB isn't it .. ?

Regards

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close