Take the 2-minute tour ×

I've created a line of code that function to read data from SOAP service. But I have a little problem. I'm using JSONP Lib in this task but has not produced results. I tried the same with less code to read the output of a database query and the results were successful. Is there a difference between these two methods? The first one I made ​​the PHP code to transfer the array into the form of json :


$Param1 = "bertho_joris@yahoo.co.id";
$Param2 = "12345";

$client = new nusoap_client('http://vcare.telkomvision.net.id/services/VcareServices.php');
$ReadSOAP = $client->call('validateLogin', array('EMAIL' => $Param1, 'PASSWORD' => md5($Param2)));

echo '{"items":['. json_encode($ReadSOAP) .']}';

And the data produced by the above code is :

"items": [
        "NE": "42616324457",
        "EMAIL": "bertho_joris@yahoo.co.id",
        "TIPE": "POSTPAID",
        "TELP": "081310117966 / 087878837451",
        "DN": "127225148174",
        "STATUS_LOGIN": "1",
        "DESC_LOGIN": "Valid"

I use the library below to process the output data to be read later in my application : JSONP Library

JSONP.get( 'MyURL.php', {Email:'MyEmail', Password:'MyPass'}, function(data){
    for ( var i = 0; i < response.length; ++i ) {
          str = response[i].ne;
          str2 = response[i].email;
          str3 = response[i].tipe;
          str4 = response[i].nama;
          str5 = response[i].telp;
          str6 = response[i].dn;
          str7 = response[i].desc_login;

But the result I get is : My application can not read data output directly from the SOAP above. I am confused why be like that. And I think JSON format is correct.

Then I tried to read the data directly from the database. This database is a sample, and I accidentally made ​​the same data with the output of the SOAP reading process above.

And the result, I successfully get the data.

I include two links that I use to do the reading.

  1. This link is the php file that processes the SOAP directly from the server and the output is JSON : Failed to Reading

  2. This is the direct link to the database with a dummy database. JSON output. And I succeed using this second method : Success to Reading

Please help me resolve my problem was. The point I want to read the data directly from the process using the SOAP form that outputs JSON. as I have described as a failure.

Thank you

share|improve this question
(i) you should be iterating data.items (ii) JavaScript and JSON is case sensitive. foo.ne is not the same as foo.NE. –  Salman A Nov 21 '12 at 17:55
I have changed and equating –  Bertho Joris Nov 21 '12 at 17:58
Wait a little help..:( –  Bertho Joris Nov 21 '12 at 18:23
(iii) where is response coming from? –  Salman A Nov 21 '12 at 19:48
add comment

1 Answer

up vote 0 down vote accepted

Try this:

    for (var i = 0; i < response.length; i++) 
        str  = response[i].NE;
        str2 = response[i].EMAIL;
        str3 = response[i].TIPE;
        str4 = response[i].NAMA;
        str5 = response[i].TELP;
        str6 = response[i].DN;
        str7 = response[i].DESC_LOGIN;
share|improve this answer
add comment

Your Answer


