Skip to Content
avatar image
Former Member

Dynamically define target address for logical ports (NW'04)

Hello,

when developing a web-service client using standalone proxy, you have to define the target address of a Web Service in the property-page for the Logical Port.

We have the following problem. If, for any reason, the URL of the Web Service changes (i.e. the hostname or the port), we have to rebuild the whole project and then redeploy the project.

Is there a way to change this URL dynamically by java-code?

Thanks in advance,

Jarle

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Feb 08, 2006 at 03:10 PM

    Hi,

    We have the same requirement.

    Did you find a solution?

    Thanks,

    Roelof

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 16, 2006 at 04:16 PM

    Hi everybody,

    I have the same problem. My problem arises by the implementation of the WebAS of the company, which has 2 instances; and the Web Services models of my WebDynpro have a different port according to the instance run.

    Really exist a way to change dynamically the logical port of the WebService Model by java-code to solve this problem?

    Best Regards.

    Simón Arancibia

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2006 at 07:31 AM

    Hi,

    You can get Server name Dynamically. You follow the below steps.

    1. Create a HTTP Destination in visual administrator which stores the server name and port.

    2. Access this variable in your controller init method and build your web service url with server name and port and use _setEndPoint() method

    String prefixURL = "http://";

    // your Service Address...remove the first part from service url.

    String serviceURL = "/TestService/Config1?style=document";

    DestinationService dstService = (DestinationService) obj;

    Destination destination = dstService.getDestination("HTTP","ApplicationServer");

    Properties destprop = destination.getDestinationProperties();

    HTTPDestination httpDestination = (HTTPDestination) destination;

    String serverName = httpDestination.getUrl();

    prefixURL = prefixURL + serverName;

    String testURL = prefixURL + serviceURL;

    Request<Obj> testReq = new Request<Obj>();

    testReq._setEndPoint(testURL);

    You need to import below files into your project.

    import com.sap.security.core.server.destinations.api.Destination;

    import com.sap.security.core.server.destinations.api.DestinationService;

    import com.sap.security.core.server.destinations.api.HTTPDestination;

    import java.net.HttpURLConnection;

    import java.util.Properties

    hope it solved your problem.

    Regards,

    Sridhar

    Add comment
    10|10000 characters needed characters exceeded