title: jQuery consumes a JSON JAX-WS web service
body: <p>I tried to utilize jQuery to consume a JSON JAX-WS web service, using <a href="http://weblogs.java.net/blog/kohsuke/archive/2007/04/jaxws_ri_extens.html" rel="nofollow">JAX-WS RI for JSON</a></p>
  
  <p>I tried to follow their instruction, but can't make a call from javascript client to JAX-WS web service, although the web service was built successfully.</p>
  
  <p>Here is my code:</p>
  
  <p>Server side:</p>
  
  <pre><code>@BindingType(JSONBindingID.JSON_BINDING)    
  @WebService 
  public class Greeting
  {       
      public Book get(@WebParam(name="id") int id) {
          Book b = new Book();
          b.id = id;
          return b;
      }
  
      public static final class Book {
          public int id = 1;
          public String title = "Java";
      }
  
  }
  </code></pre>
  
  <p>Client side:</p>
  
  <pre><code>&lt;header&gt;
  &lt;script src="http://localhost:8080/webservice/soap/greeting?js"&gt; &lt;/script&gt;
      $(document).ready(function()  {
          $("#btnJson1").click(function() {
               document.getElementById("jsonprompt").innerHTML="Start JSON --- ";
               GreetingService.get(
                {id:5},
                function(r) {
                    document.getElementById("jsonprompt").innerHTML="Book Title: " + r.title;
                    }
              );
      } );
  &lt;/header&gt;
  </code></pre>
  
  <p>Any comment or suggestion will be highly appreciated.</p>
  
  <p>If there's any solution to consume a JAX-WS service using jQuery over JSON will be highly appreciated too.</p>
  
  <p>Thank in advance.</p>