aspose file tools*
The moose likes Web Services and the fly likes simple java problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "simple java problem" Watch "simple java problem" New topic
Author

simple java problem

xin sa
Greenhorn

Joined: May 02, 2007
Posts: 11
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!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: simple java problem