cancel
Showing results for 
Search instead for 
Did you mean: 

Formating the response of Java webservice to table structure in webdynpro

Former Member
0 Kudos

Hi All,

I am stuck at a point where I have a Java Webservice resulting an ArrayList Response.

My webdynpro will have to populate the ArrayList response into a table.

Below is the piece of code am using to execute my webservice.

CODE :

JavajdbcModel md = new JavajdbcModel();

Request_Display reqDisp= new Request_Display(md);

try

{

reqDisp.execute();

wdComponentAPI.getMessageManager().reportSuccess("Str: "+reqDisp.getResponse());

}

RESULT :

<modelObject class="Response_Display"><target roleName="DisplayResponse"><modelObject class="DisplayResponse"><attribute name="Response" value="[[i01111, USSS, DSGTechTwo, DEF], [i012345, USSS, DSGTechOne, ABC], [i067890, USSS, DSGTechTwo, DEF], [i07777, USSS, DSG, ggg], [i08888, cccc, vvvv, bbbb], [io3333, USSS, DSGTechOne, abc]]"/></modelObject></target></modelObject>

The required output are the values that are with the blue font above.

I have tried with methods like :

getAttributeValue, getResult - but are of not much help.

Could you please help me out in this.

Thanks & Regards,

Suyukti. B N.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Suyukti,

Since your web service returns an arraylist,

you need to retreive the response into an arraylist. Then you can you this arraylist to populate the node for the table as required.

Your code will be something like

ArrayList al = (ArrayList)reqDisp.getResponse();

Now that you have the response, then use the get function of the arraylist to set the context.

al.get(index);

This function returns java.lang.Object, so you need to to cast into the required type.

e.g. String str = (String) al.get(0);

Hope that works.

Regards,

Mayuresh.

PS: xxxxxxxxxxxxxxxxxxxxxxxxxx

Edited by: Armin Reichert on Jan 1, 2008 3:49 PM