Skip to Content
avatar image
Former Member

Problem with getting output from a Web Service

Hi Experts,

I have converted a BAPI into Web Service and have created a model using Adaptive Web Service. This Web Service takes two values as input and the output is a table. I mapped the response with a table template, but the output is null. I tried putting an external debugger in the backend to check if the BAPI is being called and it is executing perfectly. I even tried the same code with another Web Service created from another BAPI and there the input is one value and the output is also just one value. in that case when i use the same code I am getting the required output. but when i have a table as an output, I am not getting the values to the frontend. I am using Webdynpro Java. Please help me with this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Mar 15, 2010 at 03:47 PM

    Hi Satish,

    Please go through below links :-

    [Consuming ABAP Web Service in Java WD |http://wiki.sdn.sap.com/wiki/display/WDJava/ConsumingABAPWebServiceinJavaWD]

    [FAQ - Models - Adaptive Web Service |http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-AdaptiveWebService]

    Hope it helps now.

    Thanks

    Arun Jaiswal

    Edited by: Arun Jaiswal on Mar 15, 2010 9:19 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 16, 2010 at 10:36 AM

    Hi Satish,

    I believe the output of the web service is a table but is returned in terms of a list. So, you need to extract each available element of the list and create elements of the table node accordingly rather than directly binding it to the table.

    Regards,

    Tushar S

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 16, 2010 at 03:19 PM

    Hi Tushar,

    Thanks for the reply. I was guessing the same , but can you help me out if you have a code snippet or some sample, so that i can build it from there.

    Thanks

    Satish

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      try

      {

      //execute the request

      request.execute() ;

      //get the response object from request execution

      response = request.getResponse() ;

      <yourOutputStructure>_Resp = response.get<OutputStructure>( ) ;

      //get the logs

      Log log = <yourOutputStructure>_Resp.getLog( ) ;

      for( int i=0; i<log.getItem().size(); i++)

      {

      //You can access all the elements like this 1 by 1

      LogItem logItem = ( LogItem ) log.getItem().get(i);

      //Custom Bean

      LogItemBean itemBean = new LogitemBean( ) ;

      //For getting error messages if any

      if( logItem.getSeverityCode().equalsIgnoreCase("E") ){

      itemBean.setNote( logItem.getNote( ) ) ;

      itemBean.setSeveriCode( logItem.getSeverityCode( ) );

      itemBean.setTypeId( logItem.getTypeID( ) ) ;

      itemBean.setWebURI( logItem.getWebURI());

      }

      }

      }

      catch( Exception e)

      {}

      Regards,

      Tushar S

  • avatar image
    Former Member
    Mar 18, 2010 at 08:17 PM

    Thank You Tushar. I will try this and get back to you.

    Thanks

    Satish

    Add comment
    10|10000 characters needed characters exceeded