on 06-02-2006 11:53 AM
Hi all,
I have created a Web Service (java) and made it available in a server. The web dynpro applications make use of it by importing web service using wsdl file's url. In case, I want to move the web service to another server, then the web service model of the webdynpro applications has to be deleted and recreated. How can I avoid modifying applications' model and move the web service to another server? (Or) is there any possible solution to handle this problem?
Srinivasan T
Hi srinivasan,
Although it is not possible to directly re-impost web service model in to the dev studio but there is a wrok around to do the same. Refer to the following link for an article on the same,
/people/bertram.ganz/blog/2005/10/10/how-to-reimport-web-service-models-in-web-dynpro-for-java
Regards,
Guru
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srinivasan,
If this is the case, then use the HTTP destination for this.
What you need to do is:
1. Create one HTTP destination in visual administrator at services-> Destinations. Provide HTTP url of the your web service and the security options.
2. Specify this HTTP destination in the code before executing web service model.
Write following code for that:
wdContext.current<node name>Element().modelobject()._setHTTPDestination(<Specify HTTP destination name>);
Then execute your web service model.
Now, whenever you want to change the server on which your web service is running, make change in the HTTP Destination in visual administrator.
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bhavik,
I tried your solution and created a HTTP destination and used that in my code. But if I change the URL in the HTTP destination my web service model still points to the old web service url. Its as though the following line doesn't have any meaning.
modelObject._setHTTPDestinationName("MyService");
Can you please tell if there are any other settings to be done to really make use of HTTP destination for dynamically changing which web service I am pointing to?
Thanks,
Kiran
Hi,
From Webdynpro you can access the same web service from different server without re generating the model.
Go to controller for project modify with following same code:
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;
public void wdDoInit()
{
//@@begin wdDoInit()
InitialContext ctx ;
Object obj;
DestinationService dstService;
Destination destination;
HTTPDestination httpDestination ;
HttpURLConnection httpurlconnection = null;
Properties destprop = null;
String serverName = "";
String serviceURL = "/Service/Config1?style=document";
String prefixURL = "http://";
try
{
ctx = new InitialContext();
obj = ctx.lookup(DestinationService.JNDI_KEY);
dstService = (DestinationService) obj;
destination = dstService.getDestination("HTTP","ApplicationServer");
destprop = destination.getDestinationProperties();
httpDestination = (HTTPDestination) destination;
serverName = httpDestination.getUrl();
prefixURL = prefixURL + serverName;
}
catch(Exception ex)
{
manager.reportException(ex.getMessage(), false);
}
serviceURL = prefixURL + serviceURL;
//$$begin Service Controller(-1594161185)
Request_ServiceViDocument_add Request= new Request_ServiceViDocument_add();
Request._setEndPoint(serviceURL );
wdContext.nodeRequestupdateCmonitor().bind(Request);
}
Do this step also:
(1) In the Package explorer, select your project, right click, cick on "Set Additional Libraries.."
(2) Select security.class and tc/sec/destinations/interface
(3) Click on menu Project > Properties, goto Webdynpro refereces node in the tree and add the following
(a) Interface References: tcsecdestinations~interface
(b) Service References: tcsecdestinations~service
Hope this will solve your problem
Regards
Suresh
Suresh,
I'd just like to say thanks for your solution.
My problem has been this:
I have developed a Web Dynpro application which uses Java persistence to the J2EE server's database, via a web-services call to an EJB (which seems to be SAP's recommended approach). The web service is always on the same host as the Web Dynpro, but we have different instance numbers for Dev, test & Production so the port number keeps changing. This gave us a problem with transporting the Web Dynpro EAR file, but your solution means that the EAR file no longer contains a hard-coded WSDL URL.
It would be nice if SAP added the option of setting a names HTTP destination when creating a Web Service model - until they do, your solution works a treat.
Thanks again,
Darren
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
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.