cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynPro example

Former Member
0 Kudos
462

Is there a webservices demo that shows how to retreive data into webdynpro model ?

The 2 examples only send data to a webservice and only show a result of success or failiure.

What if we get a table of data back from the webservice. How do we address the data in the table or array ?

Greetings Danny.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Danny,

well with arrays it works the same way. I give an example of a webservice from xmethods where you can get the current Marketheadlines from Reuters.

The wsdl file is here: http://www.xignite.com/xnews.asmx?WSDL

The structure of the webservice might be like this:

-

-


Request_XigniteNewsHttpGet_getReutersMarketNewsHeadLines

+- Response_Xignite_getMarketHeadLines( cardinality: 0..1)

+- Result (of type JavaBean_MarketNews)(Cardinality: 0..n)

+-summary(string)

+-href

+date


You will see this as context structure once you bound the Request ModelClass to a model node in your view.
What you see here is that the the result of the response is not a simple type like an integer anymore as it was in the email webservice but it references an array of ModelClass of the type JavaBean_MarketHeadLines. You can see this because the cardinality of result is (0..n). You can just bind the Result Object to a table to visualize the array.


Steps to do :
1)Import the webservice from the given URL.
2) Add model to your component
3) Create a a view under the component
4) Go to tab context, create a Model Node with name:"Request_XigniteNewsHttpGet_getReutersMarketNewsHeadLines"
Right click on the model node "Request_XigniteNewsHttpGet_getReutersMarketNewsHeadLines"
and choose "edit model binding".
Map the model node "Request_XigniteNewsHttpGet_getReutersMarketNewsHeadLines" to the model class "Request_XigniteNewsHttpGet_getReutersMarketNewsHeadLines". Keep the Response and Result items checked.


The code in the wdInit method of the view could look like this:


..
Request_XigniteNewsHttpGet_getReutersMarketNewsHeadlines req = new Request_XigniteNewsHttpGet_getReutersMarketNewsHeadlines();
wdContext.nodeRequest_XigniteNewsHttpGet_getReutersMarketNewsHeadLines().bind(req);




Create a button and a action.
in the action you provide this code:


public void onActionXy(..)
{
//@@begin ..
try
{
wdContext.nodeRequest_XigniteNewsHttpGet_getReutersMarketNewsHeadLinesElement().modelObject().execute();
//inform the client side framework that the underlying model has changed
wdContext.nodeResponse().invalidate();
}
catch(Exception ex)
{
}

//@@end
}



Up to now it all looked the same as the email webservice. In the layout of the view you can now add a table to the screen. After that you can right click on the table and say "Create Binding" you just select the Result Node of the context and bind it to the table.

Have fun

Former Member
0 Kudos

David,

I followed the steps you described but it seemes that after the execute is the application hangs. I can see that there is a request to the internet as my lan-adapter's light flahes but i get no result back. in other words after pushing the button the request stayes out for a very long time without any result.

What could be wrong ?

Greetings Danny

Former Member
0 Kudos

Hi,

I've developed one WebServices demo application in webdynpro.You can access that application from perforce

Location:


tcwebdynprosampleapps630_sp_corsrc_webdynpro_webservices

Regards

AnilKumar