[jboss-user] [JBossWS] - JBoss & JAX-WS. Beginners Guide
JGF1
do-not-reply at jboss.com
Tue Mar 11 15:00:50 EDT 2008
Hi folks.
I've recently been finished reading a book called Beginning Java EE 5 Platform from Novice to Professional.
It contained an example using JAX-WS.
When I tried to locate one of the jars, I couldn't find it:
ie:jbossws.jar. According to book it's in jbossws.sar folder..
Tried compiling code without this but came across two errors based on jars in my classpath:
warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jsr173_1.0_api.jar": no such file or directory
warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jaxb1-impl.jar": no such file or directory
1) Wondered if someone could shed some light on this for me?
(The authors do state the JAX-WS was incomplete at the time the book was being written. I have downloaded jboss-4.2.2ga,
- Says no full implementations of JSR-181 WS meta-data for J EE 5/JAX-WS 2.0 formerly JAX-RPC. Book was published in 2006...)
These are the jars in my classpath:
c:\apps\jboss-4.2.2.ga\server\all\lib\servlet-api.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jsp-api.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jbossws.sar\wsdl4j.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-jaxrpc.jar;
c:\apps\jboss-4.2.2.ga\lib\concurrent.jar;
c:\apps\jboss-4.2.2.ga\lib\jboss-common.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-j2ee.jar;
c:\apps\jboss-4.2.2.ga\lib\commons-httpclient.jar;
c:\apps\jboss-4.2.2.ga\client\jbossall-client.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-remoting.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-transaction.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jnpserver.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\ejb3.deployer\jboss-ejb3.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-ejb3x.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aop-jdk50.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aspect-library-jdk50.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-common-client.jar;c:\apps\jboss-4.2.2.ga\client\jbosssx-client.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\ejb3-persistence.jar;C:\apps\apache-tomcat-6.0.16\lib\jsf-api.jar;
(The ones in bold I have just added. The ejb3 ones are the others they say are required as well as the missing jbossws.jar)
This was the example
| package webservices;
|
| import java.rmi.Remote;
|
| public interface SimpleService extends Remote
| {
| String echo(String input);
| }
|
| package webservices;
|
| import org.jboss.annotation.ejb.RemoteBinding;
| import org.jboss.ws.annotation.PortComponent;
|
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
|
| @WebService(name = "EndpointInterface", targetNamespace = "http://localhost",
| serviceName = "SimpleService")
| @PortComponent(contextRoot="/jbosswsest", urlPattern="/*")
| @Remote(SimpleService.class)
| @Stateless
| public class SimpleServiceImpl implements SimpleService
| {
| @WebMethod
| public String echo(String input)
| {
| return input;
| }
| }
|
| package client;
|
| import webservices.SimpleService;
| import javax.xml.rpc.ServiceFactory;
| import javax.xml.rpc.Service;
| import javax.xml.namespace.QName;
| import java.net.URL;
|
| public class SimpleServiceClient {
| private static final String _namespace = "http://localhost";
| private static final String _service = "SimpleService";
| private static final String _wsdl = "http://localhost:8080/jbosswstest?wsdl";
|
| public static void main(String[] args) {
| try {
| URL defUrl = new URL(_wsdl);
| // Create the Service Factory
| ServiceFactory serviceFactory = ServiceFactory.newInstance();
| // Load the service implementation class
| Service remoteService = serviceFactory.createService(defUrl,
| new QName(_namespace, _service));
| // Load a proxy for our class
| SimpleService invoker =
| (SimpleService) remoteService.getPort(SimpleService.class);
| // Invoke our interface for each argument
| for (int i = 0; i < args.length; i++) {
| String returnedString = invoker.echo(args);
| System.out.println("sent string: " + args
| + ", received string: " + returnedString);
| }
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
My compile fails with the following:
| warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jsr173_1.0_api.jar": no such file or directory
| warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jaxb1-impl.jar": no such file or directory
| webservices\SimpleServiceImpl.java:3: package org.jboss.annotation.ejb does not exist
| import org.jboss.annotation.ejb.RemoteBinding;
| ^
| webservices\SimpleServiceImpl.java:4: package org.jboss.ws.annotation does not exist
| import org.jboss.ws.annotation.PortComponent;
| ^
| webservices\SimpleServiceImpl.java:13: cannot find symbol
| symbol: class PortComponent
| @PortComponent(contextRoot="/jbosswsest", urlPattern="/*")
| ^
| 3 errors
| 2 warnings
|
The book says you need the following to run client app:
c:\apps\jboss-4.2.2.ga\client\jboss-jaxrpc.jar;
c:\apps\jboss-4.2.2.ga\client\log4j.jar;
c:\apps\jboss-4.2.2.ga\client\logkit.jar;
c:\apps\jboss-4.2.2.ga\client\jbossws-client.jar;
c:\apps\jboss-4.2.2.ga\client\activation.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-saaj.jar;
c:\apps\jboss-4.2.2.ga\client\mail.jar;
c:\apps\jboss-4.2.2.ga\client\wsdl4j.jar;
c:\apps\jboss-4.2.2.ga\lib\endorsed\xercesImpl.jar;
c:\apps\jboss-4.2.2.ga\client\jbossall-client.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-remoting.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\javax.servlet.jar
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135754#4135754
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135754
More information about the jboss-user
mailing list