4 Replies Latest reply on Dec 2, 2008 3:54 PM by michael.rollins

    @WebServiceRef for JAX-RPC service?

      Hi, does the @WebServiceRef annotation work for JAX-RPC services?

      I can retrieve and use a service from the InitalContext (so I know it works) but I was hoping to get rid of the JNDI lookup. However if I use @WebServiceRef I just get a NullPointerException. Do I have to do anything fancy in my web.xml in order to enable the annotation scanning? This is all in a servlet.

      I'm using JBossAS 4.2.2.GA upgraded to the latest JBossWS client (3.0.1-native-2.0.4.GA)

      This doesn't work:

      public class TestServiceServlet extends HttpServlet {
      
       @WebServiceRef(wsdlLocation="META-INF/wsdl/IEnNET.wsdl")
       IEnNETService service;
      
       @Override
       protected void doGet(HttpServletRequest req, HttpServletResponse resp)
       throws ServletException, IOException {
      
       try {
       IEnNET port = service.getIEnNETPort(); // throws NPE
       // ...
      


      This does work:
      public class TestServiceServlet extends HttpServlet {
      
       @Override
       protected void doGet(HttpServletRequest req, HttpServletResponse resp)
       throws ServletException, IOException {
      
       try {
       InitialContext ctx = new InitialContext();
       IEnNETService service = (IEnNETService)ctx.lookup("java:comp/env/service/EnNET");
       IEnNET port = service.getIEnNETPort();
      


      web.xml looks like this:
       <service-ref>
       <service-ref-name>service/EnNET</service-ref-name>
       <service-interface>com.gridlogix.webservices.IEnNETService</service-interface>
       <wsdl-file>META-INF/wsdl/IEnNET.wsdl</wsdl-file>
       <jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
       <port-component-ref>
       <service-endpoint-interface>com.gridlogix.webservices.IEnNET</service-endpoint-interface>
       </port-component-ref>
       </service-ref>
      


      Thanks.