tags:

views:

414

answers:

1

I'm using IBM's Rational Software Architect (essentially Eclipse I suppose). I have a JAR file that contains Proxy classes to access a Web Service (JAX-RPC). I've created a Dynamic Web Project with a simple JSP page in which I'm trying to consume the Web Service using a Proxy class from this library. Code from the JSP page:

<jsp:useBean id="queryProxy" scope="session" class="location.DataSearchProxy" />
<% queryProxy.setEndpoint("http://localhost:9080/CIDataService/services/DataSearch"); %>
<%=queryProxy.query("SELECT street, city, prov, postcode FROM v_location WHERE c1 = '48704'") %>

At this point I have added the External JAR file to the Libraries section of the Build Path, however when running the JSP page on WebSphere in-browser; I get the "DataSearchProxy cannot be resolved to a type" error.

I have also tried using:

<%@ page import="location.DataSearchProxy" %>
<% DataSearchProxy queryProxy = new DataSearchProxy(); %>
<% queryProxy.setEndpoint("http://localhost:9080/CIDataService/services/DataSearch"); %>
<%=queryProxy.query("SELECT street, city, prov, postcode FROM v_location WHERE c1 = '48704'") %>

But I get the same error. I have a feeling for this type of Web-Project I may need to reference it in some other way so it can be resolved from JSP pages or other Beans in the project. I may be going about this in the wrong way and I hope someone can point me in the right direction for consuming a Web Service from JSP.

+1  A: 

You probably want to package the jar into your application.

  1. Remove it from your build path (we'll add it back later)
  2. Put the JAR in the root of the EAR, drag it to your Application project, not the WEB App
  3. Open your Web project properties and go to JEE dependencies. You should see the jar offered there. Select it and it will add it to both the build time classpath and also the Manifest so that it's picked up at runtime.
djna
Ah perfect! that was the exact issue thanks!
Jeff Dalley