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.
If it were me, I would use jQuery.
http://www.bennadel.com/blog/1853-Posting-XML-SOAP-Requests-With-jQuery.htm http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/ http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx
<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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With