Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem on getting detination

Hi all,

I'm tring to get destination from detination service (I inserted the address manually using Visual administrator).

Here the code I used, it seems to be very strange, but it doesn't works fine.

public String connectToHTTPDestination()

{

String res = "";

try{

InitialContext ctx = new InitialContext();

try{

DestinationService dstService = (DestinationService) ctx.lookup(DestinationService.JNDI_KEY);

if (dstService == null)

throw new NamingException("Destination Service not available");

Destination destination = dstService.getDestination("HTTP","dst-1");

// for HTTP destination: cast

HTTPDestination httpDestination = (HTTPDestination) destination;

// obtain a HTTPUrlConnection from the destinationHttpURLConnection

try {

java.net.HttpURLConnection httpConnection = httpDestination.getURLConnection();

//httpConnection.toString();

} catch (ConfigurationException e) {res = e.getMessage();

return res;};

}catch (DestinationException e) {res = e.getMessage();

return res;}

catch (RemoteException e) {res = e.getMessage();

return res;};

} catch (NamingException e) {res = e.getMessage();

return res;};

return res;

}

Thanks a lot,

Vito

Not what you were looking for? View more on this topic or Ask a question