如何基于代码或基于WSDL生成WSDD

时间:2012-09-26 18:39:07

标签: java web-services axis

我可以访问远程服务器,它将wsdl提供给我的响应。

我根据wsdl为此准备了客户端。

现在我想写一个假的服务器(用于测试需求),我应该先开始做什么?我应该实施哪些步骤?只有当它由此WSDL实现时,该测试才有意义。是否可以使用空方法生成某种服务?

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

我的步骤,我的想法:

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

    MyServer 实现 InterfacePortType

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

  3. 我发现类似的问题here没有回答。

2 个答案:

答案 0 :(得分:0)

客户端需要存根,服务器端需要骨架
谷歌有关更多信息:轴从wsdl生成骨架

答案 1 :(得分:0)

我找到了解决方案,我使用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>
     </plugin>