Paths and Getting Started Guide
jerryp64 Dec 17, 2004 12:20 PMI am using the Getting Started guide to develop my own web service. One of the questions I came up with that I do not see discussed in the guide is the classpath of the Axis files. I created a sub-directory on my server that I copy the Axis JAR files in to, but I have to believe this is not the best solution.
Are the JAR files on the server somewhere that I can add to my classpath? I am doing all of this in an Ant script and it works, but I don't feel like I should have to copy the Axis files to the server.
I have the service deployed and I can access it via the URL, but I am getting the following exception when I try to run my client.
[java] java.lang.IllegalAccessError: tried to access field org.apache.axis. client.Service.engine from class org.jboss.webservice.client.ServiceImpl [java] at org.jboss.webservice.client.ServiceImpl.getAxisClient(Service Impl.java:255) [java] at org.apache.axis.client.Service.<init>(Service.java:185) [java] at org.jboss.webservice.client.ServiceImpl.<init>(ServiceImpl.ja va:99) [java] at org.jboss.webservice.client.ServiceFactoryImpl.createService( ServiceFactoryImpl.java:112) [java] at com.hott.client.WSClient.main(Unknown Source) [java] Exception in thread "main"
I am using the exact code that comes from the Getting started guides files.
Here is my client code:
package com.hott.client; import javax.xml.rpc.Call; import javax.xml.rpc.Service; import javax.xml.rpc.JAXRPCException; import javax.xml.rpc.ServiceFactory; import javax.xml.rpc.ParameterMode; import javax.xml.namespace.QName; import java.net.URL; import com.hott.service.BookSessionEndpoint; /** * * @author HOTT Instructor */ public class WSClient { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception{ URL url = new URL("http://localhost:8080/ws4ee/services/BookSessionService?wsdl"); QName qname = new QName("http://service.hott.com", "BookSessionService"); ServiceFactory factory = ServiceFactory.newInstance(); Service service = factory.createService(url,qname); BookSessionEndpoint endpoint = (BookSessionEndpoint) service.getPort(BookSessionEndpoint.class); String byISBN = endpoint.findByISBN(99415); String byTitle = endpoint.findByTitle("Little Women"); String byPrice = endpoint.findByPriceRange(0,100); System.out.println("By ISBN:" + byISBN); System.out.println("By Title:" + byTitle); System.out.println("By Price:" + byPrice); } }
Thanks