3

我尝试使用 JAXB2.1 从模式 xsd 生成 java 类并运行 XJC 并且它可以工作。我已将模式包含在 wsdl 文件中,并使用 CXF 使用 wsdl2java 命令生成 java 类。

问题在于存在差异的 java 类:差异在于 wsdl2java 命令缺少的内容属性及其 getter 和 setter。

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
//


import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;



@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BIN", **propOrder = {
    "content"**
})
@XmlSeeAlso({
    ED.class
})
public abstract class BIN {

    **@XmlValue
    protected String content;**
    @XmlAttribute
    protected BinaryDataEncoding representation;

    /**


    public String getContent() {
        return content;
    }

    /**
     * 
     *             Binary data is a raw block of bits. Binary data is a
     *             protected type that MUST not be used outside the data
     *             type specification.
     *          
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    **public void setContent(String value) {
        this.content = value;
    }**

    /**
     * Gets the value of the representation property.
     * 
     * @return
     *     possible object is
     *     {@link BinaryDataEncoding }
     *     
     */
    public BinaryDataEncoding getRepresentation() {
        if (representation == null) {
            return BinaryDataEncoding.TXT;
        } else {
            return representation;
        }
    }

    /**
     * Sets the value of the representation property.
     * 
     * @param value
     *     allowed object is
     *     {@link BinaryDataEncoding }
     *     
     */
    public void setRepresentation(BinaryDataEncoding value) {
        this.representation = value;
    }

}

我需要这个属性进入这个类。

有没有办法像添加参数一样做到这一点?

这是我的 wsdl2java 命令:

call wsdl2java -Debug -verbose -exsh true  -autoNameResolution -p %PACKAGE_BASE%.pa -p "urn:hl7-org:v3"=%PACKAGE_BASE%.patient.hl -d %PROJECT_HOME%\src\main\java\  %WSDL_HOME%\Test.wsdl

谢谢

4

0 回答 0