This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "simple java problem" Watch "simple java problem" New topic

simple java problem

xin sa

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 {
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) {
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 {
catch (UnknownHostException ex) System.err.println(ex);
return ep
private static bala port = new bala(endpoint());

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

... ...

why didn't i get the right endpoint, what i want?
I agree. Here's the link:
subject: simple java problem
It's not a secret anymore!