You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "M. Ranganathan" <mr...@gmail.com> on 2006/07/04 12:19:40 UTC

Embedding axis in a Jetty powered application.

Hello!

I am trying to embed Axis in a jetty powered application ( with Jetty 
imbedded in a j2se application). Has anybody tried this successfully ? I 
have read the "Advanced Installation " section of 
http://ws.apache.org/axis/java/install.html  Is there anything more to 
be aware of?

Thank you

Ranga

-- 
M. Ranganathan 

Advanced Networking Technologies Division,
National Institute of Standards and Technology (NIST),
100 Bureau Drive, Stop 8920, Gaithersburg, MD 20899. 
tel:301 975 3664 , fax:301 590 0932 http://w3.antd.nist.gov/
Advanced Networking Technologies For the People!  



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Embedding axis in a Jetty powered application.

Posted by "M. Ranganathan" <mr...@gmail.com>.
Hi Bruno,

Thanks! I did all of what you suggested. Let me preface this by saying I 
am a newbie at all this. Now I am running into a porblem. Here is my 
scenario:

I have a simple service  "Echo" which I want to try.
=========================================

file: Echo.java
========================================
package gov.nist.trial;
public class Echo {
    public String echo(String arg) {
          return arg;
   }
}

========================================
Axis initialization code
========================================
...............
this.httpServer = new Server();
       
        SocketListener socketListener = new SocketListener();
       
         socketListener.setHost("127.0.0.1");
        socketListener.setPort(8080);
        this.httpServer.addListener(socketListener);
           
        this.httpServer.addWebApplication("/axis", "/webapps/axis");
       
        this.httpServer.start();
...............
======================================
In the directory /webapps/axis/Echo I put the following deployment 
decriptor and nothing
else
======================================
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 <service name="MyService" provider="java:RPC">
  <parameter name="className" value="gov.nist.trial.Echo"/>
  <parameter name="allowedMethods" value="*"/>
 </service>

</deployment>
=====================================
Then I fire up the server and the client. The client looks like this
======================================
public class Client {
    public static void main(String[] args) {
        try {
            Options options = new Options(args);

            //String endpointURL = "http://127.0.0.1:8880/axis";
            String endpoint = "http://127.0.0.1:8080/axis/Echo";
            String textToSend;

            args = options.getRemainingArgs();
            if ((args == null) || (args.length < 1)) {
                textToSend = "<nothing>";
            } else {
                textToSend = args[0];
            }

            textToSend = "foo";

            Service service = new Service();
            Call call = (Call) service.createCall();

            URL endpointURL = new URL(endpoint);
            call.setTargetEndpointAddress(endpointURL);
            call.setOperationName("echo");
            call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

            String ret = (String) call.invoke(new Object[]{textToSend});

            System.out.println("You typed : " + ret);
        } catch (Exception e) {
            System.err.println(e.toString());
        }
    }
}

============================================

I get:
     [java] Jul 4, 2006 11:11:16 PM org.apache.axis.utils.JavaUtils 
isAttachmentSupported
     [java] WARNING: Unable to find required classes 
(javax.activation.DataHandl
er and javax.mail.internet.MimeMultipart). Attachment support is disabled.
     [java] org.xml.sax.SAXException: Bad envelope tag:  HTML

Did I get all of this right so far? I must be missing something ( java 
activation framework?) Any clues?  Sorry for the length of  the 
question. Hope you got this far in reading it :-)

Thanks in advance

Ranga


Bruno Harbulot wrote:

> Hi Ranga,
>
>
> If you unzip the binary distributions of Axis and Jetty, put the jar 
> files on your classpath and write a class like this:
>
> public class Test {
>     public static void main(String[] args) throws Exception {
>         Server server = new Server();
>         SocketListener listener = new SocketListener();
>         listener.setPort(8080);
>         server.addListener(listener);
>         
> server.addWebApplication("/axis",System.getProperty("axis.webapp.dir"));
>     }
> }
>
>
> You can then use an ant build.xml file like this:
>
> <project default="run">
> <target name="settings">           
>     <property name="dest.dir" location="bin" />
>     <property name="src.dir" location="src" />
>
>     <property name="jetty.dir" location="jetty-5.1.11RC0" />
>     <property name="jetty.lib.dir" location="${jetty.dir}/lib" />
>     <property name="jetty.ext.dir" location="${jetty.dir}/ext" />
>     <path id="jetty.classpath.id">
>         <fileset dir="${jetty.lib.dir}" includes="*.jar" />
>         <fileset dir="${jetty.ext.dir}" includes="*.jar" />
>     </path>
>
>     <property name="axis.dir" location="axis-1_3" />
>     <property name="axis.lib.dir" location="${axis.dir}/lib" />
>     <path id="axis.classpath.id">
>         <fileset dir="${axis.lib.dir}" includes="*.jar" />
>     </path>
> </target>
>
> <target name="build" depends="settings">
>     <javac destdir="${dest.dir}" source="1.5" debug="true">
>         <classpath>
>             <path refid="jetty.classpath.id" />
>             <path refid="axis.classpath.id" />
>         </classpath>
>         <src path="${src.dir}" />
>     </javac>
> </target>
>
> <target name="run" depends="settings">
>     <java classname="Test" fork="true">
>         <sysproperty key="axis.webapp.dir" 
> path="${axis.dir}/webapps/axis" />
>         <classpath>
>             <path refid="jetty.classpath.id" />
>             <path refid="axis.classpath.id" />
>             <path location="${dest.dir}" />
>         </classpath>
>     </java>
> </target>
> </project>
>
>
>
> (You may need to add deploy/undeploy target as usual).
> If you're using jetty-5.1.11RC0, you'll also need to have tools.jar 
> from the JDK on your classpath. You can avoid to use tools.jar if you 
> copy the jasper-*.jar file from one of the latest Tomcat binary 
> archives where the jasper-*.jar in the jetty tree are (Javac can be 
> replaced with the Eclipse JDT compiler).
>
> You can obviously refine this and adapt it to your needs, but this 
> should get you started.
>
>
> Cheers,
>
> Bruno.
>
>
>
> M. Ranganathan wrote:
>
>> Hello!
>>
>> I am trying to embed Axis in a jetty powered application ( with Jetty 
>> imbedded in a j2se application). Has anybody tried this successfully 
>> ? I have read the "Advanced Installation " section of 
>> http://ws.apache.org/axis/java/install.html  Is there anything more 
>> to be aware of?
>>
>> Thank you
>>
>> Ranga
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
M. Ranganathan 

Advanced Networking Technologies Division,
National Institute of Standards and Technology (NIST),
100 Bureau Drive, Stop 8920, Gaithersburg, MD 20899. 
tel:301 975 3664 , fax:301 590 0932 http://w3.antd.nist.gov/
Advanced Networking Technologies For the People!  



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Embedding axis in a Jetty powered application.

Posted by Bruno Harbulot <Br...@manchester.ac.uk>.
Hi Ranga,


If you unzip the binary distributions of Axis and Jetty, put the jar 
files on your classpath and write a class like this:

public class Test {
	public static void main(String[] args) throws Exception {
		Server server = new Server();
		SocketListener listener = new SocketListener();
		listener.setPort(8080);
		server.addListener(listener);
		server.addWebApplication("/axis",System.getProperty("axis.webapp.dir"));
	}
}


You can then use an ant build.xml file like this:

<project default="run">
<target name="settings">			
	<property name="dest.dir" location="bin" />
	<property name="src.dir" location="src" />

	<property name="jetty.dir" location="jetty-5.1.11RC0" />
	<property name="jetty.lib.dir" location="${jetty.dir}/lib" />
	<property name="jetty.ext.dir" location="${jetty.dir}/ext" />
	<path id="jetty.classpath.id">
		<fileset dir="${jetty.lib.dir}" includes="*.jar" />
		<fileset dir="${jetty.ext.dir}" includes="*.jar" />
	</path>

	<property name="axis.dir" location="axis-1_3" />
	<property name="axis.lib.dir" location="${axis.dir}/lib" />
	<path id="axis.classpath.id">
		<fileset dir="${axis.lib.dir}" includes="*.jar" />
	</path>
</target>

<target name="build" depends="settings">
	<javac destdir="${dest.dir}" source="1.5" debug="true">
		<classpath>
			<path refid="jetty.classpath.id" />
			<path refid="axis.classpath.id" />
		</classpath>
		<src path="${src.dir}" />
	</javac>
</target>

<target name="run" depends="settings">
	<java classname="Test" fork="true">
		<sysproperty key="axis.webapp.dir" path="${axis.dir}/webapps/axis" />
		<classpath>
			<path refid="jetty.classpath.id" />
			<path refid="axis.classpath.id" />
			<path location="${dest.dir}" />
		</classpath>
	</java>
</target>
</project>



(You may need to add deploy/undeploy target as usual).
If you're using jetty-5.1.11RC0, you'll also need to have tools.jar from 
the JDK on your classpath. You can avoid to use tools.jar if you copy 
the jasper-*.jar file from one of the latest Tomcat binary archives 
where the jasper-*.jar in the jetty tree are (Javac can be replaced with 
the Eclipse JDT compiler).

You can obviously refine this and adapt it to your needs, but this 
should get you started.


Cheers,

Bruno.



M. Ranganathan wrote:
> Hello!
> 
> I am trying to embed Axis in a jetty powered application ( with Jetty 
> imbedded in a j2se application). Has anybody tried this successfully ? I 
> have read the "Advanced Installation " section of 
> http://ws.apache.org/axis/java/install.html  Is there anything more to 
> be aware of?
> 
> Thank you
> 
> Ranga
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org