2015-10-20 70 views
0

我是一个Java newbye。 我正在开发一个肥皂服务并尝试使用Soapui进行测试。使用Soap的Java Arraylist问题

除了返回一个数据列表,我得到空白以外,一切正常。

@WebMethod(operationName = "getOutputs", action = "getOutputs") 
public ArrayList<String> getOutputs() { 
    _log.info(">> getOutputs"); 
    ArrayList<String> stat = new ArrayList<>(); 
    try { 
     stat.add("prova");  
     _log.info("<< getOutputs. Adding prova. len is " + stat.size());   
    } catch (Exception e) { 
     _log.error("getOutputs Error"); 
    }   

    return stat; 
} 

当我运行SOAPUI即使在调试统计cointains一个元素我没有得到的值。日志文件也表示它拥有一个元素。 我该如何解决这个问题?

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
<S:Body> 
    <ns2:getOutputsResponse xmlns:ns2="http://xxxx.com/"> 
    <return/> 
    </ns2:getOutputsResponse> 
</S:Body> 
</S:Envelope> 

回答

0

我只是想创建一个使用JAX-WS Web服务API服务,释放EE 1.6的Java的一部分,是能够得到的结果:

SOAP请求

<?xml version = '1.0' encoding = 'UTF-8'?> 
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://client/"> 
<env:Header/> 
<env:Body> 
    <ns1:getOutputs/> 
</env:Body> 
</env:Envelope> 

并得到以下回应:

<?xml version = '1.0' encoding = 'UTF-8'?> 
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
    <ns0:getOutputsResponse xmlns:ns0="http://client/"> 
    <return>prova</return> 
    </ns0:getOutputsResponse> 
    </S:Body> 
</S:Envelope>