on 10-20-2005 9:45 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
We have the same requirement.
Did you find a solution?
Thanks,
Roelof
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.