You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/10 22:32:32 UTC
svn commit: r169518 [7/8] - in /incubator/beehive/trunk:
docs/forrest/src/documentation/content/xdocs/
docs/forrest/src/documentation/content/xdocs/system-controls/
docs/forrest/src/documentation/content/xdocs/system-controls/ejb/
docs/forrest/src/documentation/content/xdocs/system-controls/jdbc/
docs/forrest/src/documentation/content/xdocs/system-controls/jms/
docs/forrest/src/documentation/content/xdocs/system-controls/webservices/
docs/forrest/src/documentation/content/xdocs/tutorial/
system-controls/samples/ system-controls/samples/ejb/
system-controls/samples/ejb/client/ system-controls/samples/ejb/client/org/
system-controls/samples/ejb/client/org/apache/
system-controls/samples/ejb/client/org/apache/beehive/
system-controls/samples/ejb/client/org/apache/beehive/controls/
system-controls/samples/ejb/client/org/apache/beehive/controls/system/
system-controls/samples/ejb/client/org/apache/beehive/controls/system/ejb/
system-controls/samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/
system-controls/samples/ejb/client/org/apache/beehive/controls/system/ejb/sample/client/
system-controls/samples/ejb/control/ system-controls/samples/ejb/control/org/
system-controls/samples/ejb/control/org/apache/
system-controls/samples/ejb/control/org/apache/beehive/
system-controls/samples/ejb/control/org/apache/beehive/controls/
system-controls/samples/ejb/control/org/apache/beehive/controls/system/
system-controls/samples/ejb/control/org/apache/beehive/controls/system/ejb/
system-controls/samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/
system-controls/samples/ejb/control/org/apache/beehive/controls/system/ejb/sample/control/
system-controls/samples/ejb/ejb/ system-controls/samples/ejb/ejb/META-INF/
system-controls/samples/ejb/ejb/org/
system-controls/samples/ejb/ejb/org/apache/
system-controls/samples/ejb/ejb/org/apache/beehive/
system-controls/samples/ejb/ejb/org/apache/beehive/controls/
system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/
system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ejb/
system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/
system-controls/samples/ejb/ejb/org/apache/beehive/controls/system/ejb/sample/bean/
system-controls/samples/jdbc/ system-controls/samples/jdbc/jdbcControlSample/
system-controls/samples/jdbc/jdbcControlSample/META-INF/
system-controls/samples/jdbc/jdbcControlSample/WEB-INF/
system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/
system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/controls/
system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/servlet/
system-controls/samples/jdbc/jdbcControlSample/WEB-INF/src/shared/
system-controls/samples/jms/ system-controls/samples/jms/src/
system-controls/samples/jms/src/org/
system-controls/samples/jms/src/org/apache/
system-controls/samples/jms/src/org/apache/beehive/
system-controls/samples/jms/src/org/apache/beehive/controls/
system-controls/samples/jms/src/org/apache/beehive/controls/system/
system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/
system-controls/samples/jms/src/org/apache/beehive/controls/system/jms/samples/
system-controls/samples/webservice/
system-controls/samples/webservice/amazon/
system-controls/samples/webservice/amazon/junit/
system-controls/samples/webservice/amazon/schemas/
system-controls/samples/webservice/common/
system-controls/samples/webservice/common/src/
system-controls/samples/webservice/common/src/test/
system-controls/samples/webservice/google/
system-controls/samples/webservice/google/junit/
system-controls/samples/webservice/google/junit/model/
system-controls/samples/webservice/google/rpc_schemas/
system-controls/samples/webservice/google/servlet/
system-controls/samples/webservice/lib/
system-controls/samples/webservice/wsm_samples_client/
system-controls/samples/webservice/wsm_samples_client/doc_schemas/
system-controls/samples/webservice/wsm_samples_client/junit/
system-controls/samples/webservice/wsm_samples_client/junit/org/
system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/
system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/
system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/
system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/
system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/
system-controls/samples/webservice/wsm_samples_client/rpc_schemas/
system-controls/samples/webservice/xmlbeans/
system-controls/samples/webservice/xmlbeans/junit/
system-controls/samples/webservice/xmlbeans/schemas/ system-controls/src/ejb/
Added: incubator/beehive/trunk/system-controls/samples/webservice/common/src/test/ControlTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/common/src/test/ControlTestCase.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/common/src/test/ControlTestCase.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/common/src/test/ControlTestCase.java Tue May 10 13:32:29 2005
@@ -0,0 +1,80 @@
+package test;
+
+/*
+ * Copyright 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:$
+ */
+
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+
+/*******************************************************************************
+ *
+ *
+ * @author Jonathan Colwell
+ */
+public abstract class ControlTestCase extends TestCase {
+
+ private ControlContainerContext mContext;
+
+ public void setUp() throws Exception {
+ try {
+ mContext = ControlThreadContext.getContext();
+ if(mContext == null) {
+ mContext = new org.apache.beehive.controls.runtime.bean.
+ ControlContainerContext();
+ mContext.beginContext();
+ }
+
+ /*
+ * Now that the context is in place, try to initialize the service
+ * control client subclass.
+ */
+ Class cls = getClass();
+ Class clientInitializer =
+ cls.getClassLoader().loadClass(cls.getName()
+ + "ClientInitializer");
+
+ Method init =
+ clientInitializer.getMethod("initialize",
+ ControlBeanContext.class, cls);
+ init.invoke(null, mContext, this);
+ } catch ( InvocationTargetException ite) {
+ Throwable t = ite.getCause();
+ System.out.println("Error in method invocation original cause: " + t.getMessage());
+ t.printStackTrace();
+ ite.printStackTrace();
+ throw ite;
+ }catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+
+ }
+
+ public void tearDown() throws Exception {
+ if(mContext != null) {
+ mContext.endContext();
+ }
+ }
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/google/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/google/build.xml?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/google/build.xml (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/google/build.xml Tue May 10 13:32:29 2005
@@ -0,0 +1,192 @@
+<?xml version="1.0" ?>
+
+<project name="google_sample" default="run.test">
+
+ <property environment="env" />
+ <property name="beehive.home" value="${env.BEEHIVE_HOME}"/>
+ <import file="${beehive.home}/beehive-imports.xml" />
+
+ <property name="service.url" value="http://localhost:8080/AddressBookWS/web/Service.jws" />
+
+ <property name="build.dir" value="./build" />
+ <property name="extgen.dir" value="${build.dir}/extgen" />
+ <property name="jcxgen.dir" value="${build.dir}/controlgen" />
+ <property name="build.beansrc" value="${build.dir}/beansrc"/>
+
+
+ <property name="source.dir" value="./src" />
+ <property name="common.source.dir" value="../common/src" />
+
+ <property name="junit.source.dir" value="./junit" />
+ <property name="test.logs" value="./logs" />
+ <property name="servers.dir" value="./servers/local" />
+ <!-- test servers -->
+ <property name="build.classes" value="${build.dir}/classes" />
+ <property name="axisbeangen.dir" value="${build.dir}/axisbeangen" />
+ <property name="servicecontrol.jar" value="../../servicecontrol/build/jars/webservice-control.jar" />
+
+ <property name="beehive.common.lib.dir" value="${beehive.home}/lib/common" />
+
+ <property name="controls.jar" value="${beehive.home}/lib/controls/beehive-controls.jar" />
+ <property name="rpc.schema.dir" value="rpc_schemas" />
+
+ <property name="testmodel.client.jcxgen.packageName" value="test" />
+ <path id="beehive.class.path">
+ <fileset dir="${beehive.home}/lib/wsm" includes="*.jar" />
+ <pathelement location="${beehive.home}/lib/controls/beehive-controls.jar" />
+ <pathelement location="${lib.dir}/junit-3.8.1.jar" />
+ <pathelement location="${basedir}/lib/servlet-api-2.4-20040521.jar" />
+ <pathelement location="${basedir}/lib/jsp-api-2.0-20040521.jar" />
+ <fileset dir="${beehive.common.lib.dir}">
+ <include name="**/*.jar" />
+ </fileset>
+ </path>
+
+ <path id="build.classpath">
+ <fileset dir="${beehive.home}/lib/wsm">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="${beehive.home}/lib/controls/beehive-webservice-control.jar"/>
+ <pathelement location="../lib/commons-cli-1.0.jar"/>
+ <!--
+ <fileset dir="../../servicecontrol/lib">
+ <include name="**/*.jar" />
+ </fileset>
+ -->
+
+ <path refid="beehive.class.path" />
+ <pathelement path="${servicecontrol.jar}" />
+ </path>
+
+ <taskdef name="apt" classname="org.apache.beehive.controls.runtime.generator.AptTask" classpath="${controls.jar}" onerror="report" />
+ <taskdef name="control-jar" classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask" classpath="${controls.jar}" onerror="report" />
+
+
+
+ <target name="clean" description="Deletes all generated files">
+ <delete dir="${build.dir}" />
+ <delete file="velocity.log" />
+ <delete dir="${test.logs}" />
+ <delete dir="${extgen.dir}" />
+ <delete dir="${jcxgen.dir}" />
+ <delete dir="${axisbeangen.dir}" />
+ </target>
+
+ <target name="dirs">
+ <mkdir dir="${build.classes}" />
+ <mkdir dir="${test.logs}" />
+ <mkdir dir="${extgen.dir}" />
+ <mkdir dir="${jcxgen.dir}" />
+ <mkdir dir="${axisbeangen.dir}" />
+ </target>
+
+ <target name="build" depends="gen_jcx, build_junit" description="Builds source, and servlets" />
+
+
+
+ <target name="gen_jcx" depends="gen_types" unless="noaxisrebuild">
+
+
+ <!-- have the wsdls, next to the jcx files -->
+
+ <java classname="org.apache.beehive.controls.system.webservice.generator.ExtensionMaker">
+ <classpath>
+ <path refid="build.classpath" />
+ <pathelement location="${build.classes}" />
+ </classpath>
+ <arg line="-gen_root ${jcxgen.dir}
+ -wsdl ${rpc.schema.dir}
+ -pkg ${testmodel.client.jcxgen.packageName}
+ -wsdl_path_annotation ." />
+
+ </java>
+
+ <!-- have the wsdls, next to the jcx files -->
+ <copy todir="${jcxgen.dir}/${testmodel.client.jcxgen.packageName}">
+ <fileset dir="${rpc.schema.dir}">
+ <include name="**/*.wsdl" />
+ </fileset>
+ </copy>
+
+ </target>
+
+ <target name="do_gen_axis_types" depends="dirs" unless="noaxisrebuild">
+ <!-- AXIS Bean build -->
+ <taskdef name="axisbeanbuild" classname="org.apache.beehive.wsm.axis.ant.AxisTypeGeneratorTask">
+ <classpath>
+ <path refid="build.classpath" />
+ </classpath>
+ </taskdef>
+
+ <axisbeanbuild wsdldir="${rpc.schema.dir}" outputdir="${axisbeangen.dir}" />
+ <javac srcdir="${axisbeangen.dir}" destdir="${build.classes}" classpathref="build.classpath" debug="true" />
+ </target>
+
+
+
+ <target name="gen_types">
+ <uptodate property="noaxisrebuild" targetfile="${axisbeangen.dir}">
+ <srcfiles dir="${rpc.schema.dir}" includes="*.wsdl" />
+ </uptodate>
+
+ <antcall target="do_gen_axis_types">
+ </antcall>
+ </target>
+
+
+ <target name="build_jcx" depends="gen_jcx">
+ <apt srcdir="${jcxgen.dir}" destdir="${build.classes}" gendir="${extgen.dir}" classpathref="build.classpath" compileByExtension="true" srcExtensions="*.jcx,*.java" debug="true" />
+
+ <!-- copy wsdls to the classes -->
+ <copy todir="${build.classes}">
+ <fileset dir="${jcxgen.dir}">
+ <include name="**/*.wsdl" />
+ <include name="**/*.properties" />
+ </fileset>
+ </copy>
+ </target>
+
+
+
+ <target name="build_junit" depends="build_jcx">
+
+ <apt srcdir="${common.source.dir}" destdir="${build.classes}" gendir="${build.beansrc}" debug="on" compileByExtension="true" srcExtensions="*.jcx,*.java">
+ <classpath>
+ <pathelement location="${build.classes}" />
+ <path refid="build.classpath" />
+ </classpath>
+ </apt>
+
+ <apt srcdir="${junit.source.dir}" destdir="${build.classes}" gendir="${build.beansrc}" debug="on" compileByExtension="true" srcExtensions="*.jcx,*.java">
+ <classpath>
+ <pathelement location="${build.classes}" />
+ <path refid="build.classpath" />
+ </classpath>
+ </apt>
+
+ <copy todir="${build.classes}">
+ <fileset dir="${junit.source.dir}">
+ <include name="**/*.key" />
+ <!-- get google key -->
+ <include name="**/*.properties" />
+ </fileset>
+ </copy>
+
+ </target>
+ <target name="run.test" depends="build">
+ <echo message="** junit logfiles written to ${test.logs} **" />
+ <junit failureproperty="testfailed" printsummary="on" tempdir="${build.dir}" fork="yes">
+ <classpath>
+ <pathelement location="${build.classes}" />
+ <path refid="build.classpath" />
+ </classpath>
+ <formatter type="plain" />
+ <batchtest filtertrace="off" todir="${test.logs}">
+ <fileset dir="${junit.source.dir}">
+ <include name="**/*Test.java" />
+ </fileset>
+ </batchtest>
+ </junit>
+ <fail if="testfailed" message="One or more tests failed." />
+ </target>
+</project>
Added: incubator/beehive/trunk/system-controls/samples/webservice/google/junit/model/GoogleControlTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/google/junit/model/GoogleControlTest.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/google/junit/model/GoogleControlTest.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/google/junit/model/GoogleControlTest.java Tue May 10 13:32:29 2005
@@ -0,0 +1,85 @@
+/*
+ * GoogleControlTest.java
+ *
+ * Copyright 2004 BEA Systems, Inc.
+ *
+ * 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.
+ *
+ *
+ * Original author: Jonathan Colwell
+ */
+package model;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+import test.ControlTestCase;
+
+/*******************************************************************************
+ *
+ *
+ * @author Jonathan Colwell
+ */
+
+public class GoogleControlTest extends ControlTestCase {
+
+ @Control public test.GoogleSearchService google;
+
+ private String mKey;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ String keyFileName = "google.key";
+ InputStream keyStream = getClass().getResourceAsStream(keyFileName);
+ if (keyStream == null)
+ throw new RuntimeException("Key file: " + keyFileName + " is not found!");
+ BufferedReader br = new BufferedReader(new InputStreamReader(keyStream,
+ "UTF-8"));
+
+ mKey = br.readLine();
+ br.close();
+
+ }
+
+ public void testSpelling() throws Exception {
+ String thermonukular = google
+ .doSpellingSuggestion(mKey, "thermonukular");
+ assertEquals("thermonuclear", thermonukular);
+ }
+
+ public void testCache() throws Exception {
+ byte[] pageData = google
+ .doGetCachedPage(mKey, "http://www.bea.com");
+ assertTrue(pageData.length > 0);
+ assertTrue(new String(pageData).indexOf("BEA") > 0);
+ }
+
+ public void testSearch() throws Exception {
+
+ GoogleSearch.GoogleSearchResult results = google
+ .doGoogleSearch(mKey, "BEA", 0, 5, false, null, false, null, null, null);
+
+ assertTrue(results.getSearchTime() > 0);
+ assertTrue(results.getEstimatedTotalResultsCount() > 0x10000);
+
+ for (GoogleSearch.ResultElement re : results.getResultElements()) {
+ assertNotNull(re.getTitle());
+ assertNotNull(re.getURL());
+ assertNotNull(re.getSummary());
+ }
+ }
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/google/rpc_schemas/GoogleSearch.wsdl
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/google/rpc_schemas/GoogleSearch.wsdl?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/google/rpc_schemas/GoogleSearch.wsdl (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/google/rpc_schemas/GoogleSearch.wsdl Tue May 10 13:32:29 2005
@@ -0,0 +1,198 @@
+<?xml version="1.0"?>
+
+<!-- WSDL description of the Google Web APIs.
+ The Google Web APIs are in beta release. All interfaces are subject to
+ change as we refine and extend our APIs. Please see the terms of use
+ for more information. -->
+
+<!-- Revision 2002-08-16 -->
+
+<definitions name="GoogleSearch"
+ targetNamespace="urn:GoogleSearch"
+ xmlns:typens="urn:GoogleSearch"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <!-- Types for search - result elements, directory categories -->
+
+ <types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:GoogleSearch">
+
+ <xsd:complexType name="GoogleSearchResult">
+ <xsd:all>
+ <xsd:element name="documentFiltering" type="xsd:boolean"/>
+ <xsd:element name="searchComments" type="xsd:string"/>
+ <xsd:element name="estimatedTotalResultsCount" type="xsd:int"/>
+ <xsd:element name="estimateIsExact" type="xsd:boolean"/>
+ <xsd:element name="resultElements" type="typens:ResultElementArray"/>
+ <xsd:element name="searchQuery" type="xsd:string"/>
+ <xsd:element name="startIndex" type="xsd:int"/>
+ <xsd:element name="endIndex" type="xsd:int"/>
+ <xsd:element name="searchTips" type="xsd:string"/>
+ <xsd:element name="directoryCategories" type="typens:DirectoryCategoryArray"/>
+ <xsd:element name="searchTime" type="xsd:double"/>
+ </xsd:all>
+ </xsd:complexType>
+
+ <xsd:complexType name="ResultElement">
+ <xsd:all>
+ <xsd:element name="summary" type="xsd:string"/>
+ <xsd:element name="URL" type="xsd:string"/>
+ <xsd:element name="snippet" type="xsd:string"/>
+ <xsd:element name="title" type="xsd:string"/>
+ <xsd:element name="cachedSize" type="xsd:string"/>
+ <xsd:element name="relatedInformationPresent" type="xsd:boolean"/>
+ <xsd:element name="hostName" type="xsd:string"/>
+ <xsd:element name="directoryCategory" type="typens:DirectoryCategory"/>
+ <xsd:element name="directoryTitle" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+
+ <xsd:complexType name="ResultElementArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:ResultElement[]"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="DirectoryCategoryArray">
+ <xsd:complexContent>
+ <xsd:restriction base="soapenc:Array">
+ <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:DirectoryCategory[]"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="DirectoryCategory">
+ <xsd:all>
+ <xsd:element name="fullViewableName" type="xsd:string"/>
+ <xsd:element name="specialEncoding" type="xsd:string"/>
+ </xsd:all>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </types>
+
+ <!-- Messages for Google Web APIs - cached page, search, spelling. -->
+
+ <message name="doGetCachedPage">
+ <part name="key" type="xsd:string"/>
+ <part name="url" type="xsd:string"/>
+ </message>
+
+ <message name="doGetCachedPageResponse">
+ <part name="return" type="xsd:base64Binary"/>
+ </message>
+
+ <message name="doSpellingSuggestion">
+ <part name="key" type="xsd:string"/>
+ <part name="phrase" type="xsd:string"/>
+ </message>
+
+ <message name="doSpellingSuggestionResponse">
+ <part name="return" type="xsd:string"/>
+ </message>
+
+ <!-- note, ie and oe are ignored by server; all traffic is UTF-8. -->
+
+ <message name="doGoogleSearch">
+ <part name="key" type="xsd:string"/>
+ <part name="q" type="xsd:string"/>
+ <part name="start" type="xsd:int"/>
+ <part name="maxResults" type="xsd:int"/>
+ <part name="filter" type="xsd:boolean"/>
+ <part name="restrict" type="xsd:string"/>
+ <part name="safeSearch" type="xsd:boolean"/>
+ <part name="lr" type="xsd:string"/>
+ <part name="ie" type="xsd:string"/>
+ <part name="oe" type="xsd:string"/>
+ </message>
+
+ <message name="doGoogleSearchResponse">
+ <part name="return" type="typens:GoogleSearchResult"/>
+ </message>
+
+ <!-- Port for Google Web APIs, "GoogleSearch" -->
+
+ <portType name="GoogleSearchPort">
+
+ <operation name="doGetCachedPage">
+ <input message="typens:doGetCachedPage"/>
+ <output message="typens:doGetCachedPageResponse"/>
+ </operation>
+
+ <operation name="doSpellingSuggestion">
+ <input message="typens:doSpellingSuggestion"/>
+ <output message="typens:doSpellingSuggestionResponse"/>
+ </operation>
+
+ <operation name="doGoogleSearch">
+ <input message="typens:doGoogleSearch"/>
+ <output message="typens:doGoogleSearchResponse"/>
+ </operation>
+
+ </portType>
+
+
+ <!-- Binding for Google Web APIs - RPC, SOAP over HTTP -->
+
+ <binding name="GoogleSearchBinding" type="typens:GoogleSearchPort">
+ <soap:binding style="rpc"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <operation name="doGetCachedPage">
+ <soap:operation soapAction="urn:GoogleSearchAction"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="doSpellingSuggestion">
+ <soap:operation soapAction="urn:GoogleSearchAction"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+
+ <operation name="doGoogleSearch">
+ <soap:operation soapAction="urn:GoogleSearchAction"/>
+ <input>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </input>
+ <output>
+ <soap:body use="encoded"
+ namespace="urn:GoogleSearch"
+ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </output>
+ </operation>
+ </binding>
+
+ <!-- Endpoint for Google Web APIs -->
+ <service name="GoogleSearchService">
+ <port name="GoogleSearchPort" binding="typens:GoogleSearchBinding">
+ <soap:address location="http://api.google.com/search/beta2"/>
+ </port>
+ </service>
+
+</definitions>
Added: incubator/beehive/trunk/system-controls/samples/webservice/google/servlet/GoogleServlet.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/google/servlet/GoogleServlet.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/google/servlet/GoogleServlet.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/google/servlet/GoogleServlet.java Tue May 10 13:32:29 2005
@@ -0,0 +1,157 @@
+/*
+ * GoogleServlet.java
+ *
+ * Copyright 2004 BEA Systems, Inc.
+ *
+ *
+ * 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.
+ *
+ *
+ * Original author: Jonathan Colwell
+ */
+
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+import org.apache.beehive.controls.api.context.ControlBeanContext;
+
+
+/*******************************************************************************
+ *
+ *
+ * @author Jonathan Colwell
+ */
+public class GoogleServlet extends HttpServlet {
+
+ @Control public GoogleClient mGoogle;
+
+ private String mGoogleWebServiceKey;
+
+ public void init(ServletConfig conf) throws ServletException {
+ mGoogleWebServiceKey = conf.getInitParameter("googleKey");
+ if (mGoogleWebServiceKey == null) {
+ throw new ServletException("a key is required to invoke the Google Web Service");
+ }
+ }
+
+ public void service(HttpServletRequest req,
+ HttpServletResponse resp)
+ throws ServletException {
+ try {
+ ServletOutputStream sos = resp.getOutputStream();
+
+ if (mGoogle == null) {
+
+ ControlBeanContext cont = ControlThreadContext.getContext();
+ GoogleServletClientInitializer.initialize(cont, this);
+ sos.println("initializing Google Client");
+ }
+ String task = (String)req.getParameter("task");
+ if (task != null) {
+
+ if (task.equals("cache")) {
+ sos.println("retrieving cache");
+ String url = (String)req.getParameter("url");
+ if (url != null) {
+ byte[] cachedPage = mGoogle
+ .getCachedPage(mGoogleWebServiceKey,
+ url);
+
+ sos.write(cachedPage);
+ }
+ else {
+ throw new ServletException
+ ("A url must be provided to view a cached page");
+ }
+ }
+ else if (task.equals("spell")) {
+
+ resp.setContentType("text/plain");
+ sos.println("spellcheck");
+ sos.println
+ (mGoogle.
+ suggestSpelling(mGoogleWebServiceKey,
+ req.getParameter("phrase")));
+ }
+ else if (task.equals("search")) {
+
+ resp.setContentType("text/plain");
+ int start = 0;
+ int maxResults = 10;
+ try {
+ start = Integer.parseInt(req.getParameter("start"));
+ }
+ catch (NumberFormatException nfe) {
+ }
+
+ try {
+ Integer.parseInt(req.getParameter("maxResults"));
+ }
+ catch (NumberFormatException nfe) {
+ }
+
+ GoogleSearch.GoogleSearchResult results = mGoogle
+ .search(mGoogleWebServiceKey,
+ req.getParameter("q"),
+ start,
+ maxResults,
+ Boolean.getBoolean(req.getParameter("filter")),
+ req.getParameter("restrict"),
+ Boolean.getBoolean(req
+ .getParameter("safeSearch")),
+ req.getParameter("lr"),
+ req.getParameter("ie"),
+ req.getParameter("oe"));
+
+ for (GoogleSearch.ResultElement re :results
+ .getResultElements()) {
+ sos.println(re.getTitle());
+ sos.println(re.getURL());
+ sos.println(re.getSummary() + "\n\n");
+ }
+ }
+ }
+
+ // FIXME jcolwell@bea.com 2004-Nov-15 --
+ // set up forms to call the API tasks
+ sos.println(new java.util.Date().toString());
+ sos.close();
+ }
+ catch (org.apache.axis.AxisFault af) {
+ Throwable cause = af.getCause();
+ if (cause != null) {
+ if (cause instanceof org.xml.sax.SAXException) {
+ cause = ((org.xml.sax.SAXException)cause).getException();
+ }
+ throw new ServletException(cause);
+ }
+ else {
+ throw new ServletException(af);
+ }
+ }
+ catch (org.xml.sax.SAXException se) {
+ throw new ServletException(se.getException());
+ }
+ catch (Exception e) {
+ throw new ServletException(e);
+ }
+ }
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/lib/commons-cli-1.0.jar
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/lib/commons-cli-1.0.jar?rev=169518&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/beehive/trunk/system-controls/samples/webservice/lib/commons-cli-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/README.txt
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/README.txt?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/README.txt (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/README.txt Tue May 10 13:32:29 2005
@@ -0,0 +1,4 @@
+Before running these samples make sure the beehive's wsm-samples
+are deployed and tomcat is running.
+
+Add more text on how to...
\ No newline at end of file
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml Tue May 10 13:32:29 2005
@@ -0,0 +1,246 @@
+<?xml version="1.0" ?>
+
+<project name="xmlbea _service_control_sample" default="run.test">
+
+ <property environment="env"/>
+ <property name="beehive.home" value="${env.BEEHIVE_HOME}"/>
+ <import file="${beehive.home}/beehive-imports.xml"/>
+
+ <property name="service.url" value="http://localhost:8080/AddressBookWS/web/Service.jws"/>
+
+ <property name="build.dir" value="./build"/>
+ <property name="xbeangen.dir" value="${build.dir}/xbeangen"/>
+ <property name="extgen.dir" value="${build.dir}/extgen"/>
+ <property name="jcxgen.dir" value="${build.dir}/controlgen"/>
+
+
+ <property name="source.dir" value="./src"/>
+ <property name="common.source.dir" value="../common/src"/>
+
+ <property name="junit.source.dir" value="./junit"/>
+ <property name="test.logs" value="./logs"/>
+ <property name="servers.dir" value="./servers/local"/> <!-- test servers -->
+ <property name="build.classes" value="${build.dir}/classes"/>
+ <property name="build.beansrc" value="${build.dir}/beansrc"/>
+ <property name="axisbeangen.dir" value="${build.dir}/axisbeangen"/>
+ <property name="servicecontrol.jar" value="../../servicecontrol/build/jars/webservice-control.jar"/>
+
+ <property name="beehive.common.lib.dir" value="${beehive.home}/lib/common"/>
+
+ <property name="controls.jar" value="${beehive.home}/lib/controls/beehive-controls.jar"/>
+ <property name="doc.schema.dir" value="doc_schemas"/>
+ <property name="rpc.schema.dir" value="rpc_schemas"/>
+
+ <property name="testmodel.client.jcxgen.packageName" value="test"/>
+ <path id="beehive.class.path">
+ <fileset dir="${beehive.home}/lib/wsm" includes="*.jar"/>
+ <pathelement location="${beehive.home}/lib/controls/beehive-controls.jar"/>
+ <pathelement location="${lib.dir}/junit-3.8.1.jar"/>
+ <pathelement location="${basedir}/lib/servlet-api-2.4-20040521.jar"/>
+ <pathelement location="${basedir}/lib/jsp-api-2.0-20040521.jar"/>
+ <fileset dir="${beehive.common.lib.dir}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="build.classpath">
+ <fileset dir="${beehive.home}/lib/wsm">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="${beehive.home}/lib/controls/beehive-webservice-control.jar"/>
+ <pathelement location="../lib/commons-cli-1.0.jar"/>
+ <!--
+ <fileset dir="../../servicecontrol/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ -->
+
+ <path refid="beehive.class.path"/>
+ <pathelement path="${servicecontrol.jar}"/>
+ </path>
+
+ <taskdef name="apt" classname="org.apache.beehive.controls.runtime.generator.AptTask"
+ classpath="${controls.jar}" onerror="report"/>
+ <taskdef name="control-jar"
+ classname="org.apache.beehive.controls.runtime.packaging.ControlJarTask"
+ classpath="${controls.jar}" onerror="report"/>
+
+ <!-- XMLBean build -->
+ <taskdef name="xmlbeanbuild"
+ classname="org.apache.xmlbeans.impl.tool.XMLBean">
+ <classpath>
+ <path refid="build.classpath"/>
+ </classpath>
+ </taskdef>
+
+ <target name="clean" description="Deletes all generated files">
+ <delete dir="${build.dir}"/>
+ <delete file="velocity.log"/>
+ <delete dir="${xbeangen.dir}"/>
+ <delete dir="${test.logs}"/>
+ <delete dir="${extgen.dir}"/>
+ <delete dir="${jcxgen.dir}"/>
+ <delete dir="${axisbeangen.dir}"/>
+ </target>
+
+ <target name="dirs">
+ <mkdir dir="${build.classes}"/>
+ <mkdir dir="${xbeangen.dir}"/>
+ <mkdir dir="${test.logs}"/>
+ <mkdir dir="${extgen.dir}"/>
+ <mkdir dir="${jcxgen.dir}"/>
+ <mkdir dir="${axisbeangen.dir}"/>
+ </target>
+
+ <target name="build" depends="gen_jcx, build_junit" description="Builds source, and servlets"/>
+
+
+ <target name="gen_jcx" depends="gen_types" unless="noxbeanrebuild">
+
+ <java classname="org.apache.beehive.controls.system.webservice.generator.ExtensionMaker">
+ <classpath>
+ <path refid="build.classpath"/>
+ <pathelement location="${build.classes}"/>
+ </classpath>
+ <arg line="-gen_root ${jcxgen.dir}
+ -wsdl ${doc.schema.dir}
+ -pkg ${testmodel.client.jcxgen.packageName}
+ -wsdl_path_annotation ."/>
+ </java>
+ <!-- have the wsdls, next to the jcx files -->
+ <copy todir="${jcxgen.dir}/${testmodel.client.jcxgen.packageName}">
+ <fileset dir="${doc.schema.dir}">
+ <include name="**/*.wsdl"/>
+ </fileset>
+ </copy>
+
+ <java classname="org.apache.beehive.controls.system.webservice.generator.ExtensionMaker">
+ <classpath>
+ <path refid="build.classpath"/>
+ <pathelement location="${build.classes}"/>
+ </classpath>
+ <arg line="-gen_root ${jcxgen.dir}
+ -wsdl ${rpc.schema.dir}
+ -pkg ${testmodel.client.jcxgen.packageName}
+ -wsdl_path_annotation ."/>
+
+ </java>
+
+ <!-- have the wsdls, next to the jcx files -->
+ <copy todir="${jcxgen.dir}/${testmodel.client.jcxgen.packageName}">
+ <fileset dir="${rpc.schema.dir}">
+ <include name="**/*.wsdl"/>
+ </fileset>
+ </copy>
+
+ </target>
+
+ <target name="do_gen_axis_types" depends="dirs" unless="noaxisrebuild">
+ <!-- AXIS Bean build -->
+ <taskdef name="axisbeanbuild"
+ classname="org.apache.beehive.wsm.axis.ant.AxisTypeGeneratorTask">
+ <classpath>
+ <path refid="build.classpath"/>
+ </classpath>
+ </taskdef>
+
+ <axisbeanbuild
+ wsdldir="${rpc.schema.dir}"
+ outputdir="${axisbeangen.dir}"/>
+ <javac srcdir="${axisbeangen.dir}"
+ destdir="${build.classes}"
+ classpathref="build.classpath"
+ debug="true"/>
+ </target>
+
+ <target name="do_gen_xmlbeans" depends="dirs" unless="noxbeanrebuild">
+
+ <xmlbeanbuild
+ schema="${doc.schema.dir}"
+ srcgendir="${xbeangen.dir}"
+ classgendir="${build.classes}"
+ failonerror="true" ignoreduplicatesinnamespaces="http://webparam.web,http://webservice.web,http://complex.web,http://webmethod.web">
+ <classpath>
+ <path refid="build.classpath"/>
+ </classpath>
+ </xmlbeanbuild>
+ </target>
+
+ <target name="gen_types">
+ <uptodate property="noaxisrebuild" targetfile="${axisbeangen.dir}">
+ <srcfiles dir="${rpc.schema.dir}" includes="*.wsdl"/>
+ </uptodate>
+ <uptodate property="noxbeanrebuild" targetfile="${xbeangen.dir}">
+ <srcfiles dir="${doc.schema.dir}" includes="*.wsdl,*.xsd"/>
+ </uptodate>
+
+ <antcall target="do_gen_xmlbeans"></antcall>
+ <antcall target="do_gen_axis_types"></antcall>
+ </target>
+
+
+ <target name="build_jcx" depends="gen_jcx">
+ <apt srcdir="${jcxgen.dir}"
+ destdir="${build.classes}"
+ gendir="${extgen.dir}"
+ classpathref="build.classpath"
+ compileByExtension="true"
+ srcExtensions="*.jcx,*.java"
+ debug="true"/>
+
+ <!-- copy wsdls to the classes -->
+ <copy todir="${build.classes}">
+ <fileset dir="${jcxgen.dir}">
+ <include name="**/*.wsdl"/>
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="build_junit" depends="build_jcx">
+ <apt srcdir="${common.source.dir}" destdir="${build.classes}" gendir="${build.beansrc}"
+ debug="on"
+ compileByExtension="true"
+ srcExtensions="*.jcx,*.java">
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <path refid="build.classpath"/>
+ </classpath>
+ </apt>
+
+ <apt srcdir="${junit.source.dir}" destdir="${build.classes}" gendir="${build.beansrc}"
+ debug="on"
+ compileByExtension="true"
+ srcExtensions="*.jcx,*.java">
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <path refid="build.classpath"/>
+ </classpath>
+ </apt>
+
+ <copy todir="${build.classes}">
+ <fileset dir="${junit.source.dir}">
+ <include name="**/*.key"/> <!-- get google key -->
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+
+ </target>
+ <target name="run.test" depends="build">
+ <echo message="** junit logfiles written to ${test.logs} **"/>
+ <junit failureproperty="testfailed" printsummary="on" tempdir="${build.dir}" fork="yes">
+ <classpath>
+ <pathelement location="${build.classes}"/>
+ <path refid="build.classpath"/>
+ </classpath>
+ <formatter type="plain"/>
+ <batchtest filtertrace="off" todir="${test.logs}">
+ <fileset dir="${junit.source.dir}">
+ <include name="**/*Test.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ <fail if="testfailed" message="One or more tests failed."/>
+ </target>
+</project>
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/SoapMessageHandlersSample.wsdl
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/SoapMessageHandlersSample.wsdl?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/SoapMessageHandlersSample.wsdl (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/SoapMessageHandlersSample.wsdl Tue May 10 13:32:29 2005
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://beehive.apache.org/wsm/web" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://beehive.apache.org/wsm/web" xmlns:intf="http://beehive.apache.org/wsm/web" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.2RC2
+Built on Nov 16, 2004 (12:19:44 EST)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://beehive.apache.org/wsm/web" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="sayHello">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="sayHelloResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="sayHelloRequest">
+
+ <wsdl:part element="impl:sayHello" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="sayHelloResponse">
+
+ <wsdl:part element="impl:sayHelloResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="SoapMessageHandlersSample">
+
+ <wsdl:operation name="sayHello">
+
+ <wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest"/>
+
+ <wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="SoapMessageHandlersSampleSoapBinding" type="impl:SoapMessageHandlersSample">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="sayHello">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="sayHelloRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="sayHelloResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="SoapMessageHandlersSampleService">
+
+ <wsdl:port binding="impl:SoapMessageHandlersSampleSoapBinding" name="SoapMessageHandlersSample">
+
+ <wsdlsoap:address location="http://localhost:8080/wsm-samplesWS/web/soapmessagehandlers/SoapMessageHandlersSample.jws"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/StockQuoteImpl.wsdl
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/StockQuoteImpl.wsdl?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/StockQuoteImpl.wsdl (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/StockQuoteImpl.wsdl Tue May 10 13:32:29 2005
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://beehive.apache.org/wsm/web/header_sample" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://beehive.apache.org/wsm/web/header_sample" xmlns:intf="http://beehive.apache.org/wsm/web/header_sample" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.2RC3
+Built on Feb 28, 2005 (10:15:14 EST)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://beehive.apache.org/wsm/web/header_sample" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getQuote">
+ <complexType>
+ <sequence>
+ <element name="symbol" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getQuoteResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:float"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getQuoteResponse">
+
+ <wsdl:part element="impl:getQuoteResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getQuoteRequest">
+
+ <wsdl:part element="impl:getQuote" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="StockQuoteImpl">
+
+ <wsdl:operation name="getQuote">
+
+ <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
+
+ <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockQuoteImplSoapBinding" type="impl:StockQuoteImpl">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getQuote">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getQuoteRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getQuoteResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockQuoteImplService">
+
+ <wsdl:port binding="impl:StockQuoteImplSoapBinding" name="StockQuoteImpl">
+
+ <wsdlsoap:address location="http://localhost:8080/wsm-samplesWS/web/header/StockQuoteImpl.jws"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/WebParamDocumentLiteralSample.wsdl
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/WebParamDocumentLiteralSample.wsdl?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/WebParamDocumentLiteralSample.wsdl (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/doc_schemas/WebParamDocumentLiteralSample.wsdl Tue May 10 13:32:29 2005
@@ -0,0 +1,518 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://webparam.web" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webparam.web" xmlns:intf="http://webparam.web" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.2RC3
+Built on Feb 28, 2005 (10:15:14 EST)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://webparam.web" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="area_code" type="xsd:int"/>
+ <complexType name="Phone">
+ <sequence>
+ <element name="areaCode" type="xsd:int"/>
+ <element name="exchange" type="xsd:string"/>
+ <element name="number" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <element name="phone_in" type="impl:Phone"/>
+ <element name="createPhoneNumberInHeader">
+ <complexType>
+ <sequence/>
+ </complexType>
+ </element>
+ <element name="createPhoneNumberInHeaderResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="impl:Phone"/>
+ </sequence>
+ </complexType>
+ </element>
+ <complexType name="StateType">
+ <sequence>
+ <element name="state" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="Address">
+ <sequence>
+ <element name="city" type="xsd:string"/>
+ <element name="phoneNumber" type="impl:Phone"/>
+ <element name="state" type="impl:StateType"/>
+ <element name="streetName" type="xsd:string"/>
+ <element name="streetNum" type="xsd:int"/>
+ <element name="zip" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ <element name="address" type="impl:Address"/>
+ <element name="getPhoneNumberInHeader">
+ <complexType>
+ <sequence/>
+ </complexType>
+ </element>
+ <element name="getPhoneNumberInHeaderResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="impl:Phone"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="sayHelloInBody">
+ <complexType>
+ <sequence>
+ <element name="name_in" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="sayHelloInBodyResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="name_in" type="xsd:string"/>
+ <element name="sayHelloInHeader">
+ <complexType>
+ <sequence/>
+ </complexType>
+ </element>
+ <element name="sayHelloInHeaderResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getPhoneNumberInBody">
+ <complexType>
+ <sequence>
+ <element name="address" type="impl:Address"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getPhoneNumberInBodyResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="impl:Phone"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="address1" type="impl:Address"/>
+ <element name="updatePhoneNumbers">
+ <complexType>
+ <sequence>
+ <element name="phone" type="impl:Phone"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="address2" type="impl:Address"/>
+ <element name="address3" type="impl:Address"/>
+ <element name="updatePhoneNumbersResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="phone_in1" type="impl:Phone"/>
+ <element name="createPhoneNumberInBodyHeader">
+ <complexType>
+ <sequence>
+ <element name="areaCode" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="createPhoneNumberInBodyHeaderResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="impl:Phone"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="createPhoneNumberInBody">
+ <complexType>
+ <sequence>
+ <element name="areaCode" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="createPhoneNumberInBodyResponse">
+ <complexType>
+ <sequence>
+ <element name="result" type="impl:Phone"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getPhoneNumberInHeaderRequest">
+
+ <wsdl:part element="impl:address" name="address"/>
+
+ <wsdl:part element="impl:getPhoneNumberInHeader" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="sayHelloInHeaderResponse">
+
+ <wsdl:part element="impl:sayHelloInHeaderResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="createPhoneNumberInHeaderRequest">
+
+ <wsdl:part element="impl:area_code" name="area_code"/>
+
+ <wsdl:part element="impl:phone_in" name="phone_in"/>
+
+ <wsdl:part element="impl:createPhoneNumberInHeader" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="updatePhoneNumbersRequest">
+
+ <wsdl:part element="impl:address1" name="address1"/>
+
+ <wsdl:part element="impl:updatePhoneNumbers" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="createPhoneNumberInBodyHeaderResponse">
+
+ <wsdl:part element="impl:createPhoneNumberInBodyHeaderResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="updatePhoneNumbersResponse">
+
+ <wsdl:part element="impl:address2" name="address1"/>
+
+ <wsdl:part element="impl:address3" name="address2"/>
+
+ <wsdl:part element="impl:updatePhoneNumbersResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getPhoneNumberInBodyRequest">
+
+ <wsdl:part element="impl:getPhoneNumberInBody" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="createPhoneNumberInBodyResponse">
+
+ <wsdl:part element="impl:createPhoneNumberInBodyResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="sayHelloInBodyResponse">
+
+ <wsdl:part element="impl:sayHelloInBodyResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="sayHelloInHeaderRequest">
+
+ <wsdl:part element="impl:name_in" name="name_in"/>
+
+ <wsdl:part element="impl:sayHelloInHeader" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getPhoneNumberInHeaderResponse">
+
+ <wsdl:part element="impl:getPhoneNumberInHeaderResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getPhoneNumberInBodyResponse">
+
+ <wsdl:part element="impl:getPhoneNumberInBodyResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="createPhoneNumberInHeaderResponse">
+
+ <wsdl:part element="impl:createPhoneNumberInHeaderResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="createPhoneNumberInBodyHeaderRequest">
+
+ <wsdl:part element="impl:phone_in1" name="phone_in"/>
+
+ <wsdl:part element="impl:createPhoneNumberInBodyHeader" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="sayHelloInBodyRequest">
+
+ <wsdl:part element="impl:sayHelloInBody" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="createPhoneNumberInBodyRequest">
+
+ <wsdl:part element="impl:createPhoneNumberInBody" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="WebParamDocumentLiteralSample">
+
+ <wsdl:operation name="createPhoneNumberInHeader">
+
+ <wsdl:input message="impl:createPhoneNumberInHeaderRequest" name="createPhoneNumberInHeaderRequest"/>
+
+ <wsdl:output message="impl:createPhoneNumberInHeaderResponse" name="createPhoneNumberInHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getPhoneNumberInHeader">
+
+ <wsdl:input message="impl:getPhoneNumberInHeaderRequest" name="getPhoneNumberInHeaderRequest"/>
+
+ <wsdl:output message="impl:getPhoneNumberInHeaderResponse" name="getPhoneNumberInHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="sayHelloInBody">
+
+ <wsdl:input message="impl:sayHelloInBodyRequest" name="sayHelloInBodyRequest"/>
+
+ <wsdl:output message="impl:sayHelloInBodyResponse" name="sayHelloInBodyResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="sayHelloInHeader">
+
+ <wsdl:input message="impl:sayHelloInHeaderRequest" name="sayHelloInHeaderRequest"/>
+
+ <wsdl:output message="impl:sayHelloInHeaderResponse" name="sayHelloInHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getPhoneNumberInBody">
+
+ <wsdl:input message="impl:getPhoneNumberInBodyRequest" name="getPhoneNumberInBodyRequest"/>
+
+ <wsdl:output message="impl:getPhoneNumberInBodyResponse" name="getPhoneNumberInBodyResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="updatePhoneNumbers">
+
+ <wsdl:input message="impl:updatePhoneNumbersRequest" name="updatePhoneNumbersRequest"/>
+
+ <wsdl:output message="impl:updatePhoneNumbersResponse" name="updatePhoneNumbersResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="createPhoneNumberInBodyHeader">
+
+ <wsdl:input message="impl:createPhoneNumberInBodyHeaderRequest" name="createPhoneNumberInBodyHeaderRequest"/>
+
+ <wsdl:output message="impl:createPhoneNumberInBodyHeaderResponse" name="createPhoneNumberInBodyHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="createPhoneNumberInBody">
+
+ <wsdl:input message="impl:createPhoneNumberInBodyRequest" name="createPhoneNumberInBodyRequest"/>
+
+ <wsdl:output message="impl:createPhoneNumberInBodyResponse" name="createPhoneNumberInBodyResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="WebParamDocumentLiteralSampleSoapBinding" type="impl:WebParamDocumentLiteralSample">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="createPhoneNumberInHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="createPhoneNumberInHeaderRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:createPhoneNumberInHeaderRequest" namespace="http://webparam.web" part="area_code" use="literal">
+
+ </wsdlsoap:header>
+
+ <wsdlsoap:header message="impl:createPhoneNumberInHeaderRequest" namespace="http://webparam.web" part="phone_in" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="createPhoneNumberInHeaderResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getPhoneNumberInHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getPhoneNumberInHeaderRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:getPhoneNumberInHeaderRequest" namespace="http://webparam.web" part="address" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="getPhoneNumberInHeaderResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="sayHelloInBody">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="sayHelloInBodyRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="sayHelloInBodyResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="sayHelloInHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="sayHelloInHeaderRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:sayHelloInHeaderRequest" namespace="http://webparam.web" part="name_in" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="sayHelloInHeaderResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="getPhoneNumberInBody">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getPhoneNumberInBodyRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getPhoneNumberInBodyResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="updatePhoneNumbers">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="updatePhoneNumbersRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:updatePhoneNumbersRequest" namespace="http://webparam.web" part="address1" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="updatePhoneNumbersResponse">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:updatePhoneNumbersResponse" namespace="http://webparam.web" part="address1" use="literal">
+
+ </wsdlsoap:header>
+
+ <wsdlsoap:header message="impl:updatePhoneNumbersResponse" namespace="http://webparam.web" part="address2" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="createPhoneNumberInBodyHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="createPhoneNumberInBodyHeaderRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:createPhoneNumberInBodyHeaderRequest" namespace="http://webparam.web" part="phone_in" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="createPhoneNumberInBodyHeaderResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="createPhoneNumberInBody">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="createPhoneNumberInBodyRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="createPhoneNumberInBodyResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="WebParamDocumentLiteralSampleService">
+
+ <wsdl:port binding="impl:WebParamDocumentLiteralSampleSoapBinding" name="WebParamDocumentLiteralSample">
+
+ <wsdlsoap:address location="http://localhost:8080/wsm-samplesWS/web/webparam/WebParamDocumentLiteralSample.jws"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/log4j.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/log4j.properties?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/log4j.properties (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/log4j.properties Tue May 10 13:32:29 2005
@@ -0,0 +1,21 @@
+# Set root category priority to INFO and its only appender to CONSOLE.
+log4j.rootCategory=INFO, CONSOLE
+#log4j.rootCategory=INFO, CONSOLE, LOGFILE
+log4j.logger.org.controlhaus= DEBUG, CONSOLE
+log4j.logger.org.appache.beehive = DEBUG, CONSOLE
+# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
+log4j.logger.org.apache.axis.client= debug, CONSOLE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=- %c: %m%n
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.FileAppender
+log4j.appender.LOGFILE.File=axis.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.Threshold=INFO
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/HeaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/HeaderTest.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/HeaderTest.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/HeaderTest.java Tue May 10 13:32:29 2005
@@ -0,0 +1,118 @@
+/*
+ *
+ * Copyright 2004 BEA Systems, Inc.
+ *
+ * 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.
+ *
+ *
+ * Original author: Daryoush Mehrtash
+ */
+
+package org.wsm.samples.client.header;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.holders.StringHolder;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeaderElement;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import test.ControlTestCase;
+import org.w3c.dom.Element;
+
+import test.StockQuoteImplService;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+
+public class HeaderTest extends ControlTestCase {
+ static Logger logger = Logger.getLogger(HeaderTest.class);
+
+
+ /**
+ * Header element namespace prefix
+ */
+ private static final String SIGN_PREFIX
+ = "sign";
+
+ /**
+ * Header element
+ */
+ private static final String SIGN_ELEMENT
+ = "sign";
+
+
+
+ @Control StockQuoteImplService client;
+
+
+ public void setUp() throws Exception {
+ super.setUp(); // initialize my control instance....
+
+ }
+
+ public void testBadHeader() throws Exception {
+ SOAPElement signature = SignatureUtilities.getSignature("beehive", "invalidSeal");
+ SOAPHeaderElement headerRoot = new org.apache.axis.message.SOAPHeaderElement(getSignatureRootName());
+ headerRoot.setActor("simple-security");
+ headerRoot.addChildElement(signature);
+
+ Element[] badHeader = { headerRoot };
+ client.setOutputHeaders(badHeader);
+ try {
+ client.getQuote("bea");
+ fail("Should have caused a security violation");
+ } catch (Exception e) {
+ // good case
+ }
+ }
+
+
+
+ public void testGoodHeader() throws Exception {
+ SOAPElement signature = SignatureUtilities.getSignature("beehive", "beehive");
+ SOAPHeaderElement headerRoot = new org.apache.axis.message.SOAPHeaderElement(getSignatureRootName());
+ headerRoot.setActor("simple-security");
+ headerRoot.addChildElement(signature);
+
+ Element[] goodHeader = { headerRoot };
+ client.setOutputHeaders(goodHeader);
+ client.getQuote("bea");
+ Element[] respHeader = client.getInputHeaders();
+ System.out.println("Response header");
+ for(Element nxtHeader : respHeader) {
+ System.out.println(nxtHeader);
+ }
+ assertNotNull("The response message didn't have the header set!", respHeader );
+ assertNotNull("The response message didn't have the header set!", respHeader[0] );
+ assertTrue("response message didn't have the correct signature/seal", SignatureUtilities.isValidSignature((SOAPElement) respHeader[0]));
+
+ }
+
+ /**
+ * @return
+ * @throws SOAPException
+ */
+ private Name getSignatureRootName() throws SOAPException {
+ SOAPFactory factory = SOAPFactory.newInstance();
+
+ return factory.createName("sign",
+ "sign", "uri://org.example.webservices.signature.Sign");
+ }
+
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignException.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignException.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignException.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignException.java Tue May 10 13:32:29 2005
@@ -0,0 +1,55 @@
+package org.wsm.samples.client.header;
+
+/*
+ * 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.
+ *
+ * Original author: Daryoush Mehrtash
+ * Note: This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+*/
+/**
+ * SignException for general faults associated with signing.
+ */
+public class SignException extends RuntimeException {
+
+ /**
+ *
+ */
+ public SignException() {
+ super();
+ }
+
+ /**
+ * @param message
+ */
+ public SignException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public SignException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * @param cause
+ */
+ public SignException(Throwable cause) {
+ super(cause);
+ }
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignatureUtilities.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignatureUtilities.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignatureUtilities.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/header/SignatureUtilities.java Tue May 10 13:32:29 2005
@@ -0,0 +1,212 @@
+package org.wsm.samples.client.header;
+
+/*
+ * 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.
+ *
+ * Original author: Daryoush Mehrtash
+ * Note: This sample was developed based on the example in the article:
+ * http://www-128.ibm.com/developerworks/webservices/library/ws-tip-extend/
+ */
+import java.util.Iterator;
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.Name;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.soap.Text;
+
+
+
+
+/**
+ * Produce signature of the form: <simpleSignature><signer>... </signer>
+ * <seal>... </seal> </simpleSignature>
+ */
+public class SignatureUtilities {
+ private static final SOAPFactory factory;
+
+ private static final String SIGNATURE_NS = "uri://org.example.webservices.signature.SimpleSignature";
+
+ private static final String SIGNATURE_NS_PREFIX = "ssig";
+
+ private static final String SIGNATURE_ELEMENT = "signature";
+
+ private static final String SIGNER_ELEMENT = "signer";
+
+ private static final String SEAL_ELEMENT = "seal";
+
+ private static final Name SIGNATURE_NAME;
+
+ private static final Name SIGNER_NAME;
+
+ private static final Name SEAL_NAME;
+
+ static {
+ try {
+ factory = SOAPFactory.newInstance();
+
+ SIGNATURE_NAME = factory.createName(SIGNATURE_ELEMENT,
+ SIGNATURE_NS_PREFIX, SIGNATURE_NS);
+
+ SIGNER_NAME = factory.createName(SIGNER_ELEMENT);
+
+ SEAL_NAME = factory.createName(SEAL_ELEMENT);
+ } catch (SOAPException e) {
+ e.printStackTrace();
+ throw new SignException("SignatureToolImpl init failed", e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.example.webservices.signature.SignatureTool#getSignature(java.lang.String,
+ * javax.xml.soap.SOAPElement)
+ */
+ static public SOAPElement getSignature(String signersName, String sealValue) // ,
+ // SOAPElement
+ // content)
+ throws SOAPException {
+ SOAPElement sig = factory.createElement(SIGNATURE_NAME);
+
+ SOAPElement signer = sig.addChildElement(SIGNER_NAME);
+ signer.addTextNode(signersName);
+
+ SOAPElement seal = sig.addChildElement(SEAL_NAME);
+ seal.addTextNode(sealValue);
+
+ return sig;
+ }
+
+ /* (non-Javadoc)
+ * @see org.example.webservices.signature.SignatureTool#isSignatureValid(javax.xml.soap.SOAPElement, javax.xml.soap.SOAPElement)
+ */
+ static public boolean isValidSignature(SOAPElement signature) //, SOAPElement content)
+ throws SOAPException
+ {
+
+ signature = (SOAPElement) signature.getChildElements().next();
+
+ System.out.println("Testing signature");
+ if (!signature.getElementName().equals(SIGNATURE_NAME)) {
+ System.out.println("Failed signature test... SIGNATURE_NAME doesn't exist.");
+ throw new SignException("Unexpected element. got \"" +
+ signature.getElementName() +
+ "\", expected \"" +
+ SIGNATURE_NAME + "\"");
+ }
+
+ Iterator signerIter = signature.getChildElements(SIGNER_NAME);
+ if (!signerIter.hasNext()) {
+ System.out.println("Failed signature test... SIGNATURE_NAME doesn't have any child");
+ throw new SignException("Expected element missing. expected \"" +
+ SIGNER_NAME + "\"");
+ }
+ SOAPElement signer = (SOAPElement)signerIter.next();
+
+ Iterator sealIter = signature.getChildElements(SEAL_NAME);
+ if (!sealIter.hasNext()) {
+ System.out.println("Failed signature test... SIGNATURE_NAME doesn't have SEAL_NAME");
+ throw new SignException("Expected element missing. expected \"" +
+ SEAL_NAME + "\"");
+ }
+ SOAPElement seal = (SOAPElement)sealIter.next();
+
+ String signersName = ((Node)(signer.getChildElements().next())).getValue();
+ // String strContent = getContent(content);
+ String signedContent = signersName; //, strContent);
+
+ String sealedContent = ((Node)(seal.getChildElements().next())).getValue();
+
+ System.out.println("isSignatureValid: expected= " + signedContent);
+ System.out.println("isSignatureValid: received= " + sealedContent);
+
+ if (!signedContent.equals(sealedContent)) {
+ System.out.println("Signatures don't match!");
+ throw new SignException("Signed document does not match signature");
+ }
+
+ System.out.println("signatures match!");
+ return true;
+ }
+
+// static public boolean isValidSignature(SOAPElement root) throws SOAPException {
+// /* format of the header should match
+// <sign:sign xxxxx>
+// <ssig:signature >xxxx </signature>
+// <ssig:seal>xxxx</seal>
+// </sign:sing>
+// */
+//
+// //TODO: add validation to make sure the root is sign:sign
+// SOAPElement signature = (SOAPElement) root.getChildElements().next();
+// System.out.println("Testing signature");
+// if (!signature.getElementName().equals(SIGNATURE_NAME)) {
+// System.out
+// .println("Failed signature test... SIGNATURE_NAME doesn't exist.");
+// throw new SignException("Unexpected element. got \""
+// + signature.getElementName() + "\", expected \""
+// + SIGNATURE_NAME + "\"");
+// }
+//
+// Iterator signerIter = signature.getChildElements(SIGNER_NAME);
+//
+// if (!signerIter.hasNext()) {
+// System.out
+// .println("Failed signature test... SIGNATURE_NAME doesn't have any child");
+// throw new SignException("Expected element missing. expected \""
+// + SIGNER_NAME + "\"");
+// }
+// SOAPElement signer = (SOAPElement) signerIter.next();
+// System.out.println("++++++++++signaer node name: " + signer.getNodeName() + " type: " + signer.getNodeType());
+// String signerName = signer.getValue();
+//
+// Iterator sealIter = signature.getChildElements(SEAL_NAME);
+// if (!sealIter.hasNext()) {
+// System.out
+// .println("Failed signature test... SIGNATURE_NAME doesn't have SEAL_NAME");
+// throw new SignException("Expected element missing. expected \""
+// + SEAL_NAME + "\"");
+// }
+// SOAPElement seal = (SOAPElement) sealIter.next();
+// System.out.println("++++++++++seal node name: " + seal.getNodeName() + " type: " + seal.getNodeType());
+// String sealValue = seal.getValue();
+//
+// if(sealValue == null || signerName == null ) {
+// System.out.println(" Null is not a valid seal, or singer name. seal: " + sealValue + " signerName: " + signerName);
+// return false;
+// }
+// return sealValue.equals(signerName);
+//
+// }
+//
+//
+
+ private String elementName(SOAPElement e) {
+ return elementName(e.getElementName());
+ }
+
+ private String elementName(Name name) {
+ return "{" + name.getURI() + "}" + name.getLocalName();
+ }
+
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamDocumentLiteralSampleTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamDocumentLiteralSampleTest.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamDocumentLiteralSampleTest.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamDocumentLiteralSampleTest.java Tue May 10 13:32:29 2005
@@ -0,0 +1,82 @@
+/*
+ *
+ * Copyright 2004 BEA Systems, Inc.
+ *
+ * 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.
+ *
+ *
+ * Original author: Daryoush Mehrtash
+ */
+
+package org.wsm.samples.client.webparam;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.holders.StringHolder;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeaderElement;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import test.ControlTestCase;
+import org.w3c.dom.Element;
+
+import test.WebParamDocumentLiteralSampleService;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+import web.webparam.Phone;
+public class WebParamDocumentLiteralSampleTest extends ControlTestCase {
+ static Logger logger = Logger.getLogger(WebParamDocumentLiteralSampleTest.class);
+
+
+
+
+ @Control WebParamDocumentLiteralSampleService client;
+
+
+ public void setUp() throws Exception {
+ super.setUp(); // initialize my control instance....
+
+ }
+
+
+
+
+
+ public void testcreatePhoneNumberInBody() throws Exception {
+
+ Phone newPhone = client.createPhoneNumberInBody(206 );
+ System.out.println("***********************************************************Newphone code: " + newPhone.getAreaCode());
+ assertTrue(newPhone.getAreaCode() == 206);
+
+ }
+
+ public void testcreatePhoneNumberInHeader() throws Exception {
+ Phone oldPhone = Phone.Factory.newInstance();
+ oldPhone.setAreaCode(111);
+ oldPhone.setExchange("MyExchange");
+ oldPhone.setNumber("1111111");
+ Phone newPhone = client.createPhoneNumberInHeader(206, oldPhone );
+ System.out.println("***********************************************************Newphone code: " + newPhone.getAreaCode());
+ assertTrue(newPhone.getAreaCode() == 206);
+ assertTrue(newPhone.getExchange().equals("MyExchange"));
+ assertTrue(newPhone.getNumber().equals("1111111"));
+ }
+
+
+}
Added: incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamRpcLiteralSampleTest.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamRpcLiteralSampleTest.java?rev=169518&view=auto
==============================================================================
--- incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamRpcLiteralSampleTest.java (added)
+++ incubator/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/junit/org/wsm/samples/client/webparam/WebParamRpcLiteralSampleTest.java Tue May 10 13:32:29 2005
@@ -0,0 +1,86 @@
+/*
+ *
+ * Copyright 2004 BEA Systems, Inc.
+ *
+ * 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.
+ *
+ *
+ * Original author: Daryoush Mehrtash
+ */
+
+package org.wsm.samples.client.webparam;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.StringHolder;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeaderElement;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+import test.ControlTestCase;
+import org.w3c.dom.Element;
+
+import test.RpcLiteralSampleService;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.api.context.ControlContainerContext;
+import org.apache.beehive.controls.api.context.ControlThreadContext;
+import org.apache.beehive.web.webservice.rpc_examples.Phone;
+import org.apache.beehive.web.webservice.rpc_examples.Address;
+
+import org.apache.beehive.web.webservice.rpc_examples.StateType;
+import org.apache.beehive.wsm.databinding.GenericHolder;
+
+public class WebParamRpcLiteralSampleTest extends ControlTestCase {
+ static Logger logger = Logger.getLogger(WebParamRpcLiteralSampleTest.class);
+
+
+
+
+ @Control RpcLiteralSampleService client;
+
+
+ public void setUp() throws Exception {
+ super.setUp(); // initialize my control instance....
+
+ }
+
+
+
+
+
+ public void testcreatePhoneNumberInBody() throws Exception {
+
+ GenericHolder<Address> addressHolder = new GenericHolder<Address>(new Address());
+ javax.xml.rpc.holders.IntHolder res = new IntHolder();
+ client.createAddressInBody(addressHolder, res);
+ assertTrue(addressHolder.value.getState().getState().equals("PA") );
+
+ }
+
+// public void testcreatePhoneNumberInHeader() throws Exception {
+// GenericHolder<Address> addressHolder = new GenericHolder<Address>(new Address());
+// javax.xml.rpc.holders.IntHolder res = new IntHolder();
+// client.createAddressInHeader(addressHolder, res);
+// assertTrue(addressHolder.value.getState().getState().equals("CA") );
+//
+// }
+
+
+}