I'm implementing a WebService with Apache Axis. This service receives as a parameter a ParameterBean class that contains these members:
我正在使用Apache Axis实现WebService。此服务接收包含以下成员的ParameterBean类作为参数:
public class ParameterBean {
protected String userName = "";
protected String password = "";
protected int clientID = 0;
protected int orgID = 0;
protected HashMap<String, String> mainTable = new HashMap<String, String>();
}
Plus traditional getters and setters. I've implemented a special constructor:
再加上传统的吸气剂和二传手。我已经实现了一个特殊的构造函数:
public ParameterBean(String userName, String password, int clientID, int orgID) {
this.userName = userName;
this.password = password;
this.clientID = clientID;
this.orgID = orgID;
}
Adittionaly, this class has some basic methods like:
Adittionaly,这个类有一些基本的方法,如:
public void addColumnToMainTable(String columnName, String columnValue) {
addColumnOnTable(mainTable, columnName, columnValue);
}
However, when I run java2wsdl and wsdl2java; the generated ParameterBean source code differs a lot. The method addColumnToMainTable() is gone, and the constructor generated is this one (which differs from the original):
但是,当我运行java2wsdl和wsdl2java时;生成的ParameterBean源代码差别很大。方法addColumnToMainTable()消失了,生成的构造函数就是这个(与原来的不同):
public ParameterBean(
int clientID,
java.util.HashMap mainTable,
int orgID,
java.lang.String password,
java.lang.String userName) {
this.clientID = clientID;
this.mainTable = mainTable;
this.orgID = orgID;
this.password = password;
this.userName = userName;
}
My build.xml:
<target name="generateWSDL" description="Generates wsdl files from the java service interfaces">
<mkdir dir="${wsdl.dir}"/>
<axis-java2wsdl classpathref="classpath"
output="${wsdl.dir}/ExampleWS.wsdl"
location="http://localhost:8080/axis/services/ExampleWS"
namespace="org.example.ws"
classname="org.example.ws.ExampleWS">
</axis-java2wsdl>
</target>
<target name="generateWSDD" description="Generates wsdd files from the wsdl files">
<mkdir dir="${wsdd.dir}"/>
<axis-wsdl2java
output="${wsdd.dir}"
deployscope="Application"
serverside="true"
url="${wsdl.dir}\ExampleWS.wsdl">
</axis-wsdl2java>
</target>
Why the differences in the generated code? How can I fix it? I'm using Axis 1.4. Thanks.
为什么生成代码的差异?我该如何解决?我正在使用Axis 1.4。谢谢。
EDIT: What's more important to me is: which class should should I use (server-side and client-side)? Mine or the generated one?
编辑:对我来说更重要的是:我应该使用哪个类(服务器端和客户端)?我或生成的?
1 个解决方案
#1
0
Well, reading carrefully the Axis documentation, the generated classes will differ because the WSDL does not contain any information about code implementation, thus the default constructor and no other methods beyond getters/setters.
好吧,读取Axis文档,生成的类将有所不同,因为WSDL不包含任何有关代码实现的信息,因此默认构造函数除了getter / setter之外没有其他方法。
For the client, I can use the generated class or the original one, both work just fine.
对于客户端,我可以使用生成的类或原始类,两者都可以正常工作。
#1
0
Well, reading carrefully the Axis documentation, the generated classes will differ because the WSDL does not contain any information about code implementation, thus the default constructor and no other methods beyond getters/setters.
好吧,读取Axis文档,生成的类将有所不同,因为WSDL不包含任何有关代码实现的信息,因此默认构造函数除了getter / setter之外没有其他方法。
For the client, I can use the generated class or the original one, both work just fine.
对于客户端,我可以使用生成的类或原始类,两者都可以正常工作。