0

这是我用 Java 编写的简单 Web 服务:

@WebService
@XmlRootElement(name = "Customers")
@XmlAccessorType(XmlAccessType.FIELD)
public class Customers{

    @WebMethod
        @XmlElement(name="Customer")
    public String getCustomer() 
        { 
        return "Jack"; 
    } 
}

它部署在 Glassfish 3.1.2.2 (build 5) 服务器上。

SOAP 客户端是用 PHP 编写的,当我尝试使用 -

print_r($client->__getLastResponse());

我收到以下回复:

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body><ns2:getCustomerResponse xmlns:ns2="http://zch/"> <Customer>Jack</Customer> </ns2:getCustomerResponse ></S:Body></S:Envelope>

没有出现我创建的根元素@XmlRootElement(name = "Customers")

我的错误在哪里?

4

0 回答 0