我正在尝试在java中创建一个Web服务,您将传递二维数组作为参数。当我使用Web服务探索测试它时,我不断收到此错误:
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>org.xml.sax.SAXException: Found character data inside an array element while deserializing</faultstring>
- <detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">Name</ns1:hostname>
</detail>
</soapenv:Fault>
知道为什么?
答案 0 :(得分:-1)
最好将二维数组包装在一个对象中,然后使用像ArrayList这样的东西而不是实际的数组。使用Java和JAXB绑定的Web服务可以更好地工作。
public class MyTwoDimensionalArrayWrapper {
private Collection dimensionOne = new ArrayList();
private Collection dimensionTwo = new ArrayList();
...
//getters and setters, etc.
//note I did not put any annotations on this..just a skeleton to give you an idea to help.
}