You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by du...@apache.org on 2006/03/22 13:02:19 UTC

svn commit: r387844 - in /webservices/axis/trunk/java/samples/wsa: ./ build.xml deploy.wsdd testit.cmd undeploy.wsdd wsaClient.java wsaService.java

Author: dug
Date: Wed Mar 22 04:02:15 2006
New Revision: 387844

URL: http://svn.apache.org/viewcvs?rev=387844&view=rev
Log:
add missing wsa sample

Added:
    webservices/axis/trunk/java/samples/wsa/
    webservices/axis/trunk/java/samples/wsa/build.xml
    webservices/axis/trunk/java/samples/wsa/deploy.wsdd
    webservices/axis/trunk/java/samples/wsa/testit.cmd
    webservices/axis/trunk/java/samples/wsa/undeploy.wsdd
    webservices/axis/trunk/java/samples/wsa/wsaClient.java
    webservices/axis/trunk/java/samples/wsa/wsaService.java

Added: webservices/axis/trunk/java/samples/wsa/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/wsa/build.xml?rev=387844&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/wsa/build.xml (added)
+++ webservices/axis/trunk/java/samples/wsa/build.xml Wed Mar 22 04:02:15 2006
@@ -0,0 +1,63 @@
+<?xml version="1.0" ?>
+<!DOCTYPE project [
+        <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
+        <!ENTITY paths  SYSTEM "file:../../xmls/path_refs.xml">
+        <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
+        <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml">
+        <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
+]>
+
+<!-- ===================================================================
+<description>
+   Test/Sample Component file for Axis
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+Build Instructions:
+   To compile
+        ant compile
+   To execute
+        ant run
+
+Copyright:
+  Copyright (c) 2002-2003 Apache Software Foundation.
+</description>
+==================================================================== -->
+
+<project default="compile">
+<property name="axis.home" location="../.." />
+<property name="componentName" value="samples/wsa" />
+
+        &properties;
+        &paths;
+        &taskdefs;
+        &taskdefs_post_compile;
+	&targets;
+
+<target name="clean"/>
+
+<target name="copy" depends="setenv"/>
+
+<target name="compile" depends="copy">
+  <javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}">
+    <classpath>
+        <path refid="classpath"/>
+    </classpath>
+    <include name="samples/wsa/**/*.java"/>
+    <exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
+    <exclude name="**/old/**/*.java" />
+  </javac>
+</target>
+
+<target name="deploy"/>
+
+<target name="run"/>
+
+<target name="undeploy"/>
+
+</project>

Added: webservices/axis/trunk/java/samples/wsa/deploy.wsdd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/wsa/deploy.wsdd?rev=387844&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/wsa/deploy.wsdd (added)
+++ webservices/axis/trunk/java/samples/wsa/deploy.wsdd Wed Mar 22 04:02:15 2006
@@ -0,0 +1,17 @@
+<!-- Use this file to deploy some handlers/chains and services      -->
+<!-- Two ways to do this:                                           -->
+<!--   java org.apache.axis.client.AdminClient deploy.wsdd          -->
+<!--      after the axis server is running                          -->
+<!-- or                                                             -->
+<!--   java org.apache.axis.utils.Admin client|server deploy.wsdd   -->
+<!--      from the same directory that the Axis engine runs         -->
+
+<deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+
+  <service name="wsaService" provider="java:RPC">
+    <parameter name="className" value="samples.wsa.wsaService"/>
+    <parameter name="allowedMethods" value="*"/>
+  </service>
+
+</deployment>

Added: webservices/axis/trunk/java/samples/wsa/testit.cmd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/wsa/testit.cmd?rev=387844&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/wsa/testit.cmd (added)
+++ webservices/axis/trunk/java/samples/wsa/testit.cmd Wed Mar 22 04:02:15 2006
@@ -0,0 +1,10 @@
+rem this assumes webserver is running on port 8080
+
+@echo Deploy everything first
+java org.apache.axis.client.AdminClient deploy.wsdd %*
+
+@echo These next 3 should work...
+java samples.wsa.wsaClient
+
+@echo Now undeploy everything
+java org.apache.axis.client.AdminClient undeploy.wsdd %*

Added: webservices/axis/trunk/java/samples/wsa/undeploy.wsdd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/wsa/undeploy.wsdd?rev=387844&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/wsa/undeploy.wsdd (added)
+++ webservices/axis/trunk/java/samples/wsa/undeploy.wsdd Wed Mar 22 04:02:15 2006
@@ -0,0 +1,3 @@
+<undeployment name="test" xmlns="http://xml.apache.org/axis/wsdd/">
+  <service name="wsaService"/>
+</undeployment>

Added: webservices/axis/trunk/java/samples/wsa/wsaClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/wsa/wsaClient.java?rev=387844&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/wsa/wsaClient.java (added)
+++ webservices/axis/trunk/java/samples/wsa/wsaClient.java Wed Mar 22 04:02:15 2006
@@ -0,0 +1,42 @@
+package samples.wsa ;
+
+import org.apache.axis.client.Call ;
+import org.apache.axis.client.Service ;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.utils.Options;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.namespace.QName;
+import org.apache.axis.transport.http.SimpleAxisServer ;
+
+public class wsaClient {
+  static public void main(String[] args) throws Exception {
+    try {
+      Options opts = new Options( args );
+
+      args = opts.getRemainingArgs();
+
+      (new SimpleAxisServer()).startListening(88);
+
+      Service  service = new Service();
+      Call     call    = (Call) service.createCall();
+
+      call.setTargetEndpointAddress( opts.getURL() );
+      call.setProperty( "useWSA", "true" );
+      call.addParameter( "text", XMLType.XSD_STRING, ParameterMode.IN );
+      call.setReturnType( XMLType.XSD_STRING );
+      call.setEncodingStyle("");
+
+      System.out.println( "Calling ping (one way)" );
+      call.invokeOneWay( "ping", new Object[] { "hi" } );
+
+      Thread.sleep(1000);
+
+      call.setReplyTo( "http://localhost:81/axis/services/asyncService" );
+      System.out.println( call.invoke( "echo", new Object[] { "hi" } ) );
+
+    }
+    catch( Exception e ) {
+      e.printStackTrace();
+    }
+  }
+}

Added: webservices/axis/trunk/java/samples/wsa/wsaService.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/samples/wsa/wsaService.java?rev=387844&view=auto
==============================================================================
--- webservices/axis/trunk/java/samples/wsa/wsaService.java (added)
+++ webservices/axis/trunk/java/samples/wsa/wsaService.java Wed Mar 22 04:02:15 2006
@@ -0,0 +1,16 @@
+package samples.wsa;
+
+import org.apache.axis.MessageContext ;
+
+public class wsaService {
+  public void ping(String str) {
+    System.out.println("Ping: " + str );
+    MessageContext.getCurrentContext().setIsOneWay(true);
+    MessageContext.getCurrentContext().setEncodingStyle("");
+  }
+
+  public String echo(String str) {
+    System.out.println("Echo: " + str );
+    return str ;
+  }
+}