Note that there are some explanatory texts on larger screens.

plurals
  1. POConsuming a Java Webservice with JQuery: Error?
    primarykey
    data
    text
    <p>I created a Java web service in Netbeans 7.1.2 and managed to create a Java client also through netbeans to test it, and it worked. I then tried to create a jQuery client but failed. </p> <p>The jQuery client code is:</p> <pre><code>$.ajax({ type: "POST", url: "http://luke-test.j.layershift.co.uk/ClubInService/getHello", data: "{val:luke}", contentType: "application/json; charset=utf-8", dataType: "json", success: OnSuccessCall, error: OnErrorCall }); function OnSuccessCall(response) { $tmp = ""; $.each(response, function(index, element) { $tmp += element + ";"; }); alert($tmp); } function OnErrorCall(response) { $tmp = ""; $.each(response, function(index, element) { $tmp += element + ";"; }); alert($tmp); } </code></pre> <p>The function I am trying to call is:</p> <pre><code>@WebMethod(operationName = "getHello") public String getHello(@WebParam(name = "val", targetNamespace = "http://clubinservice/") String val) { return "Hello " + val + "!"; } </code></pre> <p>When using jQuery to consume the Java web service, I receive this error and have no clue what it means:</p> <blockquote> <p>0;function (a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this};function (){return s===2?n:null};function (a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c};function (a){s||(d.mimeType=a);return this};function (a){a=a||"abort",p&amp;&amp;p.abort(a),w(0,a);return this};function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this};function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this};function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this};function (){return e};function (){return!!i};function (){return!!i};function (a,b,c){i.done(a).fail(b).progress(c);return this};function (){i.done.apply(i,arguments).fail.apply(i,arguments);return this};function (a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?ia:ia})}).promise()};function (a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a};function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this};function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this};function (){if(c){var a=c.length;n(arguments),j?l=c.length:e&amp;&amp;e!==!0&amp;&amp;(k=a,o(e[0],e[1]))}return this};function (a){if(a){var b;if(s&lt;2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this};;0;error;</p> </blockquote> <p>Feel free to try and use the function on the web service if it will help. Any help would be great!</p> <p>Thanks</p> <p><strong>EDIT</strong></p> <p>After realising that i should be using JSON.stringify and thus:</p> <pre><code>function OnSuccessCall(response) { alert(JSON.stringify(response)); } function OnErrorCall(response) { alert(JSON.stringify(response)); } </code></pre> <p>I received a different error message:</p> <pre><code>{"readyState":0,"responseText":"","status":0,"statusText":"error"} </code></pre> <p>After looking <a href="https://stackoverflow.com/questions/7018247/jquery-ajax-error-readystate0-responsetext-status0-statustexterr">here</a> and <a href="https://stackoverflow.com/questions/6818939/jquery-post-respond-with-readystate0-status0">here</a> I tried</p> <pre><code>$.post("http://luke-test.j.layershift.co.uk/ClubInService/getHello", {val: "John"}, function(data){ alert(JSON.stringify(data)); }, "json") .error(function(data){alert(JSON.stringify(data));}); </code></pre> <p>which also returned the error message:</p> <pre><code>{"readyState":0,"responseText":"","status":0,"statusText":"error"} </code></pre>
    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.
 

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