WebService Axis2 (7): The Spring assembly JavaBean is released into WebService

Source: Internet
Author: User

The spring framework is often used to load JavaBean in today's Web applications. If you want to publish some of the JavaBean that are assembled in spring as WebService, it is easy to use the AXIS2 Spring-aware feature.

In the example of this article, in addition to the <tomcat installation directory >\webapps\axis2 directory and related libraries in the directory, you will need the Spring.jar file in the Spring framework to copy the file to the <tomcat installation directory >\ The Webapps\axis2\web-inf\lib directory.

The following is a JavaBean (the JavaBean will eventually be published as WebService) with the following code:

Package service;
Import entity. person;
public class Springservice
{
    private String name;
    Private String job;
    public void SetName (String name)
    {
        this.name = name;
    }
    public void Setjob (String job)
    {
        this.job = job;
    }
    Getperson () {person
    person
        = new person ();
        Person.setname (name);
        Person.setjob (Job);
        return person;
    }
    Public String getgreeting (string name)
    {return
        "hello" + name;
    }
}

Where person is also a javabean, the code is as follows:

Package entity;
public class person
{
    private String name;
    Private String job;
    Public String getName ()
    {return
        name;
    }
    public void SetName (String name)
    {
        this.name = name;
    }
    Public String getjob ()
    {return
        job;
    }
    public void Setjob (String job)
    {
        this.job = job;
    }
}

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.