abs
abs

Reputation: 650

how do i call a webservice using phonegap for android

How do I make a webservice call from my phonegap app? I found two javascript libraries one from IBM and another IvanWebService http://wiki.phonegap.com/w/page/43725416/SOAP%20Web%20Service that allow you to make such calls but i couldnt get them to run any of my webservices. I am passing in a wsdl link as the service link and i have updated the envelope parameters, still nothing.

Upvotes: 6

Views: 21786

Answers (2)

Vinayak Bevinakatti
Vinayak Bevinakatti

Reputation: 40503

<head>

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>

<script type="text/javascript">
        $(function() {

            $("#requestXML").click(function() {

                     $.ajax({
                      type: "POST",
                      url: "http://YOURSITE/script.php",
                      data: "{}",
                      cache: false,
                      dataType: "xml",
                      success: onSuccess
                    });

            });

            $("#resultLog").ajaxError(function(event, request, settings, exception) {
              $("#resultLog").html("Error Calling: " + settings.url + "<br />HTTP Code: " + request.status);
            });

             function onSuccess(data)
              {   alert(data);
               }


        });

        </script>

</head>

Button to call the above method:

<input id="requestXML" type="button" value="Request XML" />

Upvotes: 1

Related Questions