KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have been experimenting and trying to learn JQuery, using AJAX to consume a SOAP web service I had written some time ago. Below is the code I am using: <script type="text/javascript"> var webServiceURL = 'http://local_server_name/baanws/dataservice.asmx?op=GetAllCategoryFamilies'; var soapMessage = '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:Body><GetAllCategoryFamilies xmlns="http://tempuri.org/" /></soap12:Body></soap12:Envelope'; function CallService() { $.ajax({ url: webServiceURL, type: "POST", dataType: "xml", data: soapMessage, contentType: "text/xml; charset=\"utf-8\"", success: OnSuccess, error: OnError }); return false; } function OnSuccess(data, status) { alert(data.d); } function OnError(request, status, error) { alert('error'); } $(document).ready(function() { jQuery.support.cors = true; }); </script> <form method="post" action=""> <div> <input type="button" value="Call Web Service" onclick="CallService(); return false;" /> </div> </form> Currently, the method being called in the web service returns an array of category families that contain a category code and a category description. Since the method returns XML, I set the ajax query accordingly. However, when I run the app, I get an 'error' alert box - I am sure what would be causing the problem. I know the web service works, it's called several hundred times a day by other .NET web apps that I've written. Any help would be greatly appreciated. Thanks,
Tags (comma-separated)
Save Edits
Cancel