X

Geertjan's Blog

  • March 30, 2006

JAX-WS Client Sample for NetBeans IDE 5.5

Geertjan Wielenga
Product Manager
Want to see what a JAX-WS client is like? Well, you'll need a 5.5 development build of NetBeans IDE as well as the most recent development build of Glassfish (i.e., Sun Java System Application Server 9) as you can find. Then, download and install this plug-in module:

org-netbeans-modules-jaxwsclient.nbm

In the New Project wizard, go to the Samples category, and you'll find a new "Web" category with one sample project, called "JAXWSClient". Click Next and then Finish. You'll have the client that is described in the NetBeans IDE 5.0 Tutorial for Web Service Clients in the Projects window. However, the tutorial describes a JAX-RPC web service client. In this case, you now have a JAX-WS web service client. They do the same, but the code is a bit different. NetBeans IDE generates different code for JAX-WS than for JAX-RPC, which is obvious since they're different web service architectures. However, post-code generation, the only difference in the implementation was that in the client, the arrays of strings had to be changed to lists. For some reason that I don't understand, JAX-WS seems to work with lists, while JAX-RPC uses arrays of strings. Or maybe that's more a difference between J2EE 1.4 and Java EE 5 than between JAX-RPC and JAX-WS.

Finally, before deploying the client, if you're behind a firewall, you'll need to set the proxy on Glassfish. Use the Runtime window (start the server, expand the server's node, right-click the JVMs node, and add the proxy host and port to the JVMOptions property and then make sure to restart the server).

If you get it up and running, you'll find that you have a web application that interacts with a spell checker web service. You type some words in the JSP's text area and then the servlet interacts with the web service to suggest alternative spellings for the words that are incorrectly spelled.

Join the discussion

Comments ( 4 )
  • Gregg Sporar Thursday, March 30, 2006
    FWIW, setting the proxy on Glassfish (actually on version 8.x of Sun Java System Application Server, but the info. is the same) is described (with pictures! :-) ) in this blog entry.
  • naveen Thursday, September 28, 2006
    hi
    this is very will you provide for eclipse/WSAD also
    that will be helpfull for me
  • Geertjan Thursday, September 28, 2006
    I think the Eclipse/WSAD folks should do that, Naveen...
  • Dmitri Tuesday, December 23, 2008

    Hi Geertjan,

    I've tied this SpellChecker tutorial, but unfortunatelly, I've got an error wnen I hit the spell check button. I followed the tutorial precisely and definitely put the SpellCheckServlet.java into clientservlet package. I've posted the problem into netbeans forum but no response. What am I doing wrong?

    The error is:

    HTTP Status 500 -

    type Exception report

    javax.servlet.ServletException: Error instantiating servlet class clientservlet.SpellCheckServlet

    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    java.lang.Thread.run(Thread.java:619)

    root cause

    javax.naming.NameNotFoundException: Name clientservlet.SpellCheckServlet is not bound in this Context

    org.apache.naming.NamingContext.lookup(NamingContext.java:770)

    org.apache.naming.NamingContext.lookup(NamingContext.java:153)

    org.apache.catalina.util.DefaultAnnotationProcessor.lookupFieldResource(DefaultAnnotationProcessor.java:203)

    org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:144)

    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)

    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)

    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

    java.lang.Thread.run(Thread.java:619)

    I suppose u

    you have got it running. Can you please help me to resolve this problem?

    Dmitri


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.