从WSDL生成的类 - 无法将符号解析为复杂类型

时间:2017-04-02 14:47:27

标签: java web-services maven intellij-idea wsdl

我正在尝试使用maven apache cxf plugin ver从WSDL生成类。 3.0.2。运行插件maven后说构建成功。

所有类都是创建的,但是当我看一下它们时,所有包含其他类的类都无法解析。我很难找到问题所在。我的插件有问题吗? WSDL?或者在Intellij中有某种排斥?

enter image description here

pom.xml中的

插件:

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions targetNamespace="cz.cvut.fel" name="PrintingServiceService"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="cz.cvut.fel"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsdl:types>
        <xs:schema targetNamespace="cz.cvut.fel" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                   xmlns:tns="cz.cvut.fel" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="unqualified"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:element name="processEmail" type="tns:processEmail"/>
            <xs:element name="processEmailResponse" type="tns:processEmailResponse"/>

            <xs:complexType name="processEmail">
                <xs:sequence>
                    <xs:element name="request" type="tns:SendEmailRequest" minOccurs="0"/>
                </xs:sequence>
            </xs:complexType>

            <xs:complexType name="SendEmailRequest">
                <xs:sequence>
                    <xs:element name="email" type="tns:Email"/>
                </xs:sequence>
            </xs:complexType>

            <xs:complexType name="Email">
                <xs:sequence>
                    <xs:element name="id" type="xs:long"/>
                    <xs:element name="subject" type="xs:string"/>
                    <xs:element name="text" type="xs:string"/>
                    <xs:element name="sender" type="tns:User"/>
                    <xs:element name="receiver" type="tns:User"/>
                </xs:sequence>

            </xs:complexType>
            <xs:complexType name="User">
                <xs:sequence>
                    <xs:element name="id" type="xs:long"/>
                    <xs:element name="emailAddress" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>

            <xs:complexType name="processEmailResponse">
                <xs:sequence>
                    <xs:element name="response" type="tns:SendEmailResponse" minOccurs="0"/>
                </xs:sequence>
            </xs:complexType>


            <xs:complexType name="SendEmailResponse">
                <xs:sequence>
                    <xs:element name="result" type="xs:boolean"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>


    <wsdl:message name="processEmail">
        <wsdl:part name="parameters" element="tns:processEmail"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="processEmailResponse">
        <wsdl:part name="parameters" element="tns:processEmailResponse"></wsdl:part>
    </wsdl:message>

    <wsdl:portType name="PrintingService">
        <wsdl:operation name="processEmail">
            <wsdl:input name="processEmail" message="tns:processEmail"></wsdl:input>
            <wsdl:output name="processEmailResponse" message="tns:processEmailResponse"></wsdl:output>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="PrintingServiceServiceSoapBinding" type="tns:PrintingService">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="processEmail">
            <soap:operation style="document" soapAction=""/>
            <wsdl:input name="processEmail">
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="processEmailResponse">
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="PrintingServiceService">
        <wsdl:port name="PrintingServicePort" binding="tns:PrintingServiceServiceSoapBinding">
            <soap:address location="http://localhost:8081/cz.cvut.fel/services/processEmail"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

这是我的WSDL:

package cz.cvut.fel.ws.email;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for Email complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="Email">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}long"/>
 *         &lt;element name="subject" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="text" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="sender" type="{cz.cvut.fel}User"/>
 *         &lt;element name="receiver" type="{cz.cvut.fel}User"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Email", propOrder = {
    "id",
    "subject",
    "text",
    "sender",
    "receiver"
})
public class Email {

    protected long id;
    @XmlElement(required = true)
    protected String subject;
    @XmlElement(required = true)
    protected String text;
    @XmlElement(required = true)
    protected User sender; // CANNOT RESOLVER SYMBOL USER !
    @XmlElement(required = true)
    protected User receiver; // CANNOT RESOLVER SYMBOL USER !

    /**
     * Gets the value of the id property.
     * 
     */
    public long getId() {
        return id;
    }

    /**
     * Sets the value of the id property.
     * 
     */
    public void setId(long value) {
        this.id = value;
    }

    /**
     * Gets the value of the subject property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getSubject() {
        return subject;
    }

    /**
     * Sets the value of the subject property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setSubject(String value) {
        this.subject = value;
    }

    /**
     * Gets the value of the text property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getText() {
        return text;
    }

    /**
     * Sets the value of the text property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setText(String value) {
        this.text = value;
    }

    /**
     * Gets the value of the sender property.
     * 
     * @return
     *     possible object is
     *     {@link User }
     *     
     */
    public User getSender() {
        return sender;
    }

    /**
     * Sets the value of the sender property.
     * 
     * @param value
     *     allowed object is
     *     {@link User }
     *     
     */
    public void setSender(User value) {
        this.sender = value;
    }

    /**
     * Gets the value of the receiver property.
     * 
     * @return
     *     possible object is
     *     {@link User }
     *     
     */
    public User getReceiver() {
        return receiver;
    }

    /**
     * Sets the value of the receiver property.
     * 
     * @param value
     *     allowed object is
     *     {@link User }
     *     
     */
    public void setReceiver(User value) {
        this.receiver = value;
    }

}

生成的类(无法解析符号用户的电子邮件)

{{1}}

生成的类的结构:
enter image description here

0 个答案:

没有答案
相关问题