Hai Shanu,
Thanks for your reply.Please refer any weblink for deployment and execute the simple webservice with axis in jonas server without using any IDE. And tell what are steps to deploy the webservice with axis. And what are the jar files for develop the webservice.
Regards,
Saravanan.K
Hi,
I use jdk1.5.0_01.
I have some problem while running the webservices in tomcat5.5.9 with axis1.2 the below execption is raised.
E:\Java\Apache Software Foundation\Tomcat 5.5\webapps\axis\WEB-INF\classes\com\javasrc\webservices\age>java AgeServiceClient -lhttp://localhost:8080/axis/servic
es/AgeService "Steve" 33
Exception in thread "main" java.lang.UnsupportedClassVersionError: AgeServiceCli
ent (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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 java.lang.ClassLoader.loadClassInternal(Unknown Source)
Please help..
Thanks in advance.
Regards,
Saravanan.K
Hai,
While generating the webservice the below execption will occured
- Unable to find required classes (javax.activation.DataHandler and javax.mail.i
nternet.MimeMultipart). Attachment support is disabled.
Processing file deploy.wsdd
Exception: AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection refused: connect
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Conne
ction refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSoc
ketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSoc
ketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:1
91)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.ja
va:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.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:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:1784)
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:e2
Is there any solution please help .
Regards,
Saravanan.K
Hi,
I have run the web services in JOnAS server using RMI concept.
i want to run the web services in JOnAS server using AXIS.
Please help me
Thanx in advance...
I have run the web services in JOnAS server using the following steps.
I have create the web-application directery structure as follows..
interest
|
+-- WEB-INF
|
+-- web.xml
+-- webservices.xml
+-- InterestMapping.xml
|
+-- classes/
||
|+-- org.objectweb.interest.Interest.java
|+-- org.objectweb.interest.InterestImpl.java
|
+-- wsdl/
|
+-- Interest.wsdl
* First of all i written the following java interface.
Interest .java
-
package org.objectweb.interest;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Interest extends Remote {
double getCompoundInterest(double principal, double interest, int terms) throws RemoteException;
}
Then i have written implementation class as following....
InterestImpl.java
-
package org.objectweb.interest;
import java.rmi.RemoteException;
public class InterestImpl implements Interest {
public double getCompoundInterest(double principal, double interest,int terms)
throws RemoteException {
double total = principal;
for (int i = 0; i < terms; i++) {
total = total * (1 + interest / 100.0);
}
return total - principal;
}
}
Then compile the both...and then put into the classes/org.objectweb.interest folder and then generate the class file for both...
and then copy following xml file in the WEB-INF dir....
web.xml
-
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Interest WebServices packaged in WebApp Sample</display-name>
<servlet>
<display-name>Interest web service</display-name>
<servlet-name>InterestServlet</servlet-name>
<servlet-class>org.objectweb.interest.InterestImpl</servlet-class>
</servlet>
</web-app>
webservices.xml
<?xml version="1.0"?>
<webservices xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
version="1.1">
<display-name>Interest Sample</display-name>
<webservice-description>
<webservice-description-name>Interest Webservice</webservice-description-name>
<wsdl-file>WEB-INF/wsdl/Interest.wsdl</wsdl-file>
<jaxrpc-mapping-file>WEB-INF/InterestMapping.xml</jaxrpc-mapping-file>
<port-component>
<port-component-name>InterestPC</port-component-name>
<wsdl-port xmlns:ns="urn:objectweb:demo:interest">ns:InterestPort</wsdl-port>
<service-endpoint-interface>org.objectweb.interest.Interest</service-endpoint-interface>
<service-impl-bean>
<servlet-link>InterestServlet</servlet-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
InterestMapping.xml
<?xml version="1.0"?>
<java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"
version="1.1">
<package-mapping>
<package-type>org.objectweb.interest</package-type>
<namespaceURI>urn:objectweb:demo:interest</namespaceURI>
</package-mapping>
</java-wsdl-mapping>
Then copy the following wsdl file into WEB-INF/wsdl folder.
Interest.wsdl
-
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:objectweb:demo:interest" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:objectweb:demo:interest" xmlns:intf="urn:objectweb:demo:interest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2RC2
Built on Jan 28, 2005 (07:08:29 CET)-->
<wsdl:message name="getCompoundInterestRequest">
<wsdl:part name="in0" type="xsd:double"/>
<wsdl:part name="in1" type="xsd:double"/>
<wsdl:part name="in2" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="getCompoundInterestResponse">
<wsdl:part name="getCompoundInterestReturn" type="xsd:double"/>
</wsdl:message>
<wsdl:portType name="Interest">
<wsdl:operation name="getCompoundInterest" parameterOrder="in0 in1 in2">
<wsdl:input message="impl:getCompoundInterestRequest" name="getCompoundInterestRequest"/>
<wsdl:output message="impl:getCompoundInterestResponse" name="getCompoundInterestResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="InterestPortSoapBinding" type="impl:Interest">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getCompoundInterest">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getCompoundInterestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:objectweb:demo:interest" use="encoded"/>
</wsdl:input>
<wsdl:output name="getCompoundInterestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:objectweb:demo:interest" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="InterestService">
<wsdl:port binding="impl:InterestPortSoapBinding" name="InterestPort">
<wsdlsoap:address location="http://dummy-url"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Final i deploy into the jonas server.
check it by http://<hostname>:9000/interest/InterestPC/InterestPort?JWSDL.
It dhows the wsdl file..
Now web service is redady.... client to invoke this web service as follows..
client to invoke the web services.
--
I have create the directore structure for the cilent web-application..
interest-client
|
+-- (all static stuff here : index.html, ...)
|
+-- WEB-INF
|
+-- web.xml
+-- jonas-web.xml
+-- InterestMapping.xml
|
+-- classes/
||
|+-- org.objectweb.interest.Interest.java
|+-- org.objectweb.interest.InterestClientServlet.java
|
+-- wsdl/
|
+-- Interest.wsdl
Interest.java
-
package org.objectweb.interest;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Interest extends Remote {
double getCompoundInterest(double principal, double interest, int terms) throws RemoteException;
}
interest.InterestClientServlet.java
-
package org.objectweb.interest;
import java.io.IOException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
/**
*
*
* @author Guillaume Sauthier
*/
public class InterestClientServlet extends HttpServlet {
/**
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = 3978711709311513141L;
private static final String header =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " +
"<html>" +
" <head>" +
" <title>WebServices Client from a WebApp</title>" +
" <style type=\"text/css\"> @import \"style/ow_jonas.css\"; </style>" +
" </head>" +
"<body class=\"bodywelcome\">" +
" <div class=\"logos\">" +
"<a href=\"http://jakarta.apache.org\">" +
"<img title=\"Jakarta Tomcat\" alt=\"Jakarta Tomcat\"" +
"src=\"images/tomcat.gif\" />" +
"</a>" +
"<a href=\"http://jetty.mortbay.org/jetty/\"><img title=\"Mortbay Jetty\" alt=\"Mortbay Jetty\" src=\"images/jetty.gif\" /></a>" +
"<a href=\"http://jonas.objectweb.org\"><img title=\"JOnAS WebSite\" alt=\"JOnAS WebSite\" src=\"images/ow_jonas_logo.gif\" /></a>" +
" </div>" +
" <div class=\"titlepage\"> WebServices Client from a WebApp </div>" +
" <div class=\"links\">";
private static final String footer =
" </div>" +
"</body>" +
"</html>";
/**
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
processRequest(req, res);
}
/**
* @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
processRequest(req, res);
}
/**
* Process the GET/POST request
* @param req HTTP Request
* @param res HTTP Response
* @throws IOException If number parsing is failing (wrong format)
* @throws ServletException If JNDI problem occurs
*/
private void processRequest(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
// get the parameters
String principal = req.getParameter("principal");
String interest = req.getParameter("interest");
String terms = req.getParameter("terms");
// parse them
double pDouble = Double.valueOf(principal).doubleValue();
double iDouble = Double.valueOf(interest).doubleValue();
int tInteger = Integer.valueOf(terms).intValue();
// retrieve InitialContext
InitialContext ictx = null;
try {
ictx = new InitialContext();
} catch (NamingException e) {
ServletException se = new ServletException("Cannot create InitialContext", e);
throw se;
}
// perform the lookup on the Service instance
Service service = null;
String lookup = "java:comp/env/service/interest";
try {
service = (Service) ictx.lookup(lookup);
} catch (NamingException ne) {
ServletException se = new ServletException("Cannot lookup : " + lookup, ne);
throw se;
}
// get the Port based on the Interface class
Interest port = null;
try {
port = (Interest) service.getPort(Interest.class);
} catch (ServiceException svce) {
ServletException se = new ServletException("Cannot get Port from " + Interest.class.getName(), svce);
throw se;
}
// perform the ws operation
double result = port.getCompoundInterest(pDouble, iDouble, tInteger);
// print the result
res.getWriter().print(header);
res.getWriter().print("port.getCompoundInterest(" + principal + ", " + interest + ", " + terms + ")=" + result);
res.getWriter().print(footer);
}
}
web.xml
--
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
<display-name>WebApplication using Distant WebServices</display-name>
<servlet>
<servlet-name>InterestClientServlet</servlet-name>
<servlet-class>org.objectweb.interest.InterestClientServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>InterestClientServlet</servlet-name>
<url-pattern>/interest.do</url-pattern>
</servlet-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<service-ref>
<service-ref-name>service/interest</service-ref-name>
<service-interface>javax.xml.rpc.Service</service-interface>
<wsdl-file>WEB-INF/wsdl/InterestPort.wsdl</wsdl-file>
<jaxrpc-mapping-file>WEB-INF/InterestMapping.xml</jaxrpc-mapping-file>
<port-component-ref>
<service-endpoint-interface>org.objectweb.interest.Interest</service-endpoint-interface>
</port-component-ref>
</service-ref>
</web-app>
jonas-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jonas-web-app xmlns="http://www.objectweb.org/jonas/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.objectweb.org/jonas/ns
http://www.objectweb.org/jonas/ns/jonas-web-app_4_1_2.xsd" >
<jonas-service-ref>
<service-ref-name>service/interest</service-ref-name>
<jonas-port-component-ref>
<service-endpoint-interface>org.objectweb.interest.Interest</service-endpoint-interface>
<!--<wsdl-port xmlns:ns="urn:objectweb:demo:interest">ns:InterestPort</wsdl-port>-->
</jonas-port-component-ref>
</jonas-service-ref>
</jonas-web-app>
InterestMapping.xml
-
<?xml version="1.0"?>
<java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"
version="1.1">
<package-mapping>
<package-type>org.objectweb.interest</package-type>
<namespaceURI>urn:objectweb:demo:interest</namespaceURI>
</package-mapping>
</java-wsdl-mapping>
InterestPort.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:objectweb:demo:interest" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:objectweb:demo:interest" xmlns:intf="urn:objectweb:demo:interest" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2RC2
Built on Dec 15, 2004 (10:53:17 CET)-->
<wsdl:message name="getCompoundInterestRequest">
<wsdl:part name="in0" type="xsd:double"/>
<wsdl:part name="in1" type="xsd:double"/>
<wsdl:part name="in2" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="getCompoundInterestResponse">
<wsdl:part name="getCompoundInterestReturn" type="xsd:double"/>
</wsdl:message>
<wsdl:portType name="Interest">
<wsdl:operation name="getCompoundInterest" parameterOrder="in0 in1 in2">
<wsdl:input message="impl:getCompoundInterestRequest" name="getCompoundInterestRequest"/>
<wsdl:output message="impl:getCompoundInterestResponse" name="getCompoundInterestResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="InterestPortSoapBinding" type="impl:Interest">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getCompoundInterest">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getCompoundInterestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:objectweb:demo:interest" use="encoded"/>
</wsdl:input>
<wsdl:output name="getCompoundInterestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:objectweb:demo:interest" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="InterestService">
<wsdl:port binding="impl:InterestPortSoapBinding" name="InterestPort">
<wsdlsoap:address location=" http://<server-hostname>:9000/interest/InterestPC/InterestPort?JWSDL"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>WebServices Client from a WebApp</title>
<style type="text/css"> @import "style/ow_jonas.css"; </style>
</head>
<body class="bodywelcome">
<div class="logos">
<a href="http://jakarta.apache.org">
<img title="Jakarta Tomcat" alt="Jakarta Tomcat"
src="images/tomcat.gif" />
</a>
<a href="http://jetty.mortbay.org/jetty/"><img title="Mortbay Jetty" alt="Mortbay Jetty" src="images/jetty.gif" /></a>
<a href="http://jonas.objectweb.org"><img title="JOnAS WebSite" alt="JOnAS WebSite" src="images/ow_jonas_logo.gif" /></a>
</div>
<div class="titlepage"> WebServices Client from a WebApp </div>
<div class="links">
<form method="POST" action="interest.do">
principal (double) : <input type="text" name="principal" />
interest (double) : <input type="text" name="interest" />
terms (int) : <input type="text" name="terms" />
<input type="submit" name="execute"/>
</form>
</div>
</body>
</html>
Regards,
Jagadeesan.T