0

我需要你的帮助。使用的版本是 JAX-WS RI 2.2.6b21 / SOAP 1.2

我正在开发一个 WS 客户端来连接供应商制造的 WebService 服务器。我能够发送下一个 XML 请求:

<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
    <S:Body>
        <ns2:executeAbout xmlns:ns2="http://vendor.com/">
            <About/>
        </ns2:executeAbout>
    </S:Body>
</S:Envelope>

并在 XML 响应表单 WebService 服务器下方:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://vendor.com/">
    <soapenv:Body>
        <executeAboutResponse xmlns="">
            <AboutResponse success="true">
            </AboutResponse>
        </executeAboutResponse>
    </soapenv:Body>
</soapenv:Envelope>

AboutResponseType 班级:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AboutResponseType", propOrder = {
    "result",
    "messages"
})
public class AboutResponseType {

    @XmlElement(name = "Result")
    protected AboutResultType result;
    @XmlElement(name = "Messages")
    protected MessagesType messages;
    @XmlAttribute(name = "success")
    protected Boolean success;

    /**
     * Gets the value of the result property.
     * 
     * @return
     *     possible object is
     *     {@link AboutResultType }
     *     
     */
    public AboutResultType getResult() {
        return result;
    }

    /**
     * Sets the value of the result property.
     * 
     * @param value
     *     allowed object is
     *     {@link AboutResultType }
     *     
     */
    public void setResult(AboutResultType value) {
        this.result = value;
    }

    /**
     * Gets the value of the messages property.
     * 
     * @return
     *     possible object is
     *     {@link MessagesType }
     *     
     */
    public MessagesType getMessages() {
        return messages;
    }

    /**
     * Sets the value of the messages property.
     * 
     * @param value
     *     allowed object is
     *     {@link MessagesType }
     *     
     */
    public void setMessages(MessagesType value) {
        this.messages = value;
    }

    /**
     * Gets the value of the success property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    public Boolean isSuccess() {
        return success;
    }

    /**
     * Sets the value of the success property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    public void setSuccess(Boolean value) {
        this.success = value;
    }

}

但不幸的是,JAVA 对象响应为 null 并且没有引发 java 异常:

AboutType aboutType = new AboutType();
AboutResponseType aboutResponse = myProxy.executeAbout(aboutType);
 assertNotNull(aboutResponse);

我通过在互联网上搜索了解到,这是响应中的名称空间问题。但是问题出在哪里以及如何解决?

非常感谢您的帮助,我不知道。

4

0 回答 0