You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/06/15 19:38:32 UTC

svn commit: r414639 - in /beehive/trunk/system-controls/samples/webservice/axis-client: ./ client/ client/WEB-INF/ client/WEB-INF/lib/ webservice/ webservice/WEB-INF/ webservice/WEB-INF/lib/

Author: cschoett
Date: Thu Jun 15 10:38:31 2006
New Revision: 414639

URL: http://svn.apache.org/viewvc?rev=414639&view=rev
Log:
Another sample for the WSC, this sample includes a simple AXIS webservice, which is used to generate a WSC and build a small client web app.  The WSC is accessed through a JSP file which makes multiple calls to the webservice using the WSC.

Currently won't build until new wsc build macro gets added to beehive-tools.xml (coming soon).

Added:
    beehive/trunk/system-controls/samples/webservice/axis-client/
    beehive/trunk/system-controls/samples/webservice/axis-client/README.txt   (with props)
    beehive/trunk/system-controls/samples/webservice/axis-client/build.properties   (with props)
    beehive/trunk/system-controls/samples/webservice/axis-client/build.xml   (with props)
    beehive/trunk/system-controls/samples/webservice/axis-client/client/
    beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/
    beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/lib/
    beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/web.xml   (with props)
    beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp   (with props)
    beehive/trunk/system-controls/samples/webservice/axis-client/webservice/
    beehive/trunk/system-controls/samples/webservice/axis-client/webservice/Calculator.jws
    beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/
    beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/lib/
    beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/web.xml   (with props)

Added: beehive/trunk/system-controls/samples/webservice/axis-client/README.txt
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/README.txt?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/README.txt (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/README.txt Thu Jun 15 10:38:31 2006
@@ -0,0 +1,30 @@
+Overview
+---------
+
+axis-client is a web service control (WSC) sample application.  This sample
+contains a simple AXIS web service and a web client which uses a WSC.
+
+
+External Dependencies
+----------------------
+
+In addition to a Beehive distribution the following must be present to run
+this  sample:
+
+*) Jakarta Tomcat
+*) AXIS 1.3.x or later
+
+
+Running
+--------
+
+1) Edit the build.properties file to reflect the Beehive and AXIS installation
+   directories.
+2) Build the web service war, 'ant build.webservice', wsc-sample.service.war
+   will be generated.
+3) Deploy the web service to your application server.
+4) Build the client, 'ant clean build war', wsc-client-sample.war will
+   be generated.
+5) Deploy the client war file to your application server.
+6) Sample can be accessed at <http://localhost:8080>/wsc-client-sample/index.jsp
+

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/samples/webservice/axis-client/build.properties
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/build.properties?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/build.properties (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/build.properties Thu Jun 15 10:38:31 2006
@@ -0,0 +1,11 @@
+#
+# Build properties for the interop-client WSC sample.
+#
+
+beehive.home=/home/cschoett/beehive/trunk/build/dist/apache-beehive-1.1-SNAPSHOT
+axis.home=/home/cschoett/beehive/trunk/external/axis-1.3
+
+context.path=wsc-sample-service
+
+# Specifies the URL of the web service's wsdl to generate a WSC from.
+webservice.wsdl.url=http://localhost:8080/wsc-sample-service/Calculator.jws?wsdl

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/samples/webservice/axis-client/build.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/build.xml?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/build.xml (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/build.xml Thu Jun 15 10:38:31 2006
@@ -0,0 +1,107 @@
+<?xml version="1.0" ?>
+
+<!--
+   Copyright 2006 The Apache Software Foundation
+ 
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+  
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ 
+   $Header:$
+ -->
+<project name="wsc-axis-client" default="usage" basedir=".">
+
+    <property environment="os"/>
+    <property file="build.properties"/>
+    <import file="${beehive.home}/beehive-imports.xml"/>
+    <import file="${beehive.home}/ant/beehive-tools.xml"/>
+
+    <!-- URL to webservice WSDL used to generate the web service control,
+         defined the the build.properties file. -->
+    <property name="wsdl.src" value="${webservice.wsdl.url}"/>
+
+    <property name="build.dir" location="${basedir}/build"/>
+    <property name="source.dir" location="${build.dir}/src"/>
+    <property name="junit.source.dir" location="${basedir}/junit"/>
+    <property name="build.classes" location="${build.dir}/classes"/>
+    <property name="build.beansrc" location="${build.dir}/beansrc"/>
+    <property name="build.jar" value="wsc-sample-control.jar"/>
+
+    <path id="build.classpath">
+        <path refid="controls.dependency.path"/>
+        <path refid="wsc.dependency.path"/>
+    </path>
+
+    <target name="clean" description="Delete all generated files">
+        <delete dir="${build.dir}"/>
+        <delete file="velocity.log"/>
+    </target>
+
+    <target name="build" depends="init.dirs" description="Generate a WSC and build control sources.">
+        <generate-wsc wsdlsrc="${wsdl.src}" wscgendir="${source.dir}"
+                      tempdir="${build.beansrc}" destdir="${build.classes}"
+                      packagename="wsc.axis.sample" copywsdl="true"
+                      classpathref="build.classpath"/>
+
+        <control-jar destfile="${build.dir}/${build.jar}" basedir="${build.classes}"/>
+    </target>
+
+    <target name="war" description="Create a war file for the WSC.">
+        <copy todir="${build.dir}/wsc-client">
+            <fileset dir="client"/>
+        </copy>
+
+        <copy todir="${build.dir}/wsc-client/WEB-INF/lib">
+            <fileset dir="${beehive.home}/lib/controls">
+                <include name="beehive-controls.jar"/>
+                <include name="beehive-webservice-control.jar"/>
+            </fileset>
+            <fileset dir="${build.dir}">
+                <include name="**/${build.jar}"/>
+            </fileset>
+            <fileset dir="${axis.home}">
+                <include name="**/*.jar"/>
+            </fileset>
+            <fileset dir="${beehive.home}/lib/common">
+                <include name="**/*.jar"/>
+            </fileset>
+        </copy>
+
+        <jar jarfile="wsc-client-sample.war">
+            <fileset dir="${build.dir}/wsc-client"/>
+        </jar>
+    </target>
+
+    <target name="build.webservice" description="Build a war file for the AXIS web service.">
+        <copy todir="${build.dir}/${context.path}">
+            <fileset dir="webservice"/>
+        </copy>
+
+        <copy todir="${build.dir}/${context.path}/WEB-INF/lib">
+            <fileset dir="${axis.home}">
+                <include name="**/*.jar"/>
+            </fileset>
+            <fileset dir="${beehive.home}/lib/common">
+                <include name="**/*.jar"/>
+            </fileset>
+        </copy>
+
+        <jar jarfile="${context.path}.war">
+            <fileset dir="${build.dir}/${context.path}"/>
+        </jar>
+    </target>
+
+    <target name="init.dirs">
+        <mkdir dir="${source.dir}"/>
+        <mkdir dir="${build.classes}"/>
+        <mkdir dir="${build.beansrc}"/>
+    </target>
+</project>

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/web.xml?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/web.xml (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/web.xml Thu Jun 15 10:38:31 2006
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+    version="2.4">
+
+  <display-name>Beehive WSC Axis Client Sample App</display-name>
+    
+  <filter>
+    <filter-name>ControlFilter</filter-name>
+    <filter-class>org.apache.beehive.controls.runtime.servlet.ControlFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>ControlFilter</filter-name>
+    <url-pattern>*.jsp</url-pattern>
+  </filter-mapping>
+
+  <session-config>
+    <session-timeout>5</session-timeout>
+  </session-config>
+
+  <welcome-file-list>
+    <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+
+</web-app>

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/client/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp Thu Jun 15 10:38:31 2006
@@ -0,0 +1,46 @@
+<%--
+   Copyright 2004-2005 The Apache Software Foundation.
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+   
+       http://www.apache.org/licenses/LICENSE-2.0
+   
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  
+   $Header:$
+--%>
+<%@ page language="java" contentType="text/html;charset=UTF-8" session="true"
+         import="org.apache.beehive.controls.api.bean.Controls,
+                 org.apache.beehive.controls.api.context.ControlThreadContext,
+                 javax.servlet.jsp.JspWriter" %>
+
+<% response.setHeader("Cache-Control", "no-cache"); %>
+
+<h3>WSC Sample Axis Client</h3>
+<p>The value of each expression on this page is calculated using a web service control
+    communicating  with the Calculator web service.</p>
+
+<%!
+    public void runTest(JspWriter out, CalculatorServiceBean wsc) throws java.io.IOException {
+        try {
+            out.write("1 + 2 = " + wsc.add(1, 2) + "<BR>");
+            out.write("2 + 3 = " + wsc.add(2, 3) + "<BR>");
+            out.write("2 - 3 = " + wsc.subtract(2, 3) + "<BR>");
+        }
+        catch (Exception e) {
+            out.write(e.getMessage());
+        }
+    }
+%>
+
+<%
+    CalculatorServiceBean wsc = Controls.instantiate(CalculatorServiceBean.class, null,
+                                                     ControlThreadContext.getContext(), "root");
+    runTest(out, wsc);
+%>

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/client/index.jsp
------------------------------------------------------------------------------
    svn:executable = *

Added: beehive/trunk/system-controls/samples/webservice/axis-client/webservice/Calculator.jws
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/webservice/Calculator.jws?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/webservice/Calculator.jws (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/webservice/Calculator.jws Thu Jun 15 10:38:31 2006
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+
+/**
+ * Sample calculator web service.
+ */
+public class Calculator {
+
+    /**
+     * Add two ints.
+     * @param i1
+     * @param i2
+     * @return sum
+     */
+    public int add(int i1, int i2) {
+        return i1 + i2;
+    }
+
+    /**
+     * Subtract two ints.
+     * @param i1
+     * @param i2
+     * @return
+     */
+    public int subtract(int i1, int i2) {
+        return i1 - i2;
+    }
+
+    /**
+     * Compute the square root.
+     * @param d1
+     * @return sqrt
+     */
+    public double squareRoot(double d1) {
+        return Math.sqrt(d1);
+    }
+
+    /**
+     * Compute the sine.
+     * @param d1
+     * @return sine.
+     */
+    public double sin(double d1) {
+        return Math.sin(d1);
+    }
+}

Added: beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/web.xml?rev=414639&view=auto
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/web.xml (added)
+++ beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/web.xml Thu Jun 15 10:38:31 2006
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+  <display-name>Apache-Axis</display-name>
+    
+    <listener>
+        <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
+    </listener>
+    
+  <servlet>
+    <servlet-name>AxisServlet</servlet-name>
+    <display-name>Apache-Axis Servlet</display-name>
+    <servlet-class>
+        org.apache.axis.transport.http.AxisServlet
+    </servlet-class>
+  </servlet>
+
+  <servlet>
+    <servlet-name>AdminServlet</servlet-name>
+    <display-name>Axis Admin Servlet</display-name>
+    <servlet-class>
+        org.apache.axis.transport.http.AdminServlet
+    </servlet-class>
+    <load-on-startup>100</load-on-startup>
+  </servlet>
+
+  <servlet>
+    <servlet-name>SOAPMonitorService</servlet-name>
+    <display-name>SOAPMonitorService</display-name>
+    <servlet-class>
+        org.apache.axis.monitor.SOAPMonitorService
+    </servlet-class>
+    <init-param>
+      <param-name>SOAPMonitorPort</param-name>
+      <param-value>5001</param-value>
+    </init-param>
+    <load-on-startup>100</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>AxisServlet</servlet-name>
+    <url-pattern>/servlet/AxisServlet</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>AxisServlet</servlet-name>
+    <url-pattern>*.jws</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>AxisServlet</servlet-name>
+    <url-pattern>/services/*</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>SOAPMonitorService</servlet-name>
+    <url-pattern>/SOAPMonitor</url-pattern>
+  </servlet-mapping>
+
+ <!-- uncomment this if you want the admin servlet -->
+ <!--
+  <servlet-mapping>
+    <servlet-name>AdminServlet</servlet-name>
+    <url-pattern>/servlet/AdminServlet</url-pattern>
+  </servlet-mapping>
+ -->
+
+    <session-config>
+        <!-- Default to 5 minute session timeouts -->
+        <session-timeout>5</session-timeout>
+    </session-config>
+
+    <!-- currently the W3C havent settled on a media type for WSDL;
+    http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
+    for now we go with the basic 'it's XML' response -->
+  <mime-mapping>
+    <extension>wsdl</extension>
+     <mime-type>text/xml</mime-type>
+  </mime-mapping>
+  
+
+  <mime-mapping>
+    <extension>xsd</extension>
+    <mime-type>text/xml</mime-type>
+  </mime-mapping>
+
+  <welcome-file-list id="WelcomeFileList">
+    <welcome-file>index.jsp</welcome-file>
+    <welcome-file>index.html</welcome-file>
+    <welcome-file>index.jws</welcome-file>
+  </welcome-file-list>
+
+</web-app>

Propchange: beehive/trunk/system-controls/samples/webservice/axis-client/webservice/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native