on 07-25-2006 8:30 AM
Hi
i am calling a web service from R3 which i have moved from one server to another what i need to do in my web dynpro application as it will call the web service from new location?
do i need to rebuild the whole application or need to change some settings here and there?
NOTE: webservice and function module of the web service is not changed just moved from one server to another.
THANKS
Ninad
Hi,
Try with this code. Dynamically Server will get change.
Create a HTTP Destination in visual administrator which stores the server name and port.
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;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ninad,
Just change the ip address in the following location in
"config1Port_Document" file which will reside in
ur project hierarchy structure..
i.e for example(in webdynpro explorer)
TestPrj
--Webdynpro
-
Application name
-
Models
-
Model name
-
Logical Ports
-
config1Port_Document
click on config1Port_Document
and see the target addresss, where it is ur first server address or second server address...
which ever server u want to execute, u give that server ip address...
save & deploy it and try now
hope this helps u...
thank u
regards
-
sunil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think better you have to create a HTTP Destination on Visula Admin.
Inside DoIntt() get Destination from Visula Admin using following code.
final Destination destination = dstService.getDestination("HTTP","Destination Name");
final HTTPDestination httpDestination = (HTTPDestination) destination;
HttpURLConnection httpConnection = httpDestination.getURLConnection();
String xyz = String.valueOf(httpConnection.getURL());
Request_WEBTESTRLCViDocument_getRole obj=wdContext.currentRequest_WEBTESTRLCViDocument_getRoleElement().modelObject();
obj._setEndPoint(xyz);
obj.execute();
Kind Regards,
S.Saravanan.
Message was edited by: Saravanan S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ninad,
You can follow this 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.
Using the above approach you need not change server name and build your project every time webservice location changes.
Hope this is helpful to you.
Regards,
Shiva Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ninad,
Change the Server and Redeploy it in the new server
Regards
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.