2

我可以访问远程服务器,它为我提供 wsdl 回复我的响应。

我为此准备了客户端,基于该 wsdl。

现在我想写一个假服务器(用于测试需要),我应该首先开始什么?我应该执行哪些步骤?只有通过此 WSDL 实现测试才有意义。是否可以使用空方法生成某种服务?

在我的应用程序中,我使用 Apache Axis 1.4

我的步骤,我的想法:

  1. 我已经有:InterfacePortType类(据我所知,它代表远程服务器),它是基于 wsdl 为我的客户端生成的。所以我可以实现它,它将是MyService

    MyServer类实现InterfacePortType

  2. 然后以某种方式生成WSDD。我该怎么做?

我发现这里没有回答类似的问题。

4

2 回答 2

1

我找到了解决方案,我使用axistools-maven-plugin生成了WSDD,设置:serverSide参数为true - 然后它生成WSDD文件。

这是 Maven 插件部分:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>axistools-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>wsdl2java-job</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
            <configuration>
                <sourceDirectory>
                    src/main/config/wsdl2java/myfolder
                </sourceDirectory>
                <outputDirectory>
                    ${generatedSourcesDirectory}
                </outputDirectory>
                <testCases>false</testCases>
                <serverSide>true</serverSide>
                <subPackageByFileName>false</subPackageByFileName>
                <packageSpace>my.api</packageSpace>
            </configuration>
        </execution>
    </executions>
</plugin>
于 2012-09-28T16:59:42.507 回答
0

您需要客户端的存根和服务器端的骨架
谷歌这个以获得更多信息:轴从 wsdl 生成骨架

于 2012-09-28T07:39:49.333 回答