You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/02/17 13:07:23 UTC
svn commit: r154151 - in
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1:
build.xml conf/ conf/META-INF/ conf/META-INF/service.xml src/META-INF/
src/SynchronousClient.java
Author: chathura
Date: Thu Feb 17 04:07:20 2005
New Revision: 154151
URL: http://svn.apache.org/viewcvs?view=rev&rev=154151
Log: (empty)
Added:
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/build.xml
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/META-INF/
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/META-INF/service.xml
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/src/SynchronousClient.java
Removed:
webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/src/META-INF/
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/build.xml?view=auto&rev=154151
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/build.xml (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/build.xml Thu Feb 17 04:07:20 2005
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<!-- ======================================================================
+ Feb 11, 2005 1:04:21 PM
+
+ This build file is intended to compile and run the Axis2 sample
+ provided here with the service being deployed at Tomcat or by
+ running a simple Axis2 server.
+
+
+
+ ====================================================================== -->
+<project name="sample1" basedir="." default="compile">
+ <property name="src.dir" value="src" />
+ <property name="classes.dir" value="./classes" />
+ <property name="build.dir" value="./build" />
+ <property name="lib.dir" value="./lib" />
+ <property name="conf.dir" value="./conf"/>
+ <property name="jardrop.dir" value="services"/>
+ <property environment="env"/>
+ <property name="AXIS_HOME" value="${env.AXIS_HOME}"/>
+ <property name="axis.serverJarDrop.dir" value="${AXIS_HOME}/WEB-INF/services"/>
+
+
+
+
+ <path id="classpath.library">
+ <fileset dir="${AXIS_HOME}/WEB-INF/lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="classpath.client">
+ <fileset dir="${lib.dir}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="classpath.runtimelibraries">
+ <path refid="classpath.library" />
+ <path refid="classpath.client" />
+ </path>
+
+
+
+
+ <target name="clean" description="Delete all generated files">
+ <delete dir="${classes.dir}" failonerror="false" />
+ <delete dir="${services.dir}" failonerror="false"/>
+ <delete dir="${build.dir}" failonerror="false" />
+ <delete dir="${lib.dir}" failonerror="false"/>
+ </target>
+
+ <target name="validateAxisHome">
+ <available file="${AXIS_HOME}}" type="dir" property="axis2.deployed"/>
+ </target>
+
+ <target name="validateSevices.dir">
+ <available file="${AXIS_HOME}/WEB-INF/services" type="dir" property="axis2.services"/>
+ </target>
+
+ <target name="validateDeploymentSettings" depends="validateAxisHome" unless="validateSevices.dir">
+ <mkdir dir="${AXIS_HOME}/WEB-INF/services"/>
+ </target>
+
+
+ <target name="createDir">
+ <mkdir dir="${build.dir}" />
+ <mkdir dir="${lib.dir}"/>
+ <mkdir dir="${classes.dir}" />
+ <mkdir dir="${build.dir}/${jardrop.dir}"/>
+ </target>
+
+ <target name="compile" depends="clean,createDir">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" >
+ <classpath refid="classpath.library"/>
+ </javac>
+ <jar destfile="${lib.dir}/${ant.project.name}-all.jar">
+ <fileset dir="${classes.dir}"/>
+ </jar>
+ <jar destfile="${build.dir}/${jardrop.dir}/${ant.project.name}.jar">
+
+ <fileset dir="${classes.dir}">
+ <include name="**/EchoXML.class"/>
+ </fileset>
+ <fileset dir="${conf.dir}">
+ <include name="META-INF/service.xml"/>
+ </fileset>
+ </jar>
+ <delete dir="${classes.dir}" failonerror="false"/>
+ </target>
+
+
+ <target name="deploy" depends="compile,validateDeploymentSettings">
+ <copy file="${build.dir}/${jardrop.dir}/${ant.project.name}.jar" todir="${axis.serverJarDrop.dir}" overwrite="true"/>
+ </target>
+
+ <target name="echo" depends="compile">
+ <java classname="SynchronousClient">
+ <classpath refid="classpath.runtimelibraries"/>
+ <arg value="8080"/>
+ </java>
+ </target>
+
+
+</project>
+
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/META-INF/service.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/META-INF/service.xml?view=auto&rev=154151
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/META-INF/service.xml (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/conf/META-INF/service.xml Thu Feb 17 04:07:20 2005
@@ -0,0 +1,4 @@
+<service provider="org.apache.axis.providers.RawXMLProvider" style="xsd:anyURI" contextPath="xsd:anycontextPath" >
+ <java:implementation class="EchoXML" xmlns:java="http://ws.apache.org/axis2/deployment/java"/>
+ <operation name="echo" qname="echo"/>
+</service>
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/src/SynchronousClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/src/SynchronousClient.java?view=auto&rev=154151
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/src/SynchronousClient.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/userguide/sample1/src/SynchronousClient.java Thu Feb 17 04:07:20 2005
@@ -0,0 +1,96 @@
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPEnvelope;
+
+/*
+ * Copyright 2001-2004 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.
+ */
+
+
+public class SynchronousClient {
+
+ public static void main(String[] args){
+ System.out.println("Initializing the Client Call....");
+ Call call = new Call();
+ System.out.println("Setting the Endpointreference ");
+ URL url = null;
+ try {
+ url = new URL("http","127.0.0.1",new Integer(args[0]).intValue(),"/axis2/services/sample1");
+ } catch (MalformedURLException e) {
+
+ e.printStackTrace();
+ System.exit(0);
+ }
+
+ call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url.toString()));
+
+ try {
+ call.setListenerTransport(Constants.SESSION_SCOPE, true);
+ SOAPEnvelope requestEnvelop = getEchoSoapEnvelop();
+
+ System.out.println("Sending request...");
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+ requestEnvelop.serialize(writer,true);
+ writer.flush();
+ System.out.println();
+ SOAPEnvelope responceEnvelop = call.sendReceive(requestEnvelop);
+ System.out.println("Responce received ...");
+ responceEnvelop.serialize(writer,true);
+ writer.flush();
+
+ } catch (AxisFault e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (XMLStreamException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (FactoryConfigurationError e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ }
+
+
+ private static SOAPEnvelope getEchoSoapEnvelop(){
+ OMFactory omFactory = OMFactory.newInstance();
+ SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
+ OMNamespace namespace = envelope.declareNamespace("http://sample1.org/sample1", "sample1");
+
+ OMElement bodyContent = omFactory.createOMElement("echo", namespace);
+
+
+ OMElement text = omFactory.createOMElement("Text", namespace);
+ text.addChild(omFactory.createText("Axis2 Echo String"));
+ bodyContent.addChild(text);
+ envelope.getBody().addChild(bodyContent);
+ return envelope;
+ }
+
+}