[jboss-cvs] JBossAS SVN: r82728 - in projects/ejb3/trunk/docs/tutorial: webservice and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 9 06:09:52 EST 2009


Author: jaikiran
Date: 2009-01-09 06:09:52 -0500 (Fri, 09 Jan 2009)
New Revision: 82728

Added:
   projects/ejb3/trunk/docs/tutorial/webservice/
   projects/ejb3/trunk/docs/tutorial/webservice/build.xml
   projects/ejb3/trunk/docs/tutorial/webservice/jndi.properties
   projects/ejb3/trunk/docs/tutorial/webservice/log4j.xml
   projects/ejb3/trunk/docs/tutorial/webservice/pom.xml
   projects/ejb3/trunk/docs/tutorial/webservice/src/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/Calculator.java
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/CalculatorBean.java
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/client/
   projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/client/Client.java
Log:
Working version of the WebService tutorial for JBossAS-5.0 GA

Added: projects/ejb3/trunk/docs/tutorial/webservice/build.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/build.xml	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file                                                       -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+   <property environment="env"/>
+   <property name="src.dir" value="${basedir}/src"/>
+   <property name="jboss.home" value="${env.JBOSS_HOME}"/>
+   <property name="jboss.server.config" value="default"/>
+   <property name="build.dir" value="${basedir}/build"/>
+   <property name="build.classes.dir" value="${build.dir}/classes"/>
+   <property name="build.artifact" value="jboss-ejb3-tutorial-webservice.jar"/>
+
+   <!-- Build classpath -->
+   <path id="classpath">
+      <!-- So that we can get jndi.properties for InitialContext -->
+      <pathelement location="${basedir}"/>
+   		<!-- The jbossall-client.jar and webservice related jar file-->
+      <fileset dir="${jboss.home}/client">
+         <include name="**/*.jar"/>
+      </fileset>
+   	<fileset dir="${jboss.home}/lib/endorsed">
+   		<include name="**/xercesImpl.jar"/>
+   </fileset>
+   	
+      <pathelement location="${build.classes.dir}"/>
+   </path>
+
+   <property name="build.classpath" refid="classpath"/>
+
+   <!-- =================================================================== -->
+   <!-- Prepares the build directory                                        -->
+   <!-- =================================================================== -->
+   <target name="prepare">
+      <mkdir dir="${build.dir}"/>
+      <mkdir dir="${build.classes.dir}"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Compiles the source code                                            -->
+   <!-- =================================================================== -->
+   <target name="compile" depends="prepare">
+      <javac srcdir="${src.dir}"
+         destdir="${build.classes.dir}"
+         debug="on"
+         deprecation="on"
+         optimize="off"
+         includes="**">
+         <classpath refid="classpath"/>
+      </javac>
+   </target>
+
+   <target name="ejbjar" depends="compile">
+      <jar jarfile="build/${build.artifact}">
+         <fileset dir="${build.classes.dir}">
+            <include name="org/jboss/tutorial/webservice/bean/*.class"/>
+         </fileset>
+      </jar>
+      <copy file="build/${build.artifact}" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+   </target>
+
+   <target name="run" depends="ejbjar">
+      <java classname="org.jboss.tutorial.webservice.client.Client" fork="yes" dir=".">
+         <classpath refid="classpath"/>
+      </java>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Cleans up generated stuff                                           -->
+   <!-- =================================================================== -->
+   <target name="clean.db">
+      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
+   </target>
+
+   <target name="clean">
+      <delete dir="${build.dir}"/>
+      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/${build.artifact}"/>
+   </target>
+
+
+</project>
+


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/build.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/webservice/jndi.properties
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/jndi.properties	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=localhost


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/jndi.properties
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/webservice/log4j.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/log4j.xml	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 42426 2006-03-17 22:03:04Z bill $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+   
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Messagen -->
+         <!--
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+         -->
+         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
+      </layout>
+</appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/log4j.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/webservice/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/pom.xml	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  
+
+  
+   
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-tutorial-common</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../common/</relativePath>
+  </parent>
+
+  <properties>
+    <ejb3.tutorial.client>org.jboss.tutorial.webservice.client.Client</ejb3.tutorial.client>
+    <version.org.jboss.ws.native_jboss-ws-native-client>3.0.4.SP1</version.org.jboss.ws.native_jboss-ws-native-client>
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-webservice</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>WebServices in EJB3</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial about using EJB3 bean as a webservice endpoint
+  </description>
+  
+  <dependencies>
+  	<dependency>
+  		<groupId>org.jboss.ws.native</groupId>
+  		<artifactId>jbossws-native-client</artifactId>
+  		<version>${version.org.jboss.ws.native_jboss-ws-native-client}</version>
+  	</dependency>
+  </dependencies>
+  
+  
+
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/Calculator.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/Calculator.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/Calculator.java	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.webservice.bean;
+
+import java.rmi.Remote;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+
+ at WebService
+ at SOAPBinding(style = Style.RPC)
+public interface Calculator extends Remote
+{
+   @WebMethod
+   int add(int x, int y);
+
+   @WebMethod
+   int subtract(int x, int y);
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/Calculator.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/CalculatorBean.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/CalculatorBean.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/CalculatorBean.java	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.webservice.bean;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+ at Stateless
+ at WebService(endpointInterface = "org.jboss.tutorial.webservice.bean.Calculator")
+public class CalculatorBean
+{
+   public int add(int x, int y)
+   {
+      return x + y;
+   }
+
+   public int subtract(int x, int y)
+   {
+      return x - y;
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/bean/CalculatorBean.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/client/Client.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/client/Client.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/client/Client.java	2009-01-09 11:09:52 UTC (rev 82728)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.tutorial.webservice.client;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
+
+import org.jboss.tutorial.webservice.bean.Calculator;
+
+public class Client
+{
+   public static void main(String[] args) throws Exception
+   {
+      URL url = new URL("http://localhost:8080/jboss-ejb3-tutorial-webservice/CalculatorBean?wsdl");
+      QName qname = new QName("http://bean.webservice.tutorial.jboss.org/", "CalculatorBeanService");
+
+      ServiceFactory factory = ServiceFactory.newInstance();
+      Service service = factory.createService(url, qname);
+
+      Calculator calculator = (Calculator) service.getPort(Calculator.class);
+
+      System.out.println("1 + 1 = " + calculator.add(1, 1));
+      System.out.println("1 - 1 = " + calculator.subtract(1, 1));
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/webservice/src/org/jboss/tutorial/webservice/client/Client.java
___________________________________________________________________
Name: svn:executable
   + *




More information about the jboss-cvs-commits mailing list