Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

I can't connect to a web-service for add data

$
0
0

I'm trying to insert data to a DB by web-service connection, but it sends an error: "Internal Server Error".

I don't know why is happening, the web-service works perfect, so I think the problem is in my Javascript code.

I need to send parameters to the web-service, so when the web-service gets the data, the data must be inserted to the DB. The problem is that i don't know if the web-service is recieving correctly the object as a pparameter.

Here's the code:

var myurl = 'http://url.com/prospectos_ws/WSCatalogs.asmx?op=AddCompany';
        var objCompany = {
            'param1' : " ",
            'param2' : prospectoTXT.value,
            'param3' : "1",
        };
 
        var misparams = {
            'token': miToken,
            'company': objCompany
        };
 
        var xhr = Titanium.Network.createHTTPClient();
        xhr.open('POST',myurl);
        xhr.send(misparams);
        xhr.onload = function(e) {
            toast = Ti.UI.createNotification({message:"Got data"});
            toast.show();
        };
 
        xhr.onerror = function(e) {
            Ti.API.error('Error: ' + e);
            toast = Ti.UI.createNotification({message:"Error " + e.error});
                toast.show();
        };
        xhr.setTimeout(20000);

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>