我已经使用 Axis2 引擎(服务器和客户端)创建了 SOAP Web 服务 link 它运行良好。客户端的 Eclipse 插件(使用 WSDL 的代码生成)创建了 stub 、回调处理程序、公开的方法类等。到目前为止一切都很好。
我的一个 friend 给出了一些项目,其中也包含使用 axis2 的客户端。在这个项目中我可以看到一些如下文件:
`
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="count" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"count"
})
@XmlRootElement(name = "deleteMultipleResponse")
public class DeleteMultipleResponse {
protected String count;
/**
* Gets the value of the count property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCount() {
return count;
}
/**
* Sets the value of the count property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCount(String value) {
this.count = value;
}
}
`
我可以在下面看到多个文件以及注释的使用。
` /**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="count" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
`
我使用这个link创建的项目不会生成任何此类文件和任何使用注释的文件。
您能解释一下其中的区别吗?
最佳答案
您的 friend 似乎使用 JAXB 数据绑定(bind),而您显然没有使用。
AXIS2 数据绑定(bind)有多种不同的选项(ADB、Axiom、Jaxb 等)
您可能需要查看官方 Apache Axis2 教程以更深入地了解 http://axis.apache.org/axis2/java/core/docs/userguide-creatingclients.html#adb
关于java - SOAP Web 服务 : Axis2 1. 6.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24078142/