Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

simple java problem

 
xin sa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this program and i want, that the user can also set the Service Endpoint, i wrote this:
---------------------------
public class bala{
private static String ServiceEndpoint ;

public static String getEndpoint(String serverName) throws UnknownHostException {
try{
setEndpoint(serverName);
}
catch (RemoteException ex){}
return getEndpoint();
}

public static String getEndpoint() throws UnknownHostException {
InetAddress endpoint = InetAddress.getByName(ServiceEndpoint);
return endpoint.getHostName();
}
public static void setEndpoint(String aServiceEndpoint) throws RemoteException{
ServiceEndpoint = aServiceEndpoint;
}

private static String endpoint(){
String ep = new String();
try {
ep = getEndpoint();
}
catch (UnknownHostException ex) {
System.err.println(ex);
}
return ep;
}
private static EndpointReference targetEPR = new EndpointReference("http://"+endpoint()+"/axis2/services/balaService");
... ...

public void exam(){... ... }

... ...
}
------------------
and i call this in anaother Programm with:
--------------------
... ...
private static String endpoint(){
String ep = new String();
try {
ep=bala.getEndpoint();
}
catch (UnknownHostException ex) System.err.println(ex);
return ep
}
private static bala port = new bala(endpoint());

... ...
case 6:
{ String server = getUserInput("Enter new server: ");
bala.setEndpoint(server);
System.out.println("server changed to :"+ server);
break;
}

port.exam();
... ...
----------------------

why didn't i get the right endpoint, what i want?
Thanks!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic