1) Deploying Axis web application on JBoss:
I used Axis 1.4 on JBoss-4.0.4 GCA. Assuming you downloaded Axis to D: , copy the "axis" folder present in D:\Axis-1.4\webapps folder to %JBOSS_HOME%\server\default\deploy folder. The "axis" folder that you copied is nothing but an web application (containing of some servlets and jsps provided by Axis). In JBoss for a web application to be deployed, it has to be named *.war, so rename the "axis" folder in %JBOSS_HOME%\server\default\deploy to axis.war. At this point, the axis web application is ready to be deployed on JBoss. But before starting JBoss, delete the commons-logging-x.x.x.jar and log4j-x.x.x.jar present in %JBOSS_HOME%\server\default\deploy\axis.war\WEB-INF\lib directory, since JBoss maintains its own versions of these jars and packaging these jars in your application will throw exceptions of JBoss startup. After you have deleted these jars, start the JBoss server using the run.bat present in %JBOSS_HOME%\bin folder.
2) Verify Axis web application is deployed and running:
After JBoss has started successfully, go to the following URL to check whether axis is deployed properly:
http://localhost:8080/axis
If Axis was deployed successfully, you will see a welcome page which will have a few links, one of them named "List" which can be used to view the already deployed webservices. Axis by default comes with a few sample webservices which you can see on clicking the "List" link.
3) Writing our own webservice:
3a - The Java classes/interfaces:
Lets create a simple webservice which will echo a message to the user who passes his name. We will have an interface named HelloWorldService:
package org.myapp.service;
public interface HelloWorldService {
public String sayHelloTo(String userName);
}
And here's the implementing class:
package org.myapp.service;
public class HelloWorldServiceImpl implements HelloWorldService {
public String sayHelloTo(String userName) {
//message
String hello = "Hello " + userName + ". You are being watched";
System.out.println(hello);
//return the message
return hello;
}
}
Do you see anything special in this class or the interface? No, you wont. So how do you convert these into webservices? Read on...
3b - Create a wsdl file:
Now that we have the interface and the class ready, lets create a wsdl file out of these java classes. Axis comes with utilities which allow you to create the wsdl file from a java file. I wrote a small ant target which will do this for me:
<!-- Sets classpath for build -->
<path id="classpath">
<pathelement path="${java.class.path}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
<pathelement path="${classes.dir}" />
</path>
<taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" >
<classpath refid="classpath"/>
</taskdef>
<target name="generateWSDL" description="Generates wsdl files from the java service interfaces">
<mkdir dir="${wsdl.dir}"/>
<axis-java2wsdl classpathref="classpath"
output="${wsdl.dir}/HelloWorld.wsdl"
location="http://localhost:8080/axis/services/HelloWorld"
namespace="http://jaikiran.com"
classname="org.myapp.service.HelloWorldService">
<mapping namespace="http://jaikiran.com" package="org.myapp.service"/>
</axis-java2wsdl>
</target>
Note: You can find the entire build.xml, that i used, at the end of this article.
You will require the org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask class which is provided by axis to be in the classpath of Ant. This class comes bundled in the axis-ant.jar which i have included in the classpath of this task using the classpathref.
In this target you specify parameters like:
location - this is where the webservice will be deployed.
namespace - the namespace for your webservice
classname - the fully qualified name of the interface which you wrote in step 3a, above.
and also a mapping between the webservice namespace and your application packages.
This target will generate the wsdl file named HelloWorld.wsdl in the directory which you specified in the 'output' parameter of the target.
3c - Create the deploy.wsdd, undeploy.wsdd and the stubs:
Now that you have created a wsdl for your webservice, lets go ahead and create the deploy.wsdd (used for deploying a webservice on the server), undeploy.wsdd (used for undeploying a webservice from the server) and the required stubs for invoking the webservice from a java client.
Again, Axis provides utilities for creating these files. Axis accepts the wsdl file, which we created in step 3b as an input to create these files. Here's the Ant target which does this for us:
<taskdef name="axis-wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" >
<classpath refid="classpath"/>
</taskdef>
<target name="generateWSDD" description="Generates wsdd files from the wsdl files">
<mkdir dir="${wsdd.dir}"/>
<axis-wsdl2java
output="${wsdd.dir}"
deployscope="Application"
serverside="true"
url="${wsdl.dir}\HelloWorld.wsdl">
</axis-wsdl2java>
</target>
This single target creates the deploy.wsdd, undeploy.wsdd and the stubs. As already mentioned, this target takes the wsdl file as an input which we have specified in the 'url' parameter of the axis-wsdl2java target. The files will be created in the directory mentioned in the 'output' parameter of this target. The deploy.wsdd file that gets generated will contain something like:
<!-- 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
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<!-- Services from HelloWorldServiceService WSDL service -->
<service name="HelloWorld" provider="java:RPC" style="rpc" use="encoded">
<parameter name="wsdlTargetNamespace" value="http://jaikiran.com"/>
<parameter name="wsdlServiceElement" value="HelloWorldServiceService"/>
<parameter name="wsdlServicePort" value="HelloWorld"/>
<parameter name="className" value="com.jaikiran.HelloWorldSoapBindingImpl"/>
<parameter name="wsdlPortType" value="HelloWorldService"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation name="sayHelloTo" qname="operNS:sayHelloTo" xmlns:operNS="http://jaikiran.com" returnQName="sayHelloToReturn" returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema" soapAction="" >
<parameter qname="in0" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
</operation>
<parameter name="allowedMethods" value="sayHelloTo"/>
<parameter name="scope" value="Application"/>
</service>
</deployment>
You might notice that during all these steps we never mentioned our implementing class (HelloWorldServiceImpl) in any of the targets. As you can see above in the deploy.wsdd, Axis has created its own implementing class for the HelloWorldService and provided default implementations in that class. In the deploy.wsdd file, it mentioned the implementation class as follows:
<parameter name="className" value="com.jaikiran.HelloWorldSoapBindingImpl"/>
The reason why Axis created this implementing class is that it never knew that we had created our own implementation. The input that we provided to Axis for generating the wsdd files was a wsdl file through which Axis could never have known that we already have a implementation class.
Our next step would be to modify the deploy.wsdd file to mention our implementation class, in place of Axis'. So let's change the 'className' parameter to:
<parameter name="className" value="org.myapp.service.HelloWorldServiceImpl"/>
3d - Deploy the webservice onto the server:
Now we are almost ready to deploy the webservice onto the server. But before doing that, we will have to make the HelloWorldService.class and HelloWorldServiceImpl.class available in the server's classpath so that when we use this webservice, the server wont throw ClassNotFoundException. So let's compile these 2 classes and place the class files in the %JBOSS_HOME%\server\default\deploy\axis.war\WEB-INF\classes folder. Here's the Ant target that i used to compile these classes:
<target name="compile" description="Compiles java source code">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${compile.src}" excludes="org/myapp/service/client/**/*.java"/>
</target>
Once this is done, we are ready to deploy the webservice onto the server. Axis again provides a utility to do this. Here's the target for deploying the service onto the server. This target just invokes the org.apache.axis.client.AdminClient java class passing it the deploy.wsdd file as an argument.
<target name="deployWebservice" description="Deploys the webservice onto the server, using the wsdd file and Axis' AdminClient">
<java classname="org.apache.axis.client.AdminClient" classpathref="classpath" fork="true">
<arg value="${wsdd.dir}/com/jaikiran/deploy.wsdd"/>
</java>
</target>
Now that we have deployed the webservice, lets verify whether its deployed successfully. Let's again go to http://localhost:8080/axis . Here again lets click the "List" link to see all the available webservices. This time you will notice that our HelloWorld service is also listed over here. You can view the wsdl of this webservice, by clicking the wsdl link next to it. Our webservice has been deployed at http://localhost:8080/axis/services/HelloWorld as you can see from the wsdl contents. So let's hit this url. You will see a message like:
HelloWorld
Hi there, this is an AXIS service!
Perhaps there will be a form for invoking the service here...
4) Java client for accessing the webservice that we created:
Let's now create a simple java client which accesses the webservice that we just deployed on the server.
You might remember that in step 3c, we even created the stubs required to access the webservice. We will use these stubs in our java client to access the webservice. Here's the simple java client:
package org.myapp.service.client;
import com.jaikiran.HelloWorldService;
import com.jaikiran.HelloWorldServiceServiceLocator;
public class ServiceClient {
/**
* @param args
*/
public static void main(String[] args) {
try {
//Get hold of the webservice using the locator provided by Axis
HelloWorldService helloWorldService = new HelloWorldServiceServiceLocator().getHelloWorld();
//Invoke the method on the webservice
String message = helloWorldService.sayHelloTo("someUserName");
System.out.println("Client received: " + message);
} catch (Exception e) {
e.printStackTrace();
}
}
}
In this class you will notice that we are using HelloWorldServiceServiceLocator and the HelloWorldService which Axis generated for us. Running this client will invoke the webservice deployed on the server.
5) Ant build file
Here's the complete build.xml that i used as part of this example:
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyApp" basedir=".." default="compile">
<property name="conf.dir" location="${basedir}/conf" />
<property name="build.dir" location="${basedir}/build"/>
<property name="classes.dir" location="${build.dir}/classes" />
<property name="compile.src" location="${basedir}/src" />
<property name="lib" location="${basedir}/lib" />
<property name="wsdl.dir" location="${build.dir}/wsdl" />
<property name="wsdd.dir" location="${build.dir}/wsdd" />
<!-- Sets classpath for build -->
<path id="classpath">
<pathelement path="${java.class.path}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
<pathelement path="${classes.dir}" />
</path>
<taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" >
<classpath refid="classpath"/>
</taskdef>
<taskdef name="axis-wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" >
<classpath refid="classpath"/>
</taskdef>
<target name="clean-all" description="Cleans(Deletes) the contents of all output directories">
<delete dir="${classes.dir}"/>
<delete dir="${wsdl.dir}"/>
<delete dir="${wsdd.dir}"/>
</target>
<target name="build-all" description="Builds the entire project" depends="clean-all,compile,generateWSDL,generateWSDD,compileStubs,compile-client">
</target>
<target name="compile" description="Compiles java source code">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${compile.src}" excludes="org/myapp/service/client/**/*.java"/>
</target>
<target name="compile-client" description="Compiles the webservice client" depends="compile">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${compile.src}" includes="org/myapp/service/client/**/*.java"/>
</target>
<target name="generateWSDL" description="Generates wsdl files from the java service interfaces">
<mkdir dir="${wsdl.dir}"/>
<axis-java2wsdl classpathref="classpath"
output="${wsdl.dir}/HelloWorld.wsdl"
location="http://localhost:8080/axis/services/HelloWorld"
namespace="http://jaikiran.com"
classname="org.myapp.service.HelloWorldService">
<mapping namespace="http://jaikiran.com" package="org.myapp.service"/>
</axis-java2wsdl>
</target>
<target name="generateWSDD" description="Generates wsdd files from the wsdl files">
<mkdir dir="${wsdd.dir}"/>
<axis-wsdl2java
output="${wsdd.dir}"
deployscope="Application"
serverside="true"
url="${wsdl.dir}\HelloWorld.wsdl">
</axis-wsdl2java>
</target>
<target name="compileStubs" description="Compiles the java classes(stubs) generated by Axis using the wsdl2java task">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" classpathref="classpath" fork="true" srcdir="${wsdd.dir}"/>
</target>
<target name="deployWebservice" description="Deploys the webservice onto the server, using the wsdd file and Axis' AdminClient">
<java classname="org.apache.axis.client.AdminClient" classpathref="classpath" fork="true">
<arg value="${wsdd.dir}/com/jaikiran/deploy.wsdd"/>
</java>
</target>
<target name="undeployWebservice" description="Undeploys webservice using the wsdd file and the Axis' AdminClient">
<java classname="org.apache.axis.client.AdminClient" classpathref="classpath" fork="true">
<arg value="${wsdd.dir}/com/jaikiran/undeploy.wsdd"/>
</java>
</target>
<target name="runWebserviceClient" description="Executes the java client which access the webservice">
<java classname="org.myapp.service.client.ServiceClient" classpathref="classpath" fork="true"/>
</target>
</project>
6) The project directory structure
This is how my project's directory structure looks like (just in case you want to create a similar one):
Sample Webservice
|
|
|------------- src
| |
| |---- org
| |--- myapp
| |---- service
| |------- HelloWorldService.java
| |
| |------- HelloWorldServiceImpl.java
| |
| |----- client
| |-------- ServiceClient.java
|
|
|------------- build
| |----- build.xml
|
|
|------------- lib
|
|----- activation.jar
|----- axis.jar
|----- axis-ant.jar
|----- commons-discovery-0.2.jar
|----- commons-logging-1.0.4.jar
|----- jaxrpc.jar
|----- mailapi_1_3_1.jar
|----- saaj.jar
|----- wsdl4j-1.5.1.jar
89 comments:
Great article !
I like the way you explain things.
I tried to do all steps.
Works for me only until deployment: after deployment, axis says "Could not find class for the service named: com.jaikiran.HelloWorldSoapBindingImpl". Looks like the stub created as .java in our files is not "seen" within the JBoss...
sorry, was my fault, now it works
Sorry about the delayed reply.
Nice to know, you liked the article :)
As for the error i think you missed the step 3c in the article where i manually change the deploy.wsdd to remove the reference to com.jaikiran.HelloWorldSoapBindingImpl.
Going by your second reply, i believe you got it working :)
Nice description, I could create my first webservice after following your sample. Thanks.
Question: My axis application is running in the location "C:\Project\Software\jboss-4.0.4.GA\server\default\deploy\axis.war\WEB-INF", how this deployWebservice(in the build.xml) come to know of this path as it updates the file "server-config.wsdd" in this location only??
Just minor notes:
1) For some reason if I used url="file:${wsdl.dir}\HelloWorld.wsdl", it gave me url exceptions, I changed to url="file:${wsdl.dir}\HelloWorld.wsdl" and it worked
2) Change "mapping namespace="http://jaikiran.com" package="org.myapp.service" in the build.xml to
to mapping namespace="http://jaikiran.com" package="com.jaikiran"
Wonderful discription. This is my first experience with ant or jboss and found this to be very useful. Thanks for the great work.
Kiran
Wow, two days to finally get your great article. That stuff is not documented anywhere else.
Thanks so much
Its very nice article and i followed the steps given by you.
I am able to deploy the file, but while accessing the service through the client its returning null.
(Client received:null)
appreciate you for nice article and i followed the steps given by you.
I am able to deploy the file, but while accessing the service through the client its returning null.
(Client received:null)
raj,
I guess, you missed out the step which i mentioned in 3c. Here's the appropriate part:
You might notice that during all these steps we never mentioned our implementing class (HelloWorldServiceImpl) in any of the targets. As you can see above in the deploy.wsdd, Axis has created its own implementing class for the HelloWorldService and provided default implementations in that class. In the deploy.wsdd file, it mentioned the implementation class as follows:
<parameter name="className" value="com.jaikiran.HelloWorldSoapBindingImpl"/>
The reason why Axis created this implementing class is that it never knew that we had created our own implementation. The input that we provided to Axis for generating the wsdd files was a wsdl file through which Axis could never have known that we already have a implementation class.
Our next step would be to modify the deploy.wsdd file to mention our implementation class, in place of Axis'. So let's change the 'className' parameter to:
<parameter name="className" value="org.myapp.service.HelloWorldServiceImpl"/>
jerry/anonymous,
Good to know, you both found this blog useful :)
-Jaikiran
Great article, but I cant get to work unfortunatly...
it compiles in all stages, except for when I try to deploy and I get:
[java] Exception: AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
[java] faultSubcode:
[java] faultString: java.net.ConnectException: Connection refused: connect
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
[java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
[java] at java.net.Socket.connect(Socket.java:519)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
[java] at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
[java] at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
[java] at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
[java] at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
[java] at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
[java] at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
[java] at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
[java] at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
[java] at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
[java] at org.apache.axis.client.Call.invoke(Call.java:2767)
[java] at org.apache.axis.client.Call.invoke(Call.java:1792)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:439)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:404)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:410)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:320)
[java] at org.apache.axis.client.AdminClient.main(AdminClient.java:463)
[java]
[java] {http://xml.apache.org/axis/}hostname:winxpje
[java]
[java] Java Result: 1
I run my local JBoss (4.0.5.GA) on port 810.
Many thanks,
Johan
alright, I solved it... it was port 810... when I changed it back to 8080 its worked!
thanks again for the article!
I'm new to JBOSS and AXIS. This article is a great help in gaining a better understanding of how web services are developed and implemented but...
I followed the above and am running in to the same problem as the comment above when attempting to deploy the WS.
Buildfile: C:\j2ee\HelloWorldWS\build\build.xml
deployWebservice:
[java] Processing file C:\j2ee\HelloWorldWS\build\wsdd/com/pwp/deploy.wsdd
[java] Exception: AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
[java] faultSubcode:
[java] faultString: java.net.ConnectException: Connection refused: connect
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect
I changed my JBOSS web server's port from 8080 to 80 after I installed it and it passed verification.
What I am missing or doing wrong?
Any help would be appreciated.
Ok, I changed my JBOSS's connector port back to 8080 and was able to get it to deploy.
I want to use port 80. How do I specify using port 80 within the ant build.xml deployWebservice target?
Thanks again. I have a lot to learn and this article got me going in the right direction.
pwp
Hi Jaikiran, good artical.
I was facing one problem with your example.
I did all the steps what you told in your blog.
I copied all the files into the JBoss-server . Still it is showing error as
"runWebserviceClient:
[java] AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
[java] faultSubcode:
[java] faultString: org.apache.axis.ConfigurationException: Could not find class for the service named: org.myapp.service.HelloWorldServiceImpl
[java] Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
[java] java.lang.ClassNotFoundException: org.myapp.service.HelloWorldServiceImpl
[java] AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
[java] faultSubcode:
[java] faultString: Could not find class for the service named: org.myapp.service.HelloWorldServiceImpl
[java] Hint: you may need to copy your class files/tree into the right location (which depends on the servlet system you are using).; nested exception is:
[java] java.lang.ClassNotFoundException: org.myapp.service.HelloWorldServiceImpl
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}hostname:
Hi viswanadh,
Did you copy the whole compiled "org" directory to the
"\server\default\deploy\axis.war\WEB-INF\classes"
directory?
Anonymous asked:
I want to use port 80. How do I specify using port 80 within the ant build.xml deployWebservice target?
In step 3b, you create the wsdl file, through the "generateWSDL" target. There's a parameter named "location" which is used in this target. I have specified the value, in this example, as http://localhost:8080/axis/services/HelloWorld. So if you want the webservice to be available on port 80, then change the value of this parameter to http://localhost:80/axis/services/HelloWorld . This "location" parameter is used for specifying the URL where your webservice will be available after deployment.
To use default port number for deployment of wsdd file, use the following parameter in the ant command
arg value="-pxxxx"/
example= arg value="-p9090"/
hi,great article for new users .,can you please let me know how to migrate THIS sergvice to web logic8.1., setp by step., that would be of great help....
also can you give me a similar example in weblogic8.1
and migration from web logic to jboss4.2
thank you
Hi,
if you can publish the rersponse to my request or post that will be very helpful.
waiting for response.
thank you
harpreet,
I'm sorry, i haven't had a chance to look at the replies lately.
harpreet asked
can you please let me know how to migrate THIS sergvice to web logic8.1., setp by step.
I'm sorry, i have never used WebLogic and as such wont be able to list down the steps to get this working on WebLogic server.
This is a really good article having all the details i was looking for (JBoss+AXIS) almost a day. Thanks for the effort ...
Hii kiran,
I followed your wiki, but iam getting error when i deploy webservice. this is the error i am getting....even i changed the port number to 7500 from 8080, i even made this change in wsdl file.
any help would be appreciated,
thanks in advance
Shruthi
deployWebservice:
[java] Processing file C:\Users\Shruthi\Desktop\Sample Webservice\build\wsdd/
com/jaikiran/deploy.wsdd
[java] Exception: AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userEx
ception
[java] faultSubcode:
[java] faultString: java.net.ConnectException: Connection refused: connect
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:java.net.ConnectExceptio
n: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.jav
a:195)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
[java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
[java] at java.net.Socket.connect(Socket.java:520)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.apache.axis.components.net.DefaultSocketFactory.create(De
faultSocketFactory.java:153)
[java] at org.apache.axis.components.net.DefaultSocketFactory.create(De
faultSocketFactory.java:120)
[java] at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSende
r.java:191)
[java] at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPS
ender.java:404)
[java] at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.j
ava:138)
[java] at org.apache.axis.strategies.InvocationStrategy.visit(Invocatio
nStrategy.java:32)
[java] at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
[java] at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
[java] at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
[java] at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
[java] at org.apache.axis.client.Call.invoke(Call.java:2767)
[java] at org.apache.axis.client.Call.invoke(Call.java:1792)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
39)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
04)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
10)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:3
20)
[java] at org.apache.axis.client.AdminClient.main(AdminClient.java:463)
[java]
[java] {http://xml.apache.org/axis/}hostname:HOME-PC
[java]
[java] Java Result: 1
Hii kiran,
I followed your wiki, but iam getting error when i deploy webservice. this is the error i am getting....
any help would be appreciated, thanks in advance
Shruthi
deployWebservice:
[java] Processing file C:\Users\Jenny\Desktop\Sample Webservice\build\wsdd/
com/jaikiran/deploy.wsdd
[java] Exception: AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userEx
ception
[java] faultSubcode:
[java] faultString: java.net.ConnectException: Connection refused: connect
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:java.net.ConnectExceptio
n: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
[java] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.jav
a:195)
[java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
[java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
[java] at java.net.Socket.connect(Socket.java:520)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at org.apache.axis.components.net.DefaultSocketFactory.create(De
faultSocketFactory.java:153)
[java] at org.apache.axis.components.net.DefaultSocketFactory.create(De
faultSocketFactory.java:120)
[java] at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSende
r.java:191)
[java] at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPS
ender.java:404)
[java] at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.j
ava:138)
[java] at org.apache.axis.strategies.InvocationStrategy.visit(Invocatio
nStrategy.java:32)
[java] at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
[java] at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
[java] at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
[java] at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
[java] at org.apache.axis.client.Call.invoke(Call.java:2767)
[java] at org.apache.axis.client.Call.invoke(Call.java:1792)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
39)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
04)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
10)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:3
20)
[java] at org.apache.axis.client.AdminClient.main(AdminClient.java:463)
[java]
[java] {http://xml.apache.org/axis/}hostname:HOME-PC
[java]
[java] Java Result: 1
Shruthi said
this is the error i am getting....even i changed the port number to 7500 from 8080
Shruthi, where did you change these port numbers? Is your JBoss running when you are deploying the web service. A "Connection refused" usually means that the port to which you are trying to connect is not listening. Which version of JBoss do you use?
Finally from the command prompt, when deploying the service what does
telnet localhost 8080
or
telnet localhost 7500
output?
Hi Jaikiran,
This was a great article. I am a newbie to JBOSS and have started to develop a web service using JBOSS. Could you please explain what are all changes to be done in the same when we send a XML data to our web service?
Also could you please explain how do we send an XML to a web service?
Hi,
It's really a gr8 article for the begnier's of webservices and proved very helpful.I too Njoyed.
I have basic question actually i have deployed the the webservice application and i chked it through browser ,it's working fine and showing in the deployed webservice list.
Then the i run the "ServiceClient.java" program
from eclipse editor it runs without showing any output. output comes null.
My confustion is how it will call the classes deployed in jboss ,for that do i need to add all those classes in classpath ? please tell me.
Thanks in advance
Amit
Hi Jaikiran,
Pretty useful article. I have a question however. In my case, I have some third party jars that I have imported in the webservice code. How do I tell the axis class loader, where to load those jars from? I tried putting this info in the classpath, but I'm getting a NoClassDefFoundError. As soon as I remove the import statement, the webservice class loads fine.
Thanks,
Ron
Anonymous asked
I have some third party jars that I have imported in the webservice code. How do I tell the axis class loader, where to load those jars from?
Ron,
You will have to place those jar files in ...deploy\axis.war\WEB-INF\lib folder in the server, so that it becomes available in the classpath.
Hello kiran,
I would like to thank you for this post! It was really helpful for me! I succeed all the steps as you specify!
Nevertheless I have a question about JBoss!
When I type this address:
http://localhost:8080/axis/
Jboss displays the corresponding page :-)
or if I type
http://127.0.0.1:8080/axis/
It works well! That is to say the IP address "localhost" or 127.0.0.1 works fine.
But if I replace the address by the DHCP IP address alocated by the server it doesn't work anymore. By that, I mean that nothing is displayed by Jboss when I type this.
http://157.125.0.1:8080/axis/
Do you have an idea?
Thank you for your feedback
Jose
PS (fyi): With Tomcat standalone (Jboss is stopped) all IP addresses work well (157.125.0.1, localhost or 127.0.0.1). The problem above happends when I start Jboss (Tomcat is shutdown).
Jose,
Good to know, you liked this article. As for your question, it looks like you are using JBoss-4.2.x. Starting this version of JBoss, you need to pass the -b parameter while starting JBoss to bind the services to specific/all addresses. Please see this http://wiki.jboss.org/wiki/JBoss42FAQ for more details.
Thank you for your reply Jaikiran!
This afternoon I found this solution!
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=134857
Hope this helps someone else!
Regards,
Jose
Hi JaiKiran,
Excellent description, I could create my first webservice after following your sample. Thanks.
Here i have one query.,
Can you suggest, how to change the classname ,(in step 3c) otherthan manually?
hi jaikiran,
great article.
i use jboss server and try to use java2WSDL command but i get error like that :
java.lang.ClassNotFoundException: mypackage.myclass
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:187)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
at org.apache.axis.wsdl.fromJava.Emitter.setCls(Emitter.java:2079)
at org.apache.axis.wsdl.Java2WSDL.run(Java2WSDL.java:584)
at org.apache.axis.wsdl.Java2WSDL.main(Java2WSDL.java:682) but i have myclass.class in the mypackage.
hi,
its a great artical,my problem is different, i am new to software field, learned java(basic) moving to adv.java,
want to create a simple web appli. jsp/html to store name and sity just two fileds in database .and display the same in html/jsp.
i know i can give dbconnection (jdbc0 in jsp and sql in the jsp as well.
but it will be visible in view source code, how to hihde that and if we use servltes, i am not understanding how the jsp or html will yalk to servlet. how they are linked .
please give me simple example as you gave the article.what are the folders i have to create and how toi create a jar file ., i dont know how this meta-inf, web-inf are created . let me know the steps pleae.
thanks you in advance.
i searched a lot in google but no clear explannation id their like yours
Reply to Anonymous' post:
i use jboss server and try to use java2WSDL command but i get error like that :
java.lang.ClassNotFoundException: mypackage.myclass
Are you sure your class is present in the classpath of the java2wsdl target? Look at the target that i mentioned in my blog, it contains a classpathref.
Reply to Prakash's question:
Can you suggest, how to change the classname ,(in step 3c) otherthan manually?
Prakash,
I haven't tried this on this example, but there's an Ant task named "replace" which can do this for you. You can create a separate target in your build.xml which automates this process. See the documentation at http://ant.apache.org/manual/CoreTasks/replace.html
Reply to chemicalxxx:
Glad to know you liked this article.
As for your question on how to write a simple servlet/jsp application, i don't have a sample application which i can post here.
You can find me hanging around at JavaRanch (www.javaranch.com) forums. At JavaRanch, we do have a "Code Barn" (http://faq.javaranch.com/java/CodeBarn) where we have sample applications with explanation to get you started with various technologies. Have a look at that code barn URL and see under the Servlets and JSP section. You will find some very good examples. And if you have any questions about the examples or anything else you can join the JavaRanch forum and post your question there. The people there are very friendly and will be more than helpful to help you in getting started :)
Good luck !
Hi jaikiran
you are my hero!!
i was doing my nuts over the web service cleint returning null. Then i saw your reply about specifying our own implementing class in deploy.wsdd. Thanks a lot :)
Hi Jaikiran,
It was an excellent article. I was able to run a sample Hello World web service but i get an TargetInvocationException when i try to access a database to fetch some values. I am using jboss-eclipse-mysql. Basically i am able to connect to the database but when i invoke a method i get the exception. Can you please help
I solved the problem.
The TargetInvocationException was due to an exception in the implementation method. Once i fixed it, it worked properly
Hi Kiran,
Thanks for the wonderful article. This is my first attempt to create a webservice and i found your article extremely helpful. But, I have an issue. I just followed your steps and deployed the service and am able to see that in axis but, my client class does not compile. it is not able to recognize com.jaikiran.HelloWorldService and com.jaikiran.HelloWorldServiceServiceLocator
classes. I understand that i may need to run your second build file before I run my client. But unfortunately, even the build file fails. This is the error i get while running the build.
Buildfile: C:\javadev\HelloWebService\build\buildClient.xml
compile:
[javac] Compiling 2 source files to C:\javadev\HelloWebService\build\classes
[javac] C:\javadev\HelloWebService\src\org\myapp\service\HelloWorldServiceImpl.java:2: package javax.jws does not exist
[javac] import javax.jws.WebService;
[javac] ^
[javac] C:\javadev\HelloWebService\src\org\myapp\service\HelloWorldServiceImpl.java:4: cannot find symbol
[javac] symbol: class WebService
[javac] @WebService
[javac] ^
[javac] 2 errors
BUILD FAILED
C:\javadev\HelloWebService\build\buildClient.xml:43: Compile failed; see the compiler error output for details.
Plz help me..thanks
Siri
Your article really helpful.
Am getting Exception when I tried to add a new method in the HelloWorldService class.
Exception - org.apache.axis.InternalException: java.lang.Exception: Couldn't find a matching Java operation for WSDD operation "sayHello" (0 args).
I did check with both WSDD and WSDL file the method is included there and i have replced the modified class. but still am getting this exception.
Any Idea?
Thanks in Advance.
Excellent article. I have been working in webservices using axis and weblogic for a couple of years, but still found the article to be quite useful. Thanks for the great work.
Allen
Hi JaiKiran,
This article is good. But I am looking for more information. I have my web application under the jboss/default/b2c/deploy folder. It is not in the jboss/default/deploy folder. Everything worked fine when i had the axis.war copied under the default deploy folder.
Now after having generated the WSDL, if i need to deply this service, in JBOSS, can you tell me the steps. I am using AXIS. Any help greatly appreciated!!!
i have this when i try to undeploy a webservice using a wsdd file
Processing file undeploy.wsdd
Exception: AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection refused
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:464)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:1792)
at org.apache.axis.client.AdminClient.process(AdminClient.java:439)
at org.apache.axis.client.AdminClient.process(AdminClient.java:404)
at org.apache.axis.client.AdminClient.process(AdminClient.java:410)
at org.apache.axis.client.AdminClient.process(AdminClient.java:320)
at org.apache.axis.client.AdminClient.main(AdminClient.java:463)
{http://xml.apache.org/axis/}hostname:myhost
Please help me
Allen said
Excellent article. I have been working in webservices ...
Thanks Allen!
Sarika pRamod asked
I am looking for more information. I have my web application under the jboss/default/b2c/deploy folder.
Now after having generated the WSDL, if i need to deply this service, in JBOSS, can you tell me the steps.
Sarika,
The steps will remain the same. The only thing that might change is the port number that you use for your wsdl. That port number should now correspond to the HTTP port of your "b2c" server.
Alberto said
i have this when i try to undeploy a webservice using a wsdd file
Processing file undeploy.wsdd
Exception: AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection refused
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused
Alberto,
How do you undeploy the service? Do you use the Ant target that i have in this example?
When undeploying, do you have the server running?
This is a good tutorial.
I have this problem:
Build fails, and it fails here:
taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask"
it does not get library, i have added but in vain.
I am using Eclipse. any idea ?
I left the tags, other wise i could not comment.
thanks
Great article!!
To deploy this, with Eclipse IDE do the following.
Make sure you setup your JAVA_HOME variable and add %JAVA_HOME%\bin to your path variable.
Add the following line to your bulid file after the project tag.
property environment="env"
(add opening and end tags to the above statement. I dont know why it is not allowing me to include it)
It should work without any probs.
hey how the target files are executed,I tried a lot but I am not able to do it...And what about .wsdl,.wsdd and stubs where can I find it and how....Can u explain the process of locating these files and in addition to this I am not able to locate the the com.jaikiran.HelloServiceLocator can u elaborate on it..Please
Thank you......
HEy buddy everything is working fine till wsdd file.Now while deploying webservice I am getting this error message.Please guide me to its rectification.Thank you...
deployWebservice:
[java] Processing file C:\Sample Webservice\build\wsdd/com/jaikiran/deploy.
wsdd
[java] Exception: AxisFault
[java] faultCode: {http://xml.apache.org/axis/}HTTP
[java] faultSubcode:
[java] faultString: (401)Unauthorized
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {}:return code: 401
[java] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
[java] <HTML><HEAD>
[java] <TITLE>401 Unauthorized</TITLE>
[java] </HEAD><BODY><H1>Unauthorized</H1>
[java] </BODY></HTML>
[java]
[java] {http://xml.apache.org/axis/}HttpErrorCode:401
[java]
[java] Java Result: 1
Hey JaiKiran Thanx man!!
Now everything is done.I am getting response on other computers over LAN too.Thanx to you.
Now only question left to be answered is "How will I get xsd file of the request and response"
Hu kiran,
It's a very good article. Where to copy wsdd and wsdl folders in jboss server? I am using jboss-4.0.5.GA.
Thanks,Sudha
Hi,
I am getting stuck in the first stage. I am unable to view the welcome page on accessing the URL "http:/localhost:8080/axis".
The error shown up is
17:41:45,203 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
MBeans waiting for other MBeans:
ObjectName: jboss.jbpm:name=DefaultJbpm,service=JbpmService
state: CONFIGURED
I Depend On: jboss.jca:service=DataSourceBinding,name=JbpmDS
Depends On Me:
MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
ObjectName: jboss.jca:service=DataSourceBinding,name=JbpmDS
state: NOTYETINSTALLED
I Depend On:
Depends On Me: jboss.jbpm:name=DefaultJbpm,service=JbpmService
17:41:45,375 ERROR [Server] Root deployment has missing dependencies; continuing
Incomplete Deployment listing:
MBeans waiting for other MBeans:
ObjectName: jboss.jbpm:name=DefaultJbpm,service=JbpmService
state: CONFIGURED
I Depend On: jboss.jca:service=DataSourceBinding,name=JbpmDS
Depends On Me:
MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
ObjectName: jboss.jca:service=DataSourceBinding,name=JbpmDS
state: NOTYETINSTALLED
I Depend On:
Depends On Me: jboss.jbpm:name=DefaultJbpm,service=JbpmService
at org.jboss.deployment.MainDeployer.checkIncompleteDeployments(MainDepl
oyer.java:1155)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:607)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:588)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.
java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:198)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:407)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:311)
at org.jboss.Main.boot(Main.java:191)
at org.jboss.Main$1.run(Main.java:480)
at java.lang.Thread.run(Thread.java:595)
17:41:45,453 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808
0
17:41:45,656 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8009
17:41:45,671 INFO [JkMain] Jk running ID=0 time=0/31 config=null
17:41:45,671 INFO [Server] JBoss (MX MicroKernel) [3.2.7 (build: CVSTag=JBoss_3
_2_7 date=200501280217)] Started in 14s:110ms.
Could you please tell me the reason for this? I am new to axis.
Thanks,
Divya
hi,
i also think that this article is very good, but i must mension about two things, which could help solve above problem...
first
every method in inteface must start from small letter
second
delete from deploy.wsdd file tags operation
Hello
First of all thanks for the GREAT article.
I'm having a problem with my classpath. when i try to create the wsdl file (step 3b) the result is:
ant generateWSDL
Buildfile: build.xml
generateWSDL:
[axis-java2wsdl] Java2WSDL org.myapp.service.HelloWorldService
[axis-java2wsdl] java.lang.ClassNotFoundException: org.myapp.service.HelloWorldService
[axis-java2wsdl] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[axis-java2wsdl] at java.security.AccessController.doPrivileged(Native Method)
[axis-java2wsdl] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[axis-java2wsdl] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[axis-java2wsdl] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[axis-java2wsdl] at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1414)
[axis-java2wsdl] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1085)
[axis-java2wsdl] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[axis-java2wsdl] at org.apache.axis.utils.ClassUtils$2.run(ClassUtils.java:187)
[axis-java2wsdl] at java.security.AccessController.doPrivileged(Native Method)
[axis-java2wsdl] at org.apache.axis.utils.ClassUtils.loadClass(ClassUtils.java:160)
[axis-java2wsdl] at org.apache.axis.utils.ClassUtils.forName(ClassUtils.java:100)
[axis-java2wsdl] at org.apache.axis.wsdl.fromJava.Emitter.setCls(Emitter.java:2079)
[axis-java2wsdl] at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:188)
[axis-java2wsdl] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[axis-java2wsdl] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[axis-java2wsdl] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[axis-java2wsdl] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[axis-java2wsdl] at java.lang.reflect.Method.invoke(Method.java:597)
[axis-java2wsdl] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[axis-java2wsdl] at org.apache.tools.ant.Task.perform(Task.java:348)
[axis-java2wsdl] at org.apache.tools.ant.Target.execute(Target.java:357)
[axis-java2wsdl] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[axis-java2wsdl] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[axis-java2wsdl] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[axis-java2wsdl] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[axis-java2wsdl] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[axis-java2wsdl] at org.apache.tools.ant.Main.runBuild(Main.java:698)
[axis-java2wsdl] at org.apache.tools.ant.Main.startAnt(Main.java:199)
[axis-java2wsdl] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[axis-java2wsdl] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
BUILD FAILED
/home/di/workspace/axis_helloworld/build/build.xml:58: Error while running org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask
I copied all the libraries to /usr/share/ant/lib (ant's home) and to java_home.
Please tell me what i'm doing wrong!
Thanks!
Diana
Diana said:
ant generateWSDL
Buildfile: build.xml
generateWSDL:
[axis-java2wsdl] Java2WSDL org.myapp.service.HelloWorldService
[axis-java2wsdl] java.lang.ClassNotFoundException: org.myapp.service.HelloWorldService
Diana,
Before running the generateWSDL target, the interfaces and the classes should be compiled and made available in the classpath. Are you sure you have done that?
Hello Jaikiran,
first of all, thanks for this article, worked fine for me.
However, I'm having slight difficulties in putting this all together properly, I would like to have one file which I drop somewhere and which will then install the webservice into axis. Like you drop a war file into the deploy folder and it'll deploy the web application for you :-) Is there something like this for a web-service? Or is there a nice guide?
Dennis
Very nice article!
i'm facing a problem when deploy wsdd file to the server as below. Pls let me know what i'm wrong. thank you
[java] Processing file C:\Documents and Settings\Admin\Desktop\Web Directory\Tutorial\Sample Webservice\build\wsdd/com/jaikiran/deploy.wsdd
[java] Exception: AxisFault
[java] faultCode: {http://xml.apache.org/axis/}HTTP
[java] faultSubcode:
[java] faultString: (401)Unauthorized
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {}:return code: 401
[java] <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
[java] <HTML><HEAD>
[java] <TITLE>401 Unauthorized</TITLE>
[java] </HEAD><BODY><H1>Unauthorized</H1>
[java] </BODY></HTML>
[java] {http://xml.apache.org/axis/}HttpErrorCode:401
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 2 seconds
Hi All,
i created a webservice in tomcat 5.5 using axis 2.0 webserver it working fine.now my requirement is to transfer the developed webservice from my system to production system which has JBoss server.so could any one guide me how to transfer webservices.
Many Thanks in Advance
Generate WSDL is fine. But I get following error while GenerateWSDD.
BUILD FAILED
C:\Documents and Settings\Anup\workspace\Java Web Service\build\build.xml:69: WSDL processing error for C:\Documents and Settings\Anup\workspace\Java Web Service\build\wsdl\HelloWorld.wsdl :
unknown protocol: c
Anup.
I solved the problem. I created a new workspace. In D:\ drive instead of "C". And this time, gave no "white spaces" in between the workspace name. WSDD got generated.
Anup.
Now getting following error while deploying WSDD.
[java] org.apache.axis.ConfigurationException: No engine configuration file - aborting!
I solved this problem too.
server-config.xml file was missing in the C:\JBoss4\server\default\deploy\axis.war\WEB-INF for no known reason. Service got deployed. And example worked. Thanks Jaikiran. Nice blog.
Hi Jaikiran, thanks for this wonderful article. I am a newbie in java and this article really helped.
My EAR application is moving from weblogic to JBoss. I just want to know what all files are required to be deployed on JBoss. thanks.
I have 2 questions:
1. What changes do I need to make if I need to deploy this WAR file to Weblogic 8.1?
2. What actually happens when webservice is deployed? For eg, what files get copied to which locations?
Hi JaiKiran, thanks for posting this great article. It really helped me.
Regards
Srihari
Hi JaiKiran,
Thanks for this fine article..
can you please suggest me any pdf's that will explain web services architecture completely
Thanks,
Kishore Reddy
Hi JaiKiran,
Thanks for excellent article, this is very clear and clean ,It works great.
Hi Jai,
Can you post areply to this problem
java] Exception: AxisFault
[java] faultCode: {http://xml.apache.org/axis/}HTTP
[java] faultSubcode:
[java] faultString: (401)Unauthorized
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {}:return code: 401
thanks
sri
Hi, great article, explained neatly. Unfortunately I could not deploy with the following exception. I followed all steps exactly. Din't change anything, except the port number to 50000. I have other web applications running on the same server instance they work just fine. Axis page also opens up on port 50000. But, my webservice does not get deployed. Can you please throw some light...Thanks a ton.
[java] Exception: AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
[java] faultSubcode:
[java] faultString: java.net.ConnectException: Connection refused: connect
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection refused: connect
[java] at java.net.PlainSocketImpl.socketConnect(Native Method)
[java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
[java] at
Hello Jai,
Thanks for the great article!
I was trying to modify the Service class to take a Custom Java Pojo as a parameter to its method, the ant tasks executes fine, it creates correct Class binding as well and even my POJO gets compiled and is present in the jaikiran folder and I copied it to axis/classes.
So far so good but the moment I try to deploy this webservice I get the Exception:
[WSDDDeployableItem] Unable to deploy typemapping:{http://jaikiran}PreLoadEnrollmentRequestVO
java.lang.ClassNotFoundException: jaikiran.PreLoadEnrollmentRequestVO
I have compiled the class myself, created a jar and copied to axis/Web-inf/lib but of No help
It seems the Service method doesn't supports any CustomClass as a parameter to me.
I have no idea as to how I am unable to pass through this basic step could you please help?
Thanks in advance.
Nice post -got things working fairly quickly. I would add this change to the build file:
for
task as well. Otherwise the package names get messed up.
Hi JaiKiran,
Nice article but still need ur help yaar.
I followed the steps which you said. still i am getting this messages
Buildfile: /RDOSS WorkSpace/SampleWebservice/build/build.xml
clean-all:
[delete] Deleting directory /RDOSS WorkSpace/SampleWebservice/build/classes
[delete] Deleting directory /RDOSS WorkSpace/SampleWebservice/build/wsdl
[delete] Deleting directory /RDOSS WorkSpace/SampleWebservice/build/wsdd
compile:
[mkdir] Created dir: /RDOSS WorkSpace/SampleWebservice/build/classes
[javac] Compiling 2 source files to /RDOSS WorkSpace/SampleWebservice/build/classes
generateWSDL:
[mkdir] Created dir: /RDOSS WorkSpace/SampleWebservice/build/wsdl
[axis-java2wsdl] Apr 25, 2010 11:17:19 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
[axis-java2wsdl] WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[axis-java2wsdl] Java2WSDL org.myapp.service.HelloWorldService
generateWSDD:
[mkdir] Created dir: /RDOSS WorkSpace/SampleWebservice/build/wsdd
[axis-wsdl2java] Apr 25, 2010 11:17:19 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
[axis-wsdl2java] WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
[axis-wsdl2java] WSDL2Java /RDOSS WorkSpace/SampleWebservice/build/wsdl/HelloWorld.wsdl
compileStubs:
[javac] Compiling 5 source files to /RDOSS WorkSpace/SampleWebservice/build/classes
[javac] Note: /RDOSS WorkSpace/SampleWebservice/build/wsdd/com/jaikiran/HelloWorldServiceServiceLocator.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
compile-client:
build-all:
BUILD SUCCESSFUL
Total time: 3 seconds
can you please let me know what is the issue . And i am not able to get mailapi_1_3_1.jar
I am getting an error while compiling the stubs:
Buildfile: C:\Propworks7.1.1\AppWs\build\build.xml
compileStubs:
[javac] Compiling 2 source files to C:\Propworks7.1.1\AppWs\build\classes
[javac] C:\Propworks7.1.1\AppWs\build\wsdd\com\jaikiran\HelloWorldServiceServiceLocator.java:10: com.jaikiran.HelloWorldServiceServiceLocator is not abstract and does not override abstract method getServiceName() in javax.xml.rpc.Service
[javac] public class HelloWorldServiceServiceLocator extends org.apache.axis.client.Service implements com.jaikiran.HelloWorldServiceService {
[javac] ^
[javac] C:\Propworks7.1.1\AppWs\build\wsdd\com\jaikiran\HelloWorldServiceServiceLocator.java:107: getServiceName() in com.jaikiran.HelloWorldServiceServiceLocator cannot implement getServiceName() in javax.xml.rpc.Service; attempting to use incompatible return type
[javac] found : javax.xml.namespace.QName
[javac] required: javax.xml.rpc.namespace.QName
[javac] public javax.xml.namespace.QName getServiceName() {
[javac] ^
[javac] Note: C:\Propworks7.1.1\AppWs\build\wsdd\com\jaikiran\HelloWorldServiceServiceLocator.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
Hello all, those who ran the example successfully. I'm having trouble in running the build.xml mentioned in the blog. I get "taskdef class org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask cannot be found" error in build.xml. I have axis-ant.jar and other required jars in classpath. Any advice.
Hello, I use JBoss 4.2.2 and I'd like to deploy axis 1.4. I followed your instructions, but it didn't worked at all. When I started up JBoss an error occurred. Something like "could not find config file". But I can't figure out what or where this file is. Could someone help me? Thank you
@ziaD you must have forgotten to delete common-logging and log4j jar files.
Hi Your example and Explanation are excellent. But I am unable to create an Ant Target file. Could you please help me
Thank you very much . This post helped me a lot .
Hi... i am new to web services and this post was very helpful..
I am using the same example but my jboss is running on the port 8084 instead of 8080. so i have changed the
location="http://localhost:8084/axis/services/HelloWorld"
for the target name="generateWSDL" in the build.xml.
i am able to see the axis welcome page using the url
http://localhost:8084/axis
Now, i got an error while deploying the web service.
deployWebservice:
[java] - Unable to find required classes (javax.activation.DataHandler and
javax.mail.internet.MimeMultipart). Attachment support is disabled.
[java] Processing file E:\SampleWebService\build\wsdd/com/vishal/deploy.wsd
d
[java] Exception: AxisFault
[java] faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userEx
ception
[java] faultSubcode:
[java] faultString: java.net.SocketException: Connection reset
[java] faultActor:
[java] faultNode:
[java] faultDetail:
[java] {http://xml.apache.org/axis/}stackTrace:java.net.SocketException
: Connection reset
[java] at java.net.SocketInputStream.read(SocketInputStream.java:168)
[java] at java.io.BufferedInputStream.fill(BufferedInputStream.java:218
)
[java] at java.io.BufferedInputStream.read(BufferedInputStream.java:237
)
[java] at org.apache.axis.transport.http.HTTPSender.readHeadersFromSock
et(HTTPSender.java:583)
[java] at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.j
ava:143)
[java] at org.apache.axis.strategies.InvocationStrategy.visit(Invocatio
nStrategy.java:32)
[java] at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
[java] at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
[java] at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
[java] at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
[java] at org.apache.axis.client.Call.invoke(Call.java:2767)
[java] at org.apache.axis.client.Call.invoke(Call.java:1792)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
39)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
04)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:4
10)
[java] at org.apache.axis.client.AdminClient.process(AdminClient.java:3
20)
[java] at org.apache.axis.client.AdminClient.main(AdminClient.java:463)
[java]
[java] {http://xml.apache.org/axis/}hostname:VishalA-PC
[java]
[java] Java Result: 1
i tried the both way, deployed webservice with/without jboss running but getting the same error.
can anyone help me with this problem. i badly need an answer because i have to use this in my project. Any help will be appreciated.
Thanks in advance,
Vishal
Hi,
Nice article and i am able to generate everything. But onething i was not sure is how it is getting deployed in Jboss server. For it is not getting deployed on JBOSS server.
I have custom version of JBOSS which is bundled with my application (EMC2 product has JBOSS bundled with it)..
We are using that jboss for hosting EMC2 products.
We have a requirement to deploy one pure J2ee webservice. That is where i followed your example and it is not getting deployed in JBOSS
Karthik, what trouble are you running into while deploying it? And what exact steps are you following?
Post a Comment