问题
I have access to remote sever that provides me wsdl back to my response.
I prepared Client for this, based on that wsdl.
Now I woud like to write a fake Server (for testing needs), what I should start first? Which steps I should implement? The test makes sense only if it is implemented by this WSDL. Is it possible to generate some kind of Service with empty methods?
In my app I use Apache Axis 1.4
My steps, how I think:
I already have: InterfacePortType class (which, as I understand, represents the remote Server), which was generated for my client based on wsdl. So I can implement it, and it would be MyService:
class MyServer implements InterfacePortType
Then generate somehow WSDD. How I can do it?
I found similar question here not answered.
回答1:
You need stubs for the client side and skeletons for the server side.
Google this for more info: axis generate skeleton from wsdl
回答2:
I found the solution, I generated WSDD using axistools-maven-plugin, setting: serverSide parameter to true - then it generates the WSDD file.
This is maven plugin part:
<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>
来源:https://stackoverflow.com/questions/12608282/how-to-generate-wsdd-based-on-code-or-based-on-wsdl