[jboss-user] [JBossWS] - @WebServiceRef for JAX-RPC service?

tomstrummer do-not-reply at jboss.com
Fri Jun 6 13:17:11 EDT 2008


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156382#4156382

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4156382



More information about the jboss-user mailing list