Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax call restful WS is always getting error (fiddler gets the good response)
    primarykey
    data
    text
    <p>I have made Restfull WS in VS 2010 with two simple method (one GET, another POST). They look like: </p> <pre><code>[ServiceContract] public interface IService1 { [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "createUser")] string createUser(); [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, UriTemplate = "loginUser/{email}/{password}")] string loginUser(string email, string password); } </code></pre> <p>Definition of these methods is simple:</p> <pre><code>public class Service1 : IService1 { public string createUser() { return "Successful POST call !!! "; } public string loginUser(string email, string password) { return "Successful GET call !!! " + email + " - "+ password; } } </code></pre> <p>I have published this service to IIS and tested my method in browser (only loginUser (GET) method, cannot test createUser (POST) method by the browser) and method (loginUser ) work fine. When I tried to call method by jQuery AJAX, I am always getting error call without any notification. I checked my fiddler and there are the right response.</p> <p>My Ajax method:</p> <pre><code>$(document).ready(function(){ $("#button2").click(function(){ $.ajax({ type: "GET", url: "http://localhost/AutoOglasi/Service1.svc/loginUser/bole/bole", success: function (response) { alert("respons "+response); }, error: function (request, status, error) { alert(request.responseText+" -- " + status + " --- "+ error); } }); }); }); </code></pre> <p>I mozila firebug i section XML I get this:</p> <p>XML Parsing Error: no element found Location: moz-nullprincipal:{ba25ef4a-f215-486e-b965-e70714c5af31} Line Number 1, Column 1: ^</p> <p>What I am doing wrong here, I just cannot figure out, because fiddler is giving me good response?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload