axis2 调用webservice

maven配置:主要引用包及plugins

 <properties>
        <axis2.version>1.6.1</axis2.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>${axis2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>${axis2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-http</artifactId>
            <version>${axis2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-local</artifactId>
            <version>${axis2.version}</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-wsdl2code-maven-plugin</artifactId>
                <version>1.6.1</version>
                <executions>
                    <execution>
                        <id>wsdl2code-client</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wsdl2code</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <wsdlFile>src/main/resources/wsdl/IXman.wsdl</wsdlFile>
                    <packageName>com.stub.generated</packageName>
                    <generateServicesXml>false</generateServicesXml>
                    <unpackClasses>true</unpackClasses>
                </configuration>
            </plugin>
        </plugins>
    </build>

通过wsdlFile属性指定wsdl所在文件。

用maven install即可生成中间代码,之后通过中间代码调用即可。

你可能感兴趣的:(axis2 调用webservice)