Developing a Web service server with axis

Source: Internet
Author: User
Tags wsdl

First, Axis environment construction

 1. Install the environment JDK, tomcat or resin, eclipse, etc.

2. Download the jar package from axis to Http://www.apache.org/dyn/closer.cgi/ws/axis/1_4

3. Place the jar package of axis into the Web-inf/lib directory

Ii. writing a Web service server

  1. Writing Services

 Package Com.webservice;  Public class Hellowebservice {    public  string Doservice (string name) {        = "Hello" + Name ;         return result;}    }

2. Configuring the Web. xml file

<!--start of WebService setting -    <servlet>        <Servlet-name>Axis</Servlet-name>        <Servlet-class>Org.apache.axis.transport.http.AxisServlet</Servlet-class>        <Load-on-startup>5</Load-on-startup>    </servlet>    <servlet-mapping>        <Servlet-name>Axis</Servlet-name>        <Url-pattern>/webservice/*</Url-pattern>    </servlet-mapping>    <servlet>        <Servlet-name>Soapmonitorservice</Servlet-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>Soapmonitorservice</Servlet-name>        <Url-pattern>/soapmonitor</Url-pattern>    </servlet-mapping>    <!--End of WebService setting -

3. Configuring the WEB-INF/SERVER-CONFIG.WSDD File

<?XML version= "1.0" encoding= "UTF-8"?><Deploymentname= "Defaultclientconfig"Xmlns:java= "Http://xml.apache.org/axis/wsdd/providers/java"Xmlns:handler= "Http://xml.apache.org/axis/wsdd/providers/handler"xmlns= "http://xml.apache.org/axis/wsdd/">    <globalconfigurationname= "Defaultclientconfig">        <Requestflowname= "RequestFlow1"type="">            <Handlername= "Handler1"type= "Java:org.apache.axis.handlers.JWSHandler">                <parametername= "Scope"value= "Session" />            </Handler>            <Handlername= "Handler2"type= "Java:org.apache.axis.handlers.JWSHandler">                <parametername= "Scope"value= "Request" />                <parametername= "extension"value= ". Jwr" />            </Handler>        </Requestflow>    </globalconfiguration>    <Handlername= "Urlmapper"type= "Java:org.apache.axis.handlers.http.URLMapper" />    <Handlername= "Localresponder"type= "Java:org.apache.axis.transport.local.LocalResponder" />    <Handlername= "Authenticate"type= "Java:org.apache.axis.handlers.SimpleAuthenticationHandler" />    <Transportname= "http"type="">        <Requestflowname= "RequestFlow1"type="">            <Handlername= "Handler1"type= "Urlmapper" />            <Handlername= "Handler2"type= "Java:org.apache.axis.handlers.http.HTTPAuthHandler" />        </Requestflow>    </Transport>    <Transportname= "local"type="">        <Responseflowname= "ResponseFlow1"type="">            <Handlername= "Handler1"type= "Localresponder" />        </Responseflow>    </Transport>    <!--Each webservice requires one of the following configurations, name is the request name for access -    <Servicename= "HelloService"provider= "Java:rpc"style= "RPC" Use= "encoded">        <parametername= "Scope"value= "Request"/>        <!--ClassName service class for actual access -        <parametername= "ClassName"value= "Com.webservice.HelloWebservice"/>        <!--Allowedmethods service methods for actual access -        <parametername= "Allowedmethods"value= "Doservice" />    </Service></Deployment>

4. Visit WebService

Address field input: http://localhost:8080/project name/webservice/helloservice?wsdl

The creation of a WSDL file indicates a successful service-side build-up

5. Using the SOAPUI test interface

  

Return to success, service-side build completed.

Developing a Web service server with axis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.