看看两段简单的JAVA代码,我们用它作为WSDL的服务实现代码:
//CatDTO.java
public class CatDTO
{
private long id;
private String name;
public long getId()
{
return id;
}
public String getName()
{
return name;
}
public void setId(long id)
{
this.id = id;
}
public void setName(String name)
{
this.name = name;
}
}
//Test.java
public class Test
{
public String echo(CatDTO cd){
return "Hello " + cd.getName();
}
}
然后看看用它导出的WSDL:
http://businessEngine.hongsoft.com" xmlns="
http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="
http://xml.apache.org/xml-soap" xmlns:impl="
http://businessEngine.hongsoft.com-impl" xmlns:intf="
http://businessEngine.hongsoft.com" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
//自定义类型
http://businessEngine.hongsoft.com" xmlns="
http://www.w3.org/2001/XMLSchema">
WSDL规则与示例(2)
最新推荐文章于 2025-11-29 14:22:46 发布
本文通过两个简单的Java类展示如何实现WSDL服务。首先定义了一个CatDTO类用于数据传输,接着创建了Test类提供echo方法,该方法接收CatDTO对象并返回带有名称的字符串。最终通过这些类导出了相应的WSDL文件。
31

被折叠的 条评论
为什么被折叠?



