Skip to Content
avatar image
Former Member

WebDynPro example

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 09, 2003 at 12:44 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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