How to process an array returned by a wsdl – Android

I saw many questions being asked on how to process an array returned by a wsdl, even I had the same problem when I had to retrieve an array from wsdl to android.

So here I would like to share how I retrieved the array and how I have processed it to create it as an array inside Android.

String r = NameArray.columncount("userid", limitstart, loadNumber,loggername);
String temp = r.replaceAll(";\\s", ",").replaceAll("string=", " ")
.replace("anyType{", "").replace(",}", "");
String[] fulname = temp.split(",\\s+");

‘NameArray.columncount’ is my function which gets the array from the wsdl(don’t get confused in that)

step 1- Here I am getting the array values returned from the wsdl in to a string called ‘r’.In this case I am getting an array of numbers Returned array string r looks like this

r ="anyType{string=10054; string=10055; string=10056; string=10035; string=10052; string=10036; string=10037; string=10038; }"

step 2- Then creating a String variable called temp where I am removing all the unwanted characters using the replaceAll function. after removing unwanted characters temp looks like this

temp="10054, 10055, 10056, 10035, 10052, 10036, 10037, 10038"

step3- Finally created a string array called ‘fulname’ and split the modified string with ‘,\s’ Array fulname after split looks like this

fulname = [ 10054, 10055, 10056, 10035, 10052, 10036, 10037, 10038]

This will work fine because all the wsdl array return the same type of string with same unwanted characters

Hope you understood
Good Luck

Advertisements

2 thoughts on “How to process an array returned by a wsdl – Android

  1. Hi there! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My blog looks weird when browsing from my iphone4.
    I’m trying to find a theme or plugin that might be able to resolve this issue.
    If you have any recommendations, please share. With thanks!

    1. Hi, normally all the blog companies have that feature as default. Mine is Word press and it had it as default. It’s better you ask your blog hosting company’s customer support by simply sending a mail or calling.
      šŸ™‚

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s