on 03-10-2010 4:22 AM
I have successfully imported the webservice model using url into my webdynpro application.Its a global weather webservice where we have to set the city and country name and execute the webservice to get the weather details as a string in one of the model attributes that is getweatherresult.
The model structure mapped on my view is as follows:
Request_Getweather
- Getweather
-> countryname
-> Cityname
-Response
->Getweatherresponse
->Getweatherresult
The whole model structure is as follows:
Webmodel
-Getweather
-Getweatherresponse
-Request_Getweather
-Response_GetWeather
I want to display the weather in chicago on my view so how do I write the coding for this on my view controller .
Hi Anzar,
To get the output from a WebService model:
1. Create a method in the controller (ExecuteWebService)
2. Create the instance of the Model created under the "Models" section of the WD project
3. Bind the object created.
4. Create an Instance of the Request node
5. Bind the object to the Request Node.
6. Set the Input parameters to the Request Node.
7. Execute the WebService
8. Get the output.
Example:
<modelName> <Object> = new <modelName>();
wdContext.nodeRequest<NodeName>().bind(new Request_<NodeName>(<Object>));
wdContext.currentRequest<NodeName>().modelObject().set<InputParameters>(<Attribute to be set>);
wdContext.currentRequest_<NodeName>().modelObject().execute();
Hope this helps you.
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get the following error now
com.sap.tc.webdynpro.model.webservice.api.WDWSModelExecuteException: Exception on execution of web service with WSDL URL 'http://srepldev:50400/wsdl/globalweather.WSDL' with operation 'GetWeather' in interface 'GlobalWeatherSoap'
I have written the code as follows:
Webmodel model1= new Webmodel();
Request_GetWeather requestmo= new Request_GetWeather(model1);
GetWeather getweathermo = new GetWeather(model1);
getweathermo.setCityName("CHICAGO");
getweathermo.setCountryName("UNITED STATES");
requestmo.setGetWeather(getweathermo);
wdContext.nodeRequest_GetWeather().bind(requestmo);
try{
wdContext.currentRequest_GetWeatherElement() .modelObject().execute();
wdContext.nodeResponse().invalidate();
}
catch(Exception e)
{
String msg = e.getLocalizedMessage();
if ((msg==null) || (msg.length()==0))
{
msg = e.getMessage();
}
wdComponentAPI.getMessageManager().reportException(e.toString(),true);
}
Hi Anzar,
You can not check the services from site http://www.webserviceX.NET in webservice navigator. And please have a look in following code snippet
Webmodel model1= new Webmodel();
Request_GetWeather requestmo= new Request_GetWeather(model1);
wdContext.nodeRequest_GetWeather().bind(requestmo); // Please add this line the model node should
GetWeather getweathermo = new GetWeather(model1); // be binded with application node
getweathermo.setCityName("CHICAGO");
getweathermo.setCountryName("UNITED STATES");
requestmo.setGetWeather(getweathermo);
wdContext.nodeRequest_GetWeather().bind(requestmo);
try{
wdContext.currentRequest_GetWeatherElement() .modelObject().execute();
wdContext.nodeResponse().invalidate();
}
catch(Exception e)
{
String msg = e.getLocalizedMessage();
if ((msg==null) || (msg.length()==0))
{
msg = e.getMessage();
}
wdComponentAPI.getMessageManager().reportException(e.toString(),true);
}
Give it a try and let us know. The same reply i have posted in your another thread. Please revert back in case of any issue.
Regards
Jeetendra
HI
I used the code provided by you by I get this error again
com.sap.tc.webdynpro.model.webservice.api.WDWSModelExecuteException: Exception on execution of web service with WSDL URL 'http://srepldev:50400/wsdl/globalweather.WSDL' with operation 'GetWeather' in interface 'GlobalWeatherSoap'
See I ll tell you what I have done.
I have placed my wsdl file by creating a wsdl place holder in our server through visual admin by following steps in the given link.
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2684. [original link is broken] [original link is broken] [original link is broken]
I published the webservice through my uddi client and was alos able to search for it and get it in test registry. . But then when I try to import it through the nwds wizard for importing adaptive webservice model and search for it in the client through that wizard I don't get the webservice.
So I decided to go for an alternate way and import the model using the url of wsdl placed in wsdl place holder on our server. But now I am getting this error .
Please guide me if I am going wrong in my approach anywhere. Thanks for your help.Please guide me I want to crack this topic.
User | Count |
---|---|
96 | |
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.