Axis2

来源:互联网 发布:led荧光板软件 编辑:程序博客网 时间:2024/05/11 01:02
最近做一个项目用到了Axis2,看了看

Axis2 ships with a lotof useful tools to make web service developer's life easier. Maven2WSDL2Code plugin is one of them which can be used to generate serverside skeletons or client stubs from a given WSDL using a maven pom.xml.

1 you shoud install   Maven2WSDL2Code plugin.


2 Create a maven project using maven archetype template (You may ignorethis step and use an existing project if you are familiar with maven)

  mvn archetype:create  -DgroupId =com.dys.wsdltocode  DartfactId =test

3 create a dictory(eg:src/main/resources )  and copy your wsdl to the dictory  
   ,then remove the existring contents of the auto-generated pom.xml and copy the following  configuration.


   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.test</groupId>
  <artifactId>calculator</artifactId>
   <version>1.0-SNAPSHOT</version>
  <name>calculator</name>
  <url>http://maven.apache.org</url>
  <build>
  <plugins>
  <plugin>
        <groupId>org.apache.axis2</groupId>
         <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsdl2code</goal>
                        </goals>
                        </execution>
            </executions>
                    <configuration>
                    <packageName>org.charitha</packageName>              
                    <wsdlFile>src/main/resources/calculator.wsdl</wsdlFile>
                    <databindingName>adb</databindingName>                    
                </configuration>              
            </plugin>
</plugins>
</build>

  <dependencies>
    <dependency>
          <groupId>org.apache.axis2</groupId>
          <artifactId>axis2</artifactId>
          <version>1.4</version>
    </dependency>
  </dependencies>
</project>


4 Go to the root dictory of your structure  and run the following command .

     mvn  wsdl2code:wsdl2code

  You can  find  generate classes at  target/generated-sources/axis2/wsdl2code directory.
原创粉丝点击