*********************src****************************************
public class mytest {
public String sayHi(String name){
return "No,"+name;
}
}
*************************************server.xml**********************************
<Context docBase="sfdc4" path="/sfdc4" reloadable="true"
source="org.eclipse.jst.j2ee.server:sfdc4"/>
<Context docBase="webtest" path="/webtest" reloadable="true"
source="org.eclipse.jst.j2ee.server:webtest"/></Host>
****************************************client*************************************
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestHello {
public static void main(String [] args) {
try {
String endpoint =
"http://172.25.14.77:8080/webtest/services/mytest";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://172.25.14.77/services/mytest", "sayHi"));
String ret = (String) call.invoke( new Object[] { "eSamland" } );
System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
********************************undeply.wsdd******************************************
<
undeploymentxmlns="http://xml.apache.org/axis/wsdd/">
<!-- Services from mytestService WSDL service -->
</
<!-- Services from mytestService WSDL service -->
<service name="mytest" provider="java:RPC" style="wrapped" use="literal">
<parameter name="wsdlTargetNamespace" value="http://defaultnamespace%22/>
<parameter name="wsdlServiceElement" value="mytestService"/>
<parameter name="schemaQualified" value="http://defaultnamespace%22/>
<parameter name="wsdlServicePort" value="mytest"/>
<parameter name="className" value="mytest"/>
<parameter name="wsdlPortType" value="mytest"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation xmlns:operNS="http://defaultnamespace/" xmlns:retNS="http://defaultnamespace/" xmlns:rtns="http://www.w3.org/2001/XMLSchema" name="sayHi" qname="operNS:sayHi" returnQName="retNS:sayHiReturn" returnType="rtns:string" soapAction="">
<parameter xmlns:pns="http://defaultnamespace/" xmlns:tns="http://www.w3.org/2001/XMLSchema" qname="pns:name" type="tns:string"/>
</operation>
<parameter name="allowedMethods" value="sayHi"/>
</service>
</deployment>
**********************************web.xml*(web-inf)****************************************
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Apache-Axis</display-name>
<listener>
<listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
</listener>
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AxisServlet
</servlet-class>
</servlet>
<servlet>
<servlet-name>AdminServlet</servlet-name>
<display-name>Axis Admin Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AdminServlet
</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet>
<servlet-name>SOAPMonitorService</servlet-name>
<display-name>SOAPMonitorService</display-name>
<servlet-class>
org.apache.axis.monitor.SOAPMonitorService
</servlet-class>
<init-param>
<param-name>SOAPMonitorPort</param-name>
<param-value>5001</param-value>
</init-param>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SOAPMonitorService</servlet-name>
<url-pattern>/SOAPMonitor</url-pattern>
</servlet-mapping>
<!-- uncomment this if you want the admin servlet -->
<!--
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
-->
<session-config>
<!-- Default to 5 minute session timeouts -->
<session-timeout>5</session-timeout>
</session-config>
<!-- currently the W3C havent settled on a media type for WSDL;
http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
for now we go with the basic 'it's XML' response -->
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jws</welcome-file>
</welcome-file-list>
</web-app>
******************wsdd**********************(web-inf)***************************************
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
<parameter name="sendMultiRefs" value="true"/>
<parameter name="disablePrettyXML" value="true"/>
<parameter name="adminPassword" value="admin"/>
<parameter name="attachments.Directory"
value="C:\My_Work\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\webtest\WEB-
INF\attachments"/>
<parameter name="dotNetSoapEncFix" value="true"/>
<parameter name="enableNamespacePrefixOptimization" value="false"/>
<parameter name="sendXMLDeclaration" value="true"/>
<parameter name="attachments.implementation"
value="org.apache.axis.attachments.AttachmentsImpl"/>
<parameter name="sendXsiTypes" value="true"/>
<requestFlow>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="session"/>
</handler>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="request"/>
<parameter name="extension" value=".jwr"/>
</handler>
</requestFlow>
</globalConfiguration>
<handler name="LocalResponder" type="java:org.apache.axis.transport.local.LocalResponder"/>
<handler name="URLMapper" type="java:org.apache.axis.handlers.http.URLMapper"/>
<handler name="Authenticate" type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
<service name="test2" provider="java:RPC" style="wrapped" use="literal">
<operation name="sayHi" qname="ns1:sayHi" returnQName="ns1:sayHiReturn" returnType="xsd:string"
soapAction="" xmlns:ns1="http://defaultnamespace/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<parameter qname="ns1:in0" type="xsd:string"/>
</operation>
<parameter name="allowedMethods" value="sayHi"/>
<parameter name="wsdlPortType" value="test2"/>
<parameter name="typeMappingVersion" value="1.2"/>
<parameter name="schemaQualified" value="http://defaultnamespace%22/>
<parameter name="wsdlServicePort" value="test2"/>
<parameter name="className" value="test2"/>
<parameter name="wsdlTargetNamespace" value="http://defaultnamespace%22/>
<parameter name="wsdlServiceElement" value="test2Service"/>
</service>
<service name="AdminService" provider="java:MSG">
<parameter name="allowedMethods" value="AdminService"/>
<parameter name="enableRemoteAdmin" value="false"/>
<parameter name="className" value="org.apache.axis.utils.Admin"/>
<namespace>http://xml.apache.org/axis/wsdd/</namespace>
</service>
<service name="Version" provider="java:RPC">
<parameter name="allowedMethods" value="getVersion"/>
<parameter name="className" value="org.apache.axis.Version"/>
</service>
<service name="mytest" provider="java:RPC" style="wrapped" use="literal">
<operation name="sayHi" qname="ns2:sayHi" returnQName="ns2:sayHiReturn" returnType="xsd:string"
soapAction="" xmlns:ns2="http://defaultnamespace/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<parameter qname="ns2:name" type="xsd:string"/>
</operation>
<parameter name="allowedMethods" value="sayHi"/>
<parameter name="typeMappingVersion" value="1.2"/>
<parameter name="wsdlPortType" value="mytest"/>
<parameter name="className" value="mytest"/>
<parameter name="wsdlServicePort" value="mytest"/>
<parameter name="schemaQualified" value="http://defaultnamespace%22/>
<parameter name="wsdlTargetNamespace" value="http://defaultnamespace%22/>
<parameter name="wsdlServiceElement" value="mytestService"/>
</service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
<parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
<parameter name="qs.list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs.method" value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs.wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
</transport>
<transport name="local">
<responseFlow>
<handler type="LocalResponder"/>
</responseFlow>
</transport>
</deployment>
********************************deply.wsdd*********************************************
<?xml version="1.0" encoding="UTF-8"?><!-- 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">